Re: Another sub-select problem... - Mailing list pgsql-sql

From Rod Taylor
Subject Re: Another sub-select problem...
Date
Msg-id 1053651383.279.19.camel@jester
Whole thread Raw
In response to Another sub-select problem...  (Kevin Ready <kevin@meridianis.com>)
List pgsql-sql
> AND blockID IN (SELECT blockid FROM block WHERE parent_component_classid
> IN(8,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,39,40,41,42,43,44,45,
> 46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,
> 71,72,73,75,76,77,78,79,80,81,82,83,84,85,86,88,117,133,143,145,146,178,188,
> 193,197)

Have you tried the above in the EXISTS form?

AND EXISTS (SELECT TRUE FROM block WHERE parent_component_classid IN
(<list>) AND blockid = row.blockid)

Exists as shown above will probably be significantly faster for 7.3 and
prior if parent_component_classid.blockid is indexed.  In 7.4 you may
wish to try the IN style again, as there is a chance it'll be right.

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

pgsql-sql by date:

Previous
From: Rod Taylor
Date:
Subject: Re: tablename as attribute in pgplsql
Next
From: Joe Conway
Date:
Subject: Re: Another sub-select problem...