Re: 3-table query optimization

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michal Taborsky - Internet Mall <michal(dot)taborsky(at)mall(dot)cz>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: 3-table query optimization
Date: 2006-08-09 15:08:59
Message-ID: 20367.1155136139@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Michal Taborsky - Internet Mall <michal(dot)taborsky(at)mall(dot)cz> writes:
> SELECT product.product_id
> FROM action
> JOIN product ON (product.product_id=action.product_id)
> WHERE action.shop_group_id=1
> AND EXISTS (SELECT 1
> FROM catalog.product_program
> WHERE product_id=product.product_id
> AND product_program.program_id =1104322
> )

Try converting the EXISTS subquery to an IN.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Marlowe 2006-08-09 15:15:27 Re: most bang for buck with ~ $20,000
Previous Message Tom Lane 2006-08-09 14:39:06 Re: Optimizing queries