From: | "Shinoda, Noriyoshi (SXD Japan FSIP)" <noriyoshi(dot)shinoda(at)hpe(dot)com> |
---|---|
To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com> |
Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, "Magnus Hagander" <magnus(at)hagander(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "alvherre(at)alvh(dot)no-ip(dot)org" <alvherre(at)alvh(dot)no-ip(dot)org> |
Subject: | RE: Statistics Import and Export |
Date: | 2024-10-22 00:50:56 |
Message-ID: | DM4PR84MB17346B43F24501D8F07CD721EE4C2@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> 1. Allow relpages to be set to -1 (partitioned tables with partitions have this value after ANALYZE).
> 2. Turn off autovacuum on tables (where possible) if they are going to be the target of pg_set_relation_stats().
> 3. Allow pg_set_relation_stats to continue past an out-of-range detection on one attribute, rather than immediately returning false
Thank you for developing this feature.
If the relpages option contains -1 only for partitioned tables, shouldn't pg_set_relation_stats restrict the values that can be
specified by table type? The attached patch limits the value to -1 or more if the target
is a partition table, and 0 or more otherwise.
Changing relpages to -1 on a non-partitioned table seems to significantly change the execution plan.
---
postgres=> EXPLAIN (COSTS OFF) SELECT * FROM data1 WHERE c1=1000;
QUERY PLAN
--------------------------------------
Index Scan using data1_pkey on data1
Index Cond: (c1 = 1000)
(2 rows)
postgres=> SELECT pg_set_relation_stats('data1', relpages=>-1);
pg_set_relation_stats
-----------------------
t
(1 row)
postgres=> EXPLAIN (COSTS OFF) SELECT * FROM data1 WHERE c1=1000;
QUERY PLAN
---------------------------------------
Bitmap Heap Scan on data1
Recheck Cond: (c1 = 1000)
-> Bitmap Index Scan on data1_pkey
Index Cond: (c1 = 1000)
(4 rows)
---
Regards,
Noriyoshi Shinoda
From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Sent: Saturday, October 19, 2024 10:00 AM
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Shinoda, Noriyoshi (SXD Japan FSIP) <noriyoshi(dot)shinoda(at)hpe(dot)com>; jian he <jian(dot)universality(at)gmail(dot)com>; Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>; Bruce Momjian <bruce(at)momjian(dot)us>; Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>; Nathan Bossart <nathandbossart(at)gmail(dot)com>; Magnus Hagander <magnus(at)hagander(dot)net>; Stephen Frost <sfrost(at)snowman(dot)net>; Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>; Peter Smith <smithpb2250(at)gmail(dot)com>; PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>; alvherre(at)alvh(dot)no-ip(dot)org
Subject: Re: Statistics Import and Export
Patch that allows relation_statistics_update to continue after one failed stat (0001) attached, along with bool->void change (0002).
Once more, with feeling:
Attachment | Content-Type | Size |
---|---|---|
pg_set_relation_stats_patch_v1.diff | application/octet-stream | 1.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2024-10-22 01:02:58 | Re: Pgoutput not capturing the generated columns |
Previous Message | Michael Paquier | 2024-10-22 00:49:10 | More CppAsString2() in psql's describe.c |