pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix ndistinct estimates with system attributes
5+ messages / 1 participants
[nested] [flat]

* pgsql: Fix ndistinct estimates with system attributes
@ 2021-03-26 21:59 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Tomas Vondra @ 2021-03-26 21:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ndistinct estimates with system attributes

When estimating the number of groups using extended statistics, the code
was discarding information about system attributes. This led to strange
situation that

    SELECT 1 FROM t GROUP BY ctid;

could have produced higher estimate (equal to pg_class.reltuples) than

    SELECT 1 FROM t GROUP BY a, b, ctid;

with extended statistics on (a,b). Fixed by retaining information about
the system attribute.

Backpatch all the way to 10, where extended statistics were introduced.

Author: Tomas Vondra
Backpatch-through: 10

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/33e52ad9a32929a6d14dfd98a8440d57028f2e3e

Modified Files
--------------
src/backend/utils/adt/selfuncs.c        | 6 +++---
src/test/regress/expected/stats_ext.out | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)



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

* pgsql: Fix ndistinct estimates with system attributes
@ 2021-03-26 21:59 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Tomas Vondra @ 2021-03-26 21:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ndistinct estimates with system attributes

When estimating the number of groups using extended statistics, the code
was discarding information about system attributes. This led to strange
situation that

    SELECT 1 FROM t GROUP BY ctid;

could have produced higher estimate (equal to pg_class.reltuples) than

    SELECT 1 FROM t GROUP BY a, b, ctid;

with extended statistics on (a,b). Fixed by retaining information about
the system attribute.

Backpatch all the way to 10, where extended statistics were introduced.

Author: Tomas Vondra
Backpatch-through: 10

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/67251c82af87865989eb90c7e8f4546cc0d66e6d

Modified Files
--------------
src/backend/utils/adt/selfuncs.c        | 6 +++---
src/test/regress/expected/stats_ext.out | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)



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

* pgsql: Fix ndistinct estimates with system attributes
@ 2021-03-26 21:59 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Tomas Vondra @ 2021-03-26 21:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ndistinct estimates with system attributes

When estimating the number of groups using extended statistics, the code
was discarding information about system attributes. This led to strange
situation that

    SELECT 1 FROM t GROUP BY ctid;

could have produced higher estimate (equal to pg_class.reltuples) than

    SELECT 1 FROM t GROUP BY a, b, ctid;

with extended statistics on (a,b). Fixed by retaining information about
the system attribute.

Backpatch all the way to 10, where extended statistics were introduced.

Author: Tomas Vondra
Backpatch-through: 10

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/88acb0135720076599308e6fd58b659c81d1beba

Modified Files
--------------
src/backend/utils/adt/selfuncs.c        | 6 +++---
src/test/regress/expected/stats_ext.out | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)



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

* pgsql: Fix ndistinct estimates with system attributes
@ 2021-03-26 22:00 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Tomas Vondra @ 2021-03-26 22:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ndistinct estimates with system attributes

When estimating the number of groups using extended statistics, the code
was discarding information about system attributes. This led to strange
situation that

    SELECT 1 FROM t GROUP BY ctid;

could have produced higher estimate (equal to pg_class.reltuples) than

    SELECT 1 FROM t GROUP BY a, b, ctid;

with extended statistics on (a,b). Fixed by retaining information about
the system attribute.

Backpatch all the way to 10, where extended statistics were introduced.

Author: Tomas Vondra
Backpatch-through: 10

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2a307df1bba7178b3903e01bee5012707f950473

Modified Files
--------------
src/backend/utils/adt/selfuncs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)



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

* pgsql: Fix ndistinct estimates with system attributes
@ 2021-03-26 22:00 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Tomas Vondra @ 2021-03-26 22:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ndistinct estimates with system attributes

When estimating the number of groups using extended statistics, the code
was discarding information about system attributes. This led to strange
situation that

    SELECT 1 FROM t GROUP BY ctid;

could have produced higher estimate (equal to pg_class.reltuples) than

    SELECT 1 FROM t GROUP BY a, b, ctid;

with extended statistics on (a,b). Fixed by retaining information about
the system attribute.

Backpatch all the way to 10, where extended statistics were introduced.

Author: Tomas Vondra
Backpatch-through: 10

Branch
------
REL_10_STABLE

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

Modified Files
--------------
src/backend/utils/adt/selfuncs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)



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


end of thread, other threads:[~2021-03-26 22:00 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 21:59 pgsql: Fix ndistinct estimates with system attributes Tomas Vondra <tomas.vondra@postgresql.org>
2021-03-26 21:59 pgsql: Fix ndistinct estimates with system attributes Tomas Vondra <tomas.vondra@postgresql.org>
2021-03-26 21:59 pgsql: Fix ndistinct estimates with system attributes Tomas Vondra <tomas.vondra@postgresql.org>
2021-03-26 22:00 pgsql: Fix ndistinct estimates with system attributes Tomas Vondra <tomas.vondra@postgresql.org>
2021-03-26 22:00 pgsql: Fix ndistinct estimates with system attributes 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