Re: document the need to analyze partitioned tables
Bruce Momjian <bruce@momjian.us>
From: Bruce Momjian <bruce@momjian.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>, Tomas Vondra <tomas.vondra@enterprisedb.com>, Justin Pryzby <pryzby@telsasoft.com>, Robert Haas <robertmhaas@gmail.com>, Álvaro Herrera <alvherre@alvh.no-ip.org>, yuzuko <yuzukohosoya@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-01-17T20:53:24Z
Lists: pgsql-hackers
On Thu, Jan 12, 2023 at 03:27:47PM -0800, Nathan Bossart wrote: > On Wed, Oct 05, 2022 at 10:37:01AM +0200, Laurenz Albe wrote: > > On Mon, 2022-03-28 at 15:05 +0200, Tomas Vondra wrote: > >> I've pushed the last version, and backpatched it to 10 (not sure I'd > >> call it a bugfix, but I certainly agree with Justin it's worth > >> mentioning in the docs, even on older branches). > > > > I'd like to suggest an improvement to this. The current wording could > > be read to mean that dead tuples won't get cleaned up in partitioned tables. > > Well, dead tuples won't get cleaned up in partitioned tables, as > partitioned tables do not have storage. But I see what you mean. Readers > might misinterpret this to mean that autovacuum will not process the > partitions. There's a good definition of what the docs mean by > "partitioned table" [0], but FWIW it took me some time before I > consistently read "partitioned table" to mean "only the thing with relkind > set to 'p'" and not "both the partitioned table and its partitions." So, > while the current wording it technically correct, I think it'd be > reasonable to expand it to help avoid confusion. > > Here is my take on the wording: > > Since all the data for a partitioned table is stored in its partitions, > autovacuum does not process partitioned tables. Instead, autovacuum > processes the individual partitions that are regular tables. This > means that autovacuum only gathers statistics for the regular tables > that serve as partitions and not for the partitioned tables. Since > queries may rely on a partitioned table's statistics, you should > collect statistics via the ANALYZE command when it is first populated, > and again whenever the distribution of data in its partitions changes > significantly. Uh, what about autovacuum's handling of partitioned tables? This makes it sound like it ignores them because it talks about manual ANALYZE. -- Bruce Momjian <bruce@momjian.us> https://momjian.us EDB https://enterprisedb.com Embrace your flaws. They make you human, rather than perfect, which you will never be.
Commits
-
doc: Fix typo in ANALYZE documentation
- c5479178441e 14.3 landed
- c3a587994a01 12.11 landed
- a5d4a3850fa8 11.16 landed
- 8421a99ca189 13.7 landed
- 4e31c46e1e7b 15.0 landed
- 3b6d2b460b5a 10.21 landed
-
Document autoanalyze limitations for partitioned tables
- c1e9cfaef975 10.21 landed
- 0fc2455edbda 11.16 landed
- b36c27191324 12.11 landed
- 78ebfd885be5 13.7 landed
- 6b262f353ef7 14.3 landed
- 61fa6ca79b3c 15.0 landed
-
Revert analyze support for partitioned tables
- 6f8127b73901 15.0 cited
-
Describe (auto-)analyze behavior for partitioned tables
- 1b5617eb844c 14.0 cited