pgsql: Fix EquivalenceClass processing for nested append relations.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix EquivalenceClass processing for nested append relations.
Date: 2014-03-28 15:50:10
Message-ID: E1WTZ2o-0006kC-3n@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2014-03-28 16:50:52 pgsql: Adjust getpwuid() fix commit to display errno string on failure
Previous Message Bruce Momjian 2014-03-28 14:33:22 Re: pgsql: Un-break peer authentication.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-03-28 15:50:56 Re: UNION ALL on partitioned tables won't use indices.
Previous Message Alvaro Herrera 2014-03-28 15:32:37 Re: replicating DROP commands across servers