Re: [PERFORM] Question about subselect/IN performance

2010-11-30 Thread bricklen
On Tue, Nov 30, 2010 at 3:23 PM, T.H. wrote: > Just looking into it now, thanks for the suggestion. Is there a reason that > EXISTS is generally faster than IN for this sort of query? > > -Tristan Exists will return immediately upon finding a match -- assuming there is one. -- Sent via pgsql-pe

Re: [PERFORM] Question about subselect/IN performance

2010-11-30 Thread T.H.
On 11/30/10 5:54 PM, Kevin Grittner wrote: "T.H." wrote: Also, are there any better ways you can think of doing such an IN query, using non-subselect means that might be more efficient? Have you tried the EXISTS predicate? -Kevin Just looking into it now, thanks for the suggestion. Is th

Re: [PERFORM] Question about subselect/IN performance

2010-11-30 Thread Kevin Grittner
"T.H." wrote: > Also, are there any better ways you can think of doing such an IN > query, using non-subselect means that might be more efficient? Have you tried the EXISTS predicate? -Kevin -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to yo

[PERFORM] Question about subselect/IN performance

2010-11-30 Thread T.H.
I have a query that's running an IN/Subselect that joins three different tables and gets a list of IDs to compare against... the subselect basically looks for records through a join table based on the 3rd table's name, similar to: ... IN (SELECT id FROM foo, foo_bar, bar WHERE foo.id =