Re: Planning without reason. - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Planning without reason.
Date
Msg-id 87r71fy49m.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: Planning without reason.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> It's conceivable that the planner could prove that neither effect is
> possible in a particular query and then make the transformation
> automatically, but I'm not about to expend that kind of planning effort
> on such an odd case --- checking for it would waste entirely too many
> cycles in most cases.

Fwiw these aren't really very rare cases. Usually it goes the other direction
though. I seem to recall Oracle did in fact support a plan where it converted
OR expressions into a kind of union plan node.

But I think Postgres's bitmap index scan satisfies much of the same need. I
think the most useful case where the union plan was beneficial was precisely
when you had something like WHERE index_col1=1 OR indexed_col2=2.

Going from an UNION plan to a OR plan would be somewhat strange. Programmers
don't usually write plans as UNION in place of the more natural OR unless they
have a reason to.

-- 
greg



pgsql-hackers by date:

Previous
From: "Jonah H. Harris"
Date:
Subject: Re: vacuum, performance, and MVCC
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Planning without reason.