Re: 3-table query optimization - Mailing list pgsql-performance

From Michal Taborsky - Internet Mall
Subject Re: 3-table query optimization
Date
Msg-id 44DAE09B.20009@mall.cz
Whole thread Raw
In response to Re: 3-table query optimization  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: 3-table query optimization  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: 3-table query optimization  ("Jim C. Nasby" <jnasby@pervasive.com>)
List pgsql-performance
Tom Lane napsal(a):
> Michal Taborsky - Internet Mall <michal.taborsky@mall.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.

The performance is roughly the same. For some groups it's better, for
some groups, the bigger ones, it's a bit worse. I forgot to mention,
that the server is running 8.0.2. Upgrading would be a bit painful, as
it is a 24/7 production system, but if it would help significantly, we'd
give it a go.

--
Michal Táborský


pgsql-performance by date:

Previous
From: "Carl Youngblood"
Date:
Subject: Beginner optimization questions, esp. regarding Tsearch2 configuration
Next
From: Sue Fitt
Date:
Subject: setting up foreign keys