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

From Tom Lane
Subject Re: planer don't use index. bad plan for where id = x or id in (select ...)
Date
Msg-id 8712.1085588867@sss.pgh.pa.us
Whole thread Raw
In response to Re: planer don't use index. bad plan for where id = x or id in (select ...)  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
Greg Stark <gsstark@mit.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

pgsql-general by date:

Previous
From: "Mario Soto"
Date:
Subject: performance very slow
Next
From: "Matt Van Mater"
Date:
Subject: Re: [HACKERS] COPY formatting