pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Generate EquivalenceClass members for partitionwise child join r
2+ messages / 1 participants
[nested] [flat]

* pgsql: Generate EquivalenceClass members for partitionwise child join r
@ 2019-11-05 16:42 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2019-11-05 16:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Generate EquivalenceClass members for partitionwise child join rels.

Commit d25ea0127 got rid of what I thought were entirely unnecessary
derived child expressions in EquivalenceClasses for EC members that
mention multiple baserels.  But it turns out that some of the child
expressions that code created are necessary for partitionwise joins,
else we fail to find matching pathkeys for Sort nodes.  (This happens
only for certain shapes of the resulting plan; it may be that
partitionwise aggregation is also necessary to show the failure,
though I'm not sure of that.)

Reverting that commit entirely would be quite painful performance-wise
for large partition sets.  So instead, add code that explicitly
generates child expressions that match only partitionwise child join
rels we have actually generated.

Per report from Justin Pryzby.  (Amit Langote noticed the problem
earlier, though it's not clear if he recognized then that it could
result in a planner error, not merely failure to exploit partitionwise
join, in the code as-committed.)  Back-patch to v12 where commit
d25ea0127 came in.

Amit Langote, with lots of kibitzing from me

Discussion: https://postgr.es/m/CA+HiwqG2WVUGmLJqtR0tPFhniO=H=9qQ+Z3L_ZC+Y3-EVQHFGg@mail.gmail.com
Discussion: https://postgr.es/m/20191011143703.GN10470@telsasoft.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/529ebb20aaa5eb68e4fb7a656271bbb83efe9529

Modified Files
--------------
src/backend/optimizer/path/equivclass.c      | 161 ++++++++++++++++++++++++---
src/backend/optimizer/util/relnode.c         |  15 ++-
src/include/optimizer/paths.h                |   5 +
src/test/regress/expected/partition_join.out |  77 +++++++++++++
src/test/regress/sql/partition_join.sql      |  15 +++
5 files changed, 259 insertions(+), 14 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Generate EquivalenceClass members for partitionwise child join r
@ 2019-11-05 16:42 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2019-11-05 16:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Generate EquivalenceClass members for partitionwise child join rels.

Commit d25ea0127 got rid of what I thought were entirely unnecessary
derived child expressions in EquivalenceClasses for EC members that
mention multiple baserels.  But it turns out that some of the child
expressions that code created are necessary for partitionwise joins,
else we fail to find matching pathkeys for Sort nodes.  (This happens
only for certain shapes of the resulting plan; it may be that
partitionwise aggregation is also necessary to show the failure,
though I'm not sure of that.)

Reverting that commit entirely would be quite painful performance-wise
for large partition sets.  So instead, add code that explicitly
generates child expressions that match only partitionwise child join
rels we have actually generated.

Per report from Justin Pryzby.  (Amit Langote noticed the problem
earlier, though it's not clear if he recognized then that it could
result in a planner error, not merely failure to exploit partitionwise
join, in the code as-committed.)  Back-patch to v12 where commit
d25ea0127 came in.

Amit Langote, with lots of kibitzing from me

Discussion: https://postgr.es/m/CA+HiwqG2WVUGmLJqtR0tPFhniO=H=9qQ+Z3L_ZC+Y3-EVQHFGg@mail.gmail.com
Discussion: https://postgr.es/m/20191011143703.GN10470@telsasoft.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a9db37a180e536dc157aebf5bab4286a0494defc

Modified Files
--------------
src/backend/optimizer/path/equivclass.c      | 154 ++++++++++++++++++++++++---
src/backend/optimizer/util/relnode.c         |  15 ++-
src/include/optimizer/paths.h                |   5 +
src/test/regress/expected/partition_join.out |  77 ++++++++++++++
src/test/regress/sql/partition_join.sql      |  15 +++
5 files changed, 253 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-11-05 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 16:42 pgsql: Generate EquivalenceClass members for partitionwise child join r Tom Lane <tgl@sss.pgh.pa.us>
2019-11-05 16:42 pgsql: Generate EquivalenceClass members for partitionwise child join r Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox