Re: Join query on 1M row table slow

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: CSN <cool_screen_name90001(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Join query on 1M row table slow
Date: 2004-02-11 04:31:54
Message-ID: 14832.1076473914@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"scott.marlowe" <scott(dot)marlowe(at)ihs(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-02-11 05:10:29 Re: Temporary views
Previous Message muteki muteki 2004-02-11 04:29:50 pg_class and relfilenode