Re: Join query on 1M row table slow - Mailing list pgsql-general

From Tom Lane
Subject Re: Join query on 1M row table slow
Date
Msg-id 14832.1076473914@sss.pgh.pa.us
Whole thread Raw
In response to Re: Join query on 1M row table slow  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
"scott.marlowe" <scott.marlowe@ihs.com> writes:
> Oh, another thing is to make your select in the in() clause a select
> distinct and see if that helps.  If you've got a whole bunch of duplicates
> running around in it it's sometimes faster to distinct it.  Then again,
> given all the work Tom's been putting in the query planner / optimization,
> he may have already done something like that.

As of CVS tip I would not recommend inserting DISTINCT in an "IN
(subselect)" construct --- the planner will do the equivalent for itself
if it figures that's the best way.  I do not recall this late at night
whether all the relevant changes were in 7.4 or not ...

            regards, tom lane

pgsql-general by date:

Previous
From: "muteki muteki"
Date:
Subject: pg_class and relfilenode
Next
From: Tom Lane
Date:
Subject: Re: Temporary views