On Sun, Sep 22, 2024 at 9:09 PM David Rowley <dgrowle...@gmail.com> wrote: > > v7-0002 is all my changes. > > I'd like to push this soon, so if anyone has any last-minute feedback, > please let me know in the next few days. >
drop table if exists only_inh_parent,only_inh_child; CREATE TABLE only_inh_parent (a int , b INT) with (autovacuum_enabled = false); CREATE TABLE only_inh_child () INHERITS (only_inh_parent) with (autovacuum_enabled = false); INSERT INTO only_inh_child(a,b) select g % 80, (g + 1) % 200 from generate_series(1,1000) g; select pg_table_size('only_inh_parent'); ANALYZE ONLY only_inh_parent; select stadistinct,starelid::regclass,staattnum, stainherit from pg_statistic where starelid = ANY ('{only_inh_parent, only_inh_child}'::regclass[]); stadistinct | starelid | staattnum | stainherit -------------+-----------------+-----------+------------ 80 | only_inh_parent | 1 | t -0.2 | only_inh_parent | 2 | t --------------- catalog-pg-statistic.html stainherit bool If true, the stats include values from child tables, not just the values in the specified relation Normally there is one entry, with stainherit = false, for each table column that has been analyzed. If the table has inheritance children or partitions, a second entry with stainherit = true is also created. This row represents the column's statistics over the inheritance tree, i.e., statistics for the data you'd see with SELECT column FROM table*, whereas the stainherit = false row represents the results of SELECT column FROM ONLY table. I do understand what Michael Harris said in [1] --------------- Given the above context, I am still confused with this sentence in sql-analyze.html. "If ONLY is specified before the table name, only that table is analyzed." like in the above sql example, only_inh_parent's child is also being analyzed. [1] https://www.postgresql.org/message-id/CADofcAW43AD%3Dqqtj1cLkTyRpPM6JB5ZALUK7CA1KZZqpcouoYw%40mail.gmail.com