Re: planer don't use index. bad plan for where id = x or id in (select ...)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: planer don't use index. bad plan for where id = x or id in (select ...)
Date: 2004-05-26 16:27:47
Message-ID: 8712.1085588867@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greg Stark <gsstark(at)mit(dot)edu> writes:
> ... And you can use UNION ALL instead of UNION
> since the IN will eliminate duplicates anyways. This avoids an extra
> sort/uniquify step.

FWIW, CVS tip realizes that it doesn't need two unique-ification steps
in this scenario. But I agree that UNION ALL is the cleaner way to
write the query.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Matt Van Mater 2004-05-26 16:34:05 Re: [HACKERS] COPY formatting
Previous Message Bill Montgomery 2004-05-26 16:25:45 Re: [GENERAL] performance very slow