pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Clamp total-tuples estimates for foreign tables to ensure planne 7+ messages / 1 participants [nested] [flat]
* pgsql: Clamp total-tuples estimates for foreign tables to ensure planne @ 2020-07-03 23:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-07-03 23:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario where rel->tuples is zero because pg_class.reltuples is (suggesting that ANALYZE has never been run for the table). As things stood, we'd end up estimating one group out of any GROUP BY on such a table, whereas the default group-count estimate is more likely to result in a sane plan. Also, clarify in the documentation that GetForeignRelSize has the option to override the rel->tuples value if it has a better idea of what to use than what is in pg_class.reltuples. Per report from Jeff Janes. Back-patch to all supported branches. Patch by me; thanks to Etsuro Fujita for review Discussion: https://postgr.es/m/CAMkU=1xNo9cnan+Npxgz0eK7394xmjmKg-QEm8wYG9P5-CcaqQ@mail.gmail.com Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9233624b128b41fd410712a7223821878f1943b0 Modified Files -------------- doc/src/sgml/fdwhandler.sgml | 8 ++++++++ src/backend/optimizer/path/allpaths.c | 3 +++ 2 files changed, 11 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Clamp total-tuples estimates for foreign tables to ensure planne @ 2020-07-03 23:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-07-03 23:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario where rel->tuples is zero because pg_class.reltuples is (suggesting that ANALYZE has never been run for the table). As things stood, we'd end up estimating one group out of any GROUP BY on such a table, whereas the default group-count estimate is more likely to result in a sane plan. Also, clarify in the documentation that GetForeignRelSize has the option to override the rel->tuples value if it has a better idea of what to use than what is in pg_class.reltuples. Per report from Jeff Janes. Back-patch to all supported branches. Patch by me; thanks to Etsuro Fujita for review Discussion: https://postgr.es/m/CAMkU=1xNo9cnan+Npxgz0eK7394xmjmKg-QEm8wYG9P5-CcaqQ@mail.gmail.com Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5144a40f3fa717fa0454e846f95030f58d2a6024 Modified Files -------------- doc/src/sgml/fdwhandler.sgml | 8 ++++++++ src/backend/optimizer/path/allpaths.c | 3 +++ 2 files changed, 11 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Clamp total-tuples estimates for foreign tables to ensure planne @ 2020-07-03 23:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-07-03 23:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario where rel->tuples is zero because pg_class.reltuples is (suggesting that ANALYZE has never been run for the table). As things stood, we'd end up estimating one group out of any GROUP BY on such a table, whereas the default group-count estimate is more likely to result in a sane plan. Also, clarify in the documentation that GetForeignRelSize has the option to override the rel->tuples value if it has a better idea of what to use than what is in pg_class.reltuples. Per report from Jeff Janes. Back-patch to all supported branches. Patch by me; thanks to Etsuro Fujita for review Discussion: https://postgr.es/m/CAMkU=1xNo9cnan+Npxgz0eK7394xmjmKg-QEm8wYG9P5-CcaqQ@mail.gmail.com Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/153c14cdd714381b186d3e3a2272d29f4717be9e Modified Files -------------- doc/src/sgml/fdwhandler.sgml | 8 ++++++++ src/backend/optimizer/path/allpaths.c | 3 +++ 2 files changed, 11 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Clamp total-tuples estimates for foreign tables to ensure planne @ 2020-07-03 23:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-07-03 23:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario where rel->tuples is zero because pg_class.reltuples is (suggesting that ANALYZE has never been run for the table). As things stood, we'd end up estimating one group out of any GROUP BY on such a table, whereas the default group-count estimate is more likely to result in a sane plan. Also, clarify in the documentation that GetForeignRelSize has the option to override the rel->tuples value if it has a better idea of what to use than what is in pg_class.reltuples. Per report from Jeff Janes. Back-patch to all supported branches. Patch by me; thanks to Etsuro Fujita for review Discussion: https://postgr.es/m/CAMkU=1xNo9cnan+Npxgz0eK7394xmjmKg-QEm8wYG9P5-CcaqQ@mail.gmail.com Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ef799bdd04ee7f5d5c5fb2547633ef98c4949cfb Modified Files -------------- doc/src/sgml/fdwhandler.sgml | 8 ++++++++ src/backend/optimizer/path/allpaths.c | 3 +++ 2 files changed, 11 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Clamp total-tuples estimates for foreign tables to ensure planne @ 2020-07-03 23:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-07-03 23:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario where rel->tuples is zero because pg_class.reltuples is (suggesting that ANALYZE has never been run for the table). As things stood, we'd end up estimating one group out of any GROUP BY on such a table, whereas the default group-count estimate is more likely to result in a sane plan. Also, clarify in the documentation that GetForeignRelSize has the option to override the rel->tuples value if it has a better idea of what to use than what is in pg_class.reltuples. Per report from Jeff Janes. Back-patch to all supported branches. Patch by me; thanks to Etsuro Fujita for review Discussion: https://postgr.es/m/CAMkU=1xNo9cnan+Npxgz0eK7394xmjmKg-QEm8wYG9P5-CcaqQ@mail.gmail.com Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/69a3fe6e639ad57f65536ca7b1873b9a3f1814e6 Modified Files -------------- doc/src/sgml/fdwhandler.sgml | 8 ++++++++ src/backend/optimizer/path/allpaths.c | 3 +++ 2 files changed, 11 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Clamp total-tuples estimates for foreign tables to ensure planne @ 2020-07-03 23:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-07-03 23:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario where rel->tuples is zero because pg_class.reltuples is (suggesting that ANALYZE has never been run for the table). As things stood, we'd end up estimating one group out of any GROUP BY on such a table, whereas the default group-count estimate is more likely to result in a sane plan. Also, clarify in the documentation that GetForeignRelSize has the option to override the rel->tuples value if it has a better idea of what to use than what is in pg_class.reltuples. Per report from Jeff Janes. Back-patch to all supported branches. Patch by me; thanks to Etsuro Fujita for review Discussion: https://postgr.es/m/CAMkU=1xNo9cnan+Npxgz0eK7394xmjmKg-QEm8wYG9P5-CcaqQ@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/ca5e93f769e1bf5e90d080cfcc8c0368ef649a7c Modified Files -------------- doc/src/sgml/fdwhandler.sgml | 8 ++++++++ src/backend/optimizer/path/allpaths.c | 3 +++ 2 files changed, 11 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Clamp total-tuples estimates for foreign tables to ensure planne @ 2020-07-03 23:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-07-03 23:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario where rel->tuples is zero because pg_class.reltuples is (suggesting that ANALYZE has never been run for the table). As things stood, we'd end up estimating one group out of any GROUP BY on such a table, whereas the default group-count estimate is more likely to result in a sane plan. Also, clarify in the documentation that GetForeignRelSize has the option to override the rel->tuples value if it has a better idea of what to use than what is in pg_class.reltuples. Per report from Jeff Janes. Back-patch to all supported branches. Patch by me; thanks to Etsuro Fujita for review Discussion: https://postgr.es/m/CAMkU=1xNo9cnan+Npxgz0eK7394xmjmKg-QEm8wYG9P5-CcaqQ@mail.gmail.com Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d83d59e42d0ce2b2588b18d069aa13105d04447d Modified Files -------------- doc/src/sgml/fdwhandler.sgml | 8 ++++++++ src/backend/optimizer/path/allpaths.c | 3 +++ 2 files changed, 11 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2020-07-03 23:01 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-07-03 23:01 pgsql: Clamp total-tuples estimates for foreign tables to ensure planne Tom Lane <tgl@sss.pgh.pa.us> 2020-07-03 23:01 pgsql: Clamp total-tuples estimates for foreign tables to ensure planne Tom Lane <tgl@sss.pgh.pa.us> 2020-07-03 23:01 pgsql: Clamp total-tuples estimates for foreign tables to ensure planne Tom Lane <tgl@sss.pgh.pa.us> 2020-07-03 23:01 pgsql: Clamp total-tuples estimates for foreign tables to ensure planne Tom Lane <tgl@sss.pgh.pa.us> 2020-07-03 23:01 pgsql: Clamp total-tuples estimates for foreign tables to ensure planne Tom Lane <tgl@sss.pgh.pa.us> 2020-07-03 23:01 pgsql: Clamp total-tuples estimates for foreign tables to ensure planne Tom Lane <tgl@sss.pgh.pa.us> 2020-07-03 23:01 pgsql: Clamp total-tuples estimates for foreign tables to ensure planne 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