pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix hashjoin costing mistake introduced with inner_unique optimi
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix hashjoin costing mistake introduced with inner_unique optimi
@ 2018-07-14 15:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2018-07-14 15:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix hashjoin costing mistake introduced with inner_unique optimization.

In final_cost_hashjoin(), commit 9c7f5229a allowed inner_unique cases
to follow a code path previously used only for SEMI/ANTI joins; but it
neglected to fix an if-test within that path that assumed SEMI and ANTI
were the only possible cases.  This resulted in a wrong value for
hashjointuples, and an ensuing bad cost estimate, for inner_unique normal
joins.  Fortunately, for inner_unique normal joins we can assume the number
of joined tuples is the same as for a SEMI join; so there's no need for
more code, we just have to invert the test to check for ANTI not SEMI.

It turns out that in two contrib tests in which commit 9c7f5229a
changed the plan expected for a query, the change was actually wrong
and induced by this estimation error, not by any real improvement.
Hence this patch also reverts those changes.

Per report from RK Korlapati.  Backpatch to v10 where the error was
introduced.

David Rowley

Discussion: https://postgr.es/m/CA+SNy03bhq0fodsfOkeWDCreNjJVjsdHwUsb7AG=jpe0PtZc_g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1007b0a126c608b530fd2914825f1e6d133cb649

Modified Files
--------------
contrib/citext/expected/citext.out             |  2 +-
contrib/citext/expected/citext_1.out           |  2 +-
contrib/postgres_fdw/expected/postgres_fdw.out | 19 +++++++++++--------
src/backend/optimizer/path/costsize.c          |  6 +++---
4 files changed, 16 insertions(+), 13 deletions(-)



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

* pgsql: Fix hashjoin costing mistake introduced with inner_unique optimi
@ 2018-07-14 15:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2018-07-14 15:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix hashjoin costing mistake introduced with inner_unique optimization.

In final_cost_hashjoin(), commit 9c7f5229a allowed inner_unique cases
to follow a code path previously used only for SEMI/ANTI joins; but it
neglected to fix an if-test within that path that assumed SEMI and ANTI
were the only possible cases.  This resulted in a wrong value for
hashjointuples, and an ensuing bad cost estimate, for inner_unique normal
joins.  Fortunately, for inner_unique normal joins we can assume the number
of joined tuples is the same as for a SEMI join; so there's no need for
more code, we just have to invert the test to check for ANTI not SEMI.

It turns out that in two contrib tests in which commit 9c7f5229a
changed the plan expected for a query, the change was actually wrong
and induced by this estimation error, not by any real improvement.
Hence this patch also reverts those changes.

Per report from RK Korlapati.  Backpatch to v10 where the error was
introduced.

David Rowley

Discussion: https://postgr.es/m/CA+SNy03bhq0fodsfOkeWDCreNjJVjsdHwUsb7AG=jpe0PtZc_g@mail.gmail.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/704e393190725f54ddaaaee2cda1a6f3a26bff6d

Modified Files
--------------
contrib/citext/expected/citext.out             |  2 +-
contrib/citext/expected/citext_1.out           |  2 +-
contrib/postgres_fdw/expected/postgres_fdw.out | 19 +++++++++++--------
src/backend/optimizer/path/costsize.c          |  6 +++---
4 files changed, 16 insertions(+), 13 deletions(-)



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

* pgsql: Fix hashjoin costing mistake introduced with inner_unique optimi
@ 2018-07-14 15:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2018-07-14 15:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix hashjoin costing mistake introduced with inner_unique optimization.

In final_cost_hashjoin(), commit 9c7f5229a allowed inner_unique cases
to follow a code path previously used only for SEMI/ANTI joins; but it
neglected to fix an if-test within that path that assumed SEMI and ANTI
were the only possible cases.  This resulted in a wrong value for
hashjointuples, and an ensuing bad cost estimate, for inner_unique normal
joins.  Fortunately, for inner_unique normal joins we can assume the number
of joined tuples is the same as for a SEMI join; so there's no need for
more code, we just have to invert the test to check for ANTI not SEMI.

It turns out that in two contrib tests in which commit 9c7f5229a
changed the plan expected for a query, the change was actually wrong
and induced by this estimation error, not by any real improvement.
Hence this patch also reverts those changes.

Per report from RK Korlapati.  Backpatch to v10 where the error was
introduced.

David Rowley

Discussion: https://postgr.es/m/CA+SNy03bhq0fodsfOkeWDCreNjJVjsdHwUsb7AG=jpe0PtZc_g@mail.gmail.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0bb28ca36eaf14ba73695bc0a29e3f36de34e07b

Modified Files
--------------
contrib/citext/expected/citext.out             |  2 +-
contrib/citext/expected/citext_1.out           |  2 +-
contrib/postgres_fdw/expected/postgres_fdw.out | 19 +++++++++++--------
src/backend/optimizer/path/costsize.c          |  6 +++---
4 files changed, 16 insertions(+), 13 deletions(-)



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


end of thread, other threads:[~2018-07-14 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-14 15:59 pgsql: Fix hashjoin costing mistake introduced with inner_unique optimi Tom Lane <tgl@sss.pgh.pa.us>
2018-07-14 15:59 pgsql: Fix hashjoin costing mistake introduced with inner_unique optimi Tom Lane <tgl@sss.pgh.pa.us>
2018-07-14 15:59 pgsql: Fix hashjoin costing mistake introduced with inner_unique optimi 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