From: | Christoph Berg <christoph(dot)berg(at)credativ(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #17123: ALTER TABLE ... NO INHERIT leaves orphaned statistics behind |
Date: | 2021-07-26 15:16:33 |
Message-ID: | YP7R0fFWZB1VCmCT@msg.credativ.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Re: Tom Lane
> Good catch. I imagine DETACH PARTITION has related issues?
It has, but for partitioned tables I think the case is different.
Partitioned tables have inherited=true stats only, and in practice, as
the partition parent table is always empty, stale statistics on a
partitioned table without any partitions aren't hurting. Maybe one
could even argue that keeping the stats around in that case makes
sense since they might help with the next partition re-added, like
TRUNCATE doesn't reset stats, or like ANALYZE on an empty table
doesn't wipe the existing stats.
create table log (ts timestamptz) partition by range (ts);
create table log2 partition of log for values from ('2021-07-01') to ('2021-08-01');
insert into log values ('2021-07-01');
analyze log;
select * from pg_stats where tablename = 'log' and attname = 'ts' \gx
alter table log detach partition log2;
analyze log;
select * from pg_stats where tablename = 'log' and attname = 'ts' \gx
Christoph
--
Senior Berater, Tel.: +49 2166 9901 187
credativ GmbH, HRB Mönchengladbach 12080, USt-ID-Nummer: DE204566209
Trompeterallee 108, 41189 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Sascha Heuer, Geoff Richardson,
Peter Lilley; Unser Umgang mit personenbezogenen Daten unterliegt
folgenden Bestimmungen: https://www.credativ.de/datenschutz
From | Date | Subject | |
---|---|---|---|
Next Message | Lætitia Avrot | 2021-07-26 15:53:34 | Re: Statistics updates is delayed when using `commit and chain` |
Previous Message | Tom Lane | 2021-07-26 14:29:24 | Re: BUG #17123: ALTER TABLE ... NO INHERIT leaves orphaned statistics behind |