pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Ignore extended statistics for inheritance trees 6+ messages / 1 participants [nested] [flat]
* pgsql: Ignore extended statistics for inheritance trees @ 2022-01-15 02:10 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2022-01-15 02:10 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the whole inheritance tree. When the relations contain very distinct data, it may produce bogus estimates. This is roughly the same issue 427c6b5b9 addressed ~15 years ago, and we fix it the same way - by ignoring extended statistics when calculating estimates for the inheritance tree as a whole. We still consider extended statistics when calculating estimates for individual child relations, of course. This may result in plan changes due to different estimates, but if the old statistics were not describing the inheritance tree particularly well it's quite likely the new plans is actually better. Report and patch by Justin Pryzby, minor fixes and cleanup by me. Backpatch all the way back to PostgreSQL 10, where extended statistics were introduced (same as 859b3003de). Author: Justin Pryzby Reported-by: Justin Pryzby Backpatch-through: 10 Discussion: https://postgr.es/m/20210923212624.GI831%40telsasoft.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/36c4bc6e725fe3e9b5a6cc7f1f83010534f18e4b Modified Files -------------- src/backend/statistics/dependencies.c | 9 ++++++++ src/backend/statistics/extended_stats.c | 9 ++++++++ src/backend/utils/adt/selfuncs.c | 17 ++++++++++++++ src/test/regress/expected/stats_ext.out | 41 +++++++++++++++++++++++++++++++++ src/test/regress/sql/stats_ext.sql | 22 ++++++++++++++++++ 5 files changed, 98 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Ignore extended statistics for inheritance trees @ 2022-01-15 02:12 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2022-01-15 02:12 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the whole inheritance tree. When the relations contain very distinct data, it may produce bogus estimates. This is roughly the same issue 427c6b5b9 addressed ~15 years ago, and we fix it the same way - by ignoring extended statistics when calculating estimates for the inheritance tree as a whole. We still consider extended statistics when calculating estimates for individual child relations, of course. This may result in plan changes due to different estimates, but if the old statistics were not describing the inheritance tree particularly well it's quite likely the new plans is actually better. Report and patch by Justin Pryzby, minor fixes and cleanup by me. Backpatch all the way back to PostgreSQL 10, where extended statistics were introduced (same as 859b3003de). Author: Justin Pryzby Reported-by: Justin Pryzby Backpatch-through: 10 Discussion: https://postgr.es/m/20210923212624.GI831%40telsasoft.com Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2cc007fd0359870b4a1e959af0ac94e61df47240 Modified Files -------------- src/backend/statistics/dependencies.c | 9 ++++++++ src/backend/statistics/extended_stats.c | 9 ++++++++ src/backend/utils/adt/selfuncs.c | 17 ++++++++++++++ src/test/regress/expected/stats_ext.out | 41 +++++++++++++++++++++++++++++++++ src/test/regress/sql/stats_ext.sql | 22 ++++++++++++++++++ 5 files changed, 98 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Ignore extended statistics for inheritance trees @ 2022-01-15 02:13 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2022-01-15 02:13 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the whole inheritance tree. When the relations contain very distinct data, it may produce bogus estimates. This is roughly the same issue 427c6b5b9 addressed ~15 years ago, and we fix it the same way - by ignoring extended statistics when calculating estimates for the inheritance tree as a whole. We still consider extended statistics when calculating estimates for individual child relations, of course. This may result in plan changes due to different estimates, but if the old statistics were not describing the inheritance tree particularly well it's quite likely the new plans is actually better. Report and patch by Justin Pryzby, minor fixes and cleanup by me. Backpatch all the way back to PostgreSQL 10, where extended statistics were introduced (same as 859b3003de). Author: Justin Pryzby Reported-by: Justin Pryzby Backpatch-through: 10 Discussion: https://postgr.es/m/20210923212624.GI831%40telsasoft.com Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/acfde7c5837dd3c2a40ff9cc639ba5d914e8e8ea Modified Files -------------- src/backend/statistics/dependencies.c | 9 ++++++++ src/backend/statistics/extended_stats.c | 9 ++++++++ src/backend/utils/adt/selfuncs.c | 8 +++++++ src/test/regress/expected/stats_ext.out | 41 +++++++++++++++++++++++++++++++++ src/test/regress/sql/stats_ext.sql | 22 ++++++++++++++++++ 5 files changed, 89 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Ignore extended statistics for inheritance trees @ 2022-01-15 02:16 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2022-01-15 02:16 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the whole inheritance tree. When the relations contain very distinct data, it may produce bogus estimates. This is roughly the same issue 427c6b5b9 addressed ~15 years ago, and we fix it the same way - by ignoring extended statistics when calculating estimates for the inheritance tree as a whole. We still consider extended statistics when calculating estimates for individual child relations, of course. This may result in plan changes due to different estimates, but if the old statistics were not describing the inheritance tree particularly well it's quite likely the new plans is actually better. Report and patch by Justin Pryzby, minor fixes and cleanup by me. Backpatch all the way back to PostgreSQL 10, where extended statistics were introduced (same as 859b3003de). Author: Justin Pryzby Reported-by: Justin Pryzby Backpatch-through: 10 Discussion: https://postgr.es/m/20210923212624.GI831%40telsasoft.com Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/76569ad6f423f56f655699f57c39298af2111914 Modified Files -------------- src/backend/statistics/dependencies.c | 9 ++++++++ src/backend/statistics/extended_stats.c | 9 ++++++++ src/backend/utils/adt/selfuncs.c | 8 +++++++ src/test/regress/expected/stats_ext.out | 41 +++++++++++++++++++++++++++++++++ src/test/regress/sql/stats_ext.sql | 22 ++++++++++++++++++ 5 files changed, 89 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Ignore extended statistics for inheritance trees @ 2022-01-15 02:17 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2022-01-15 02:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the whole inheritance tree. When the relations contain very distinct data, it may produce bogus estimates. This is roughly the same issue 427c6b5b9 addressed ~15 years ago, and we fix it the same way - by ignoring extended statistics when calculating estimates for the inheritance tree as a whole. We still consider extended statistics when calculating estimates for individual child relations, of course. This may result in plan changes due to different estimates, but if the old statistics were not describing the inheritance tree particularly well it's quite likely the new plans is actually better. Report and patch by Justin Pryzby, minor fixes and cleanup by me. Backpatch all the way back to PostgreSQL 10, where extended statistics were introduced (same as 859b3003de). Author: Justin Pryzby Reported-by: Justin Pryzby Backpatch-through: 10 Discussion: https://postgr.es/m/20210923212624.GI831%40telsasoft.com Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b3cac25f4d50d66ef08a9a706df045c888578f8f Modified Files -------------- src/backend/statistics/dependencies.c | 9 +++++ src/backend/statistics/extended_stats.c | 1 + src/backend/utils/adt/selfuncs.c | 8 +++++ src/test/regress/expected/stats_ext.out | 61 +++++++++++++++++++++++++++++++++ src/test/regress/sql/stats_ext.sql | 43 +++++++++++++++++++++++ 5 files changed, 122 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Ignore extended statistics for inheritance trees @ 2022-01-15 02:20 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2022-01-15 02:20 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the whole inheritance tree. When the relations contain very distinct data, it may produce bogus estimates. This is roughly the same issue 427c6b5b9 addressed ~15 years ago, and we fix it the same way - by ignoring extended statistics when calculating estimates for the inheritance tree as a whole. We still consider extended statistics when calculating estimates for individual child relations, of course. This may result in plan changes due to different estimates, but if the old statistics were not describing the inheritance tree particularly well it's quite likely the new plans is actually better. Report and patch by Justin Pryzby, minor fixes and cleanup by me. Backpatch all the way back to PostgreSQL 10, where extended statistics were introduced (same as 859b3003de). Author: Justin Pryzby Reported-by: Justin Pryzby Backpatch-through: 10 Discussion: https://postgr.es/m/20210923212624.GI831%40telsasoft.com Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ff0e7c7e840122419054d72a7884fa17ce1a4ab9 Modified Files -------------- src/backend/statistics/dependencies.c | 9 +++++ src/backend/statistics/extended_stats.c | 1 + src/backend/utils/adt/selfuncs.c | 8 ++++ src/test/regress/expected/stats_ext.out | 65 +++++++++++++++++++++++++++++++++ src/test/regress/sql/stats_ext.sql | 47 ++++++++++++++++++++++++ 5 files changed, 130 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2022-01-15 02:20 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-01-15 02:10 pgsql: Ignore extended statistics for inheritance trees Tomas Vondra <tomas.vondra@postgresql.org> 2022-01-15 02:12 pgsql: Ignore extended statistics for inheritance trees Tomas Vondra <tomas.vondra@postgresql.org> 2022-01-15 02:13 pgsql: Ignore extended statistics for inheritance trees Tomas Vondra <tomas.vondra@postgresql.org> 2022-01-15 02:16 pgsql: Ignore extended statistics for inheritance trees Tomas Vondra <tomas.vondra@postgresql.org> 2022-01-15 02:17 pgsql: Ignore extended statistics for inheritance trees Tomas Vondra <tomas.vondra@postgresql.org> 2022-01-15 02:20 pgsql: Ignore extended statistics for inheritance trees Tomas Vondra <tomas.vondra@postgresql.org>
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