pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Don't build extended statistics on inheritance trees 4+ messages / 1 participants [nested] [flat]
* pgsql: Don't build extended statistics on inheritance trees @ 2019-07-30 18:06 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Tomas Vondra @ 2019-07-30 18:06 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't build extended statistics on inheritance trees When performing ANALYZE on inheritance trees, we collect two samples for each relation - one for the relation alone, and one for the inheritance subtree (relation and its child relations). And then we build statistics on each sample, so for each relation we get two sets of statistics. For regular (per-column) statistics this works fine, because the catalog includes a flag differentiating statistics built from those two samples. But we don't have such flag in the extended statistics catalogs, and we ended up updating the same row twice, triggering this error: ERROR: tuple already updated by self The simplest solution is to disable extended statistics on inheritance trees, which is what this commit is doing. In the future we may need to do something similar to per-column statistics, but that requires adding a flag to the catalog - and that's not backpatchable. Moreover, the current selectivity estimation code only works with individual relations, so building statistics on inheritance trees would be pointless anyway. Author: Tomas Vondra Backpatch-to: 10- Discussion: https://postgr.es/m/20190618231233.GA27470@telsasoft.com Reported-by: Justin Pryzby Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/859b3003de87645b62ee07ef245d6c1f1cd0cedb Modified Files -------------- src/backend/commands/analyze.c | 12 +++++++++--- src/test/regress/expected/stats_ext.out | 8 ++++++++ src/test/regress/sql/stats_ext.sql | 8 ++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Don't build extended statistics on inheritance trees @ 2019-07-30 18:07 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Tomas Vondra @ 2019-07-30 18:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't build extended statistics on inheritance trees When performing ANALYZE on inheritance trees, we collect two samples for each relation - one for the relation alone, and one for the inheritance subtree (relation and its child relations). And then we build statistics on each sample, so for each relation we get two sets of statistics. For regular (per-column) statistics this works fine, because the catalog includes a flag differentiating statistics built from those two samples. But we don't have such flag in the extended statistics catalogs, and we ended up updating the same row twice, triggering this error: ERROR: tuple already updated by self The simplest solution is to disable extended statistics on inheritance trees, which is what this commit is doing. In the future we may need to do something similar to per-column statistics, but that requires adding a flag to the catalog - and that's not backpatchable. Moreover, the current selectivity estimation code only works with individual relations, so building statistics on inheritance trees would be pointless anyway. Author: Tomas Vondra Backpatch-to: 10- Discussion: https://postgr.es/m/20190618231233.GA27470@telsasoft.com Reported-by: Justin Pryzby Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4dbf70b2ff1ee487923394fd9e4fb28bb78839f2 Modified Files -------------- src/backend/commands/analyze.c | 12 +++++++++--- src/test/regress/expected/stats_ext.out | 8 ++++++++ src/test/regress/sql/stats_ext.sql | 8 ++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Don't build extended statistics on inheritance trees @ 2019-07-30 18:07 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Tomas Vondra @ 2019-07-30 18:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't build extended statistics on inheritance trees When performing ANALYZE on inheritance trees, we collect two samples for each relation - one for the relation alone, and one for the inheritance subtree (relation and its child relations). And then we build statistics on each sample, so for each relation we get two sets of statistics. For regular (per-column) statistics this works fine, because the catalog includes a flag differentiating statistics built from those two samples. But we don't have such flag in the extended statistics catalogs, and we ended up updating the same row twice, triggering this error: ERROR: tuple already updated by self The simplest solution is to disable extended statistics on inheritance trees, which is what this commit is doing. In the future we may need to do something similar to per-column statistics, but that requires adding a flag to the catalog - and that's not backpatchable. Moreover, the current selectivity estimation code only works with individual relations, so building statistics on inheritance trees would be pointless anyway. Author: Tomas Vondra Backpatch-to: 10- Discussion: https://postgr.es/m/20190618231233.GA27470@telsasoft.com Reported-by: Justin Pryzby Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e1947f6c3ed8bda397295f555fa9e3fe39d50143 Modified Files -------------- src/backend/commands/analyze.c | 12 +++++++++--- src/test/regress/expected/stats_ext.out | 8 ++++++++ src/test/regress/sql/stats_ext.sql | 8 ++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Don't build extended statistics on inheritance trees @ 2019-07-30 18:07 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Tomas Vondra @ 2019-07-30 18:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't build extended statistics on inheritance trees When performing ANALYZE on inheritance trees, we collect two samples for each relation - one for the relation alone, and one for the inheritance subtree (relation and its child relations). And then we build statistics on each sample, so for each relation we get two sets of statistics. For regular (per-column) statistics this works fine, because the catalog includes a flag differentiating statistics built from those two samples. But we don't have such flag in the extended statistics catalogs, and we ended up updating the same row twice, triggering this error: ERROR: tuple already updated by self The simplest solution is to disable extended statistics on inheritance trees, which is what this commit is doing. In the future we may need to do something similar to per-column statistics, but that requires adding a flag to the catalog - and that's not backpatchable. Moreover, the current selectivity estimation code only works with individual relations, so building statistics on inheritance trees would be pointless anyway. Author: Tomas Vondra Backpatch-to: 10- Discussion: https://postgr.es/m/20190618231233.GA27470@telsasoft.com Reported-by: Justin Pryzby Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/14ef15a22246ca17c949e7a9d1abe14c8874d743 Modified Files -------------- src/backend/commands/analyze.c | 12 +++++++++--- src/test/regress/expected/stats_ext.out | 8 ++++++++ src/test/regress/sql/stats_ext.sql | 8 ++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2019-07-30 18:07 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-07-30 18:06 pgsql: Don't build extended statistics on inheritance trees Tomas Vondra <tomas.vondra@postgresql.org> 2019-07-30 18:07 pgsql: Don't build extended statistics on inheritance trees Tomas Vondra <tomas.vondra@postgresql.org> 2019-07-30 18:07 pgsql: Don't build extended statistics on inheritance trees Tomas Vondra <tomas.vondra@postgresql.org> 2019-07-30 18:07 pgsql: Don't build extended statistics on 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