pgsql: Fix EquivalenceClass processing for nested append relations.

Started by Tom Lanealmost 12 years ago3 messages
#1Tom Lane
tgl@sss.pgh.pa.us

Fix EquivalenceClass processing for nested append relations.

The original coding of EquivalenceClasses didn't foresee that appendrel
child relations might themselves be appendrels; but this is possible for
example when a UNION ALL subquery scans a table with inheritance children.
The oversight led to failure to optimize ordering-related issues very well
for the grandchild tables. After some false starts involving explicitly
flattening the appendrel representation, we found that this could be fixed
easily by removing a few implicit assumptions about appendrel parent rels
not being children themselves.

Kyotaro Horiguchi and Tom Lane, reviewed by Noah Misch

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a87c729153e372f3731689a7be007bc2b53f1410

Modified Files
--------------
src/backend/optimizer/path/allpaths.c | 20 ++++++++++---
src/backend/optimizer/path/equivclass.c | 12 +++++---
src/backend/optimizer/plan/createplan.c | 2 +-
src/test/regress/expected/union.out | 47 +++++++++++++++++++++++++++++++
src/test/regress/sql/union.sql | 29 +++++++++++++++++++
5 files changed, 101 insertions(+), 9 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2David Fetter
david@fetter.org
In reply to: Tom Lane (#1)
Re: [COMMITTERS] pgsql: Fix EquivalenceClass processing for nested append relations.

On Fri, Mar 28, 2014 at 03:50:10PM +0000, Tom Lane wrote:

Fix EquivalenceClass processing for nested append relations.

If this is a bug fix, shouldn't it be back-patched?

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: David Fetter (#2)
Re: Re: [COMMITTERS] pgsql: Fix EquivalenceClass processing for nested append relations.

David Fetter <david@fetter.org> writes:

On Fri, Mar 28, 2014 at 03:50:10PM +0000, Tom Lane wrote:

Fix EquivalenceClass processing for nested append relations.

If this is a bug fix, shouldn't it be back-patched?

It's a planner improvement; it's not a bug fix in the sense that previous
plans were wrong. We tend to err on the side of not back-patching such
changes ... some people complain when minor updates cause plan choices to
change under them.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers