From: Tom Lane <tgl@sss.pgh.pa.us>
To: christoph.berg@credativ.de
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17123: ALTER TABLE ... NO INHERIT leaves orphaned statistics behind
Date: Mon, 26 Jul 2021 10:29:24 -0400
Message-ID: <86586.1627309764@sss.pgh.pa.us> (raw)
In-Reply-To: <17123-734abc3934f500b6@postgresql.org>
References: <17123-734abc3934f500b6@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> Removing the last/only inheritance child from a table using ALTER TABLE NO
> INHERIT leaves orphaned statistics behind that ANALYZE doesn't remove.
> Original customer complaint on 10.16, but 15devel has the same issue.
Good catch. I imagine DETACH PARTITION has related issues?
It seems like there are basically two ways to fix this:
1. Make ALTER TABLE NO INHERIT/DETACH PARTITION get rid of
no-longer-wanted stats.
2. Make ANALYZE check for and remove any inappropriate stats.
I'm kind of inclined to prefer #1, on the grounds that #2 would
add almost-always-useless cycles to every ANALYZE run forevermore.
On the other hand, #2 seems a bit more robust, in that we'd not
have to remember to consider this issue every time somebody invents
a new flavor of DDL that affects these things.
Thoughts?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, christoph.berg@credativ.de, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17123: ALTER TABLE ... NO INHERIT leaves orphaned statistics behind
In-Reply-To: <86586.1627309764@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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