pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedanalyze log question on parent/children tables
3+ messages / 2 participants
[nested] [flat]
* analyze log question on parent/children tables
@ 2012-11-08 14:07 Rural Hunter <ruralhunter@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Rural Hunter @ 2012-11-08 14:07 UTC (permalink / raw)
To: pgsql-admin
Hi,
I'm on 9.1.3. I set auto vacuum off for some tables. I noticed one
thing: when I run manual analyze on parent table, It seems the children
tables are also analyzed. Here is the analyze log:
INFO: analyzing "public.table_parent"
INFO: "table_parent": scanned 0 of 0 pages, containing 0 live rows and
0 dead rows; 0 rows in sample, 0 estimated total rows
INFO: analyzing "public.table_parent" inheritance tree
INFO: "table_child1": scanned 11405 of 692945 pages, containing 105632
live rows and 103 dead rows; 11405 rows in sample, 10739605 estimated
total rows
INFO: "table_child2": scanned 1858 of 112866 pages, containing 35818
live rows and 0 dead rows; 1858 rows in sample, 2178974 estimated total rows
....
But when I check the table status in pgAdmin, I noticed the (auto)
analyze time of children tables was not logged. So my question here is:
should I run a separate analyze on children tables?
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: analyze log question on parent/children tables
@ 2012-11-08 15:21 Albe Laurenz <laurenz.albe@wien.gv.at>
parent: Rural Hunter <ruralhunter@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Albe Laurenz @ 2012-11-08 15:21 UTC (permalink / raw)
To: Rural Hunter *EXTERN* <ruralhunter@gmail.com>; pgsql-admin
Rural Hunter wrote:
> I'm on 9.1.3. I set auto vacuum off for some tables. I noticed one
> thing: when I run manual analyze on parent table, It seems the
children
> tables are also analyzed. Here is the analyze log:
>
> INFO: analyzing "public.table_parent"
> INFO: "table_parent": scanned 0 of 0 pages, containing 0 live rows
and
> 0 dead rows; 0 rows in sample, 0 estimated total rows
> INFO: analyzing "public.table_parent" inheritance tree
> INFO: "table_child1": scanned 11405 of 692945 pages, containing
105632
> live rows and 103 dead rows; 11405 rows in sample, 10739605 estimated
> total rows
> INFO: "table_child2": scanned 1858 of 112866 pages, containing 35818
> live rows and 0 dead rows; 1858 rows in sample, 2178974 estimated
total rows
> ....
>
> But when I check the table status in pgAdmin, I noticed the (auto)
> analyze time of children tables was not logged. So my question here
is:
> should I run a separate analyze on children tables?
This ANALYZE will only collect statistics for the parent.
If you look in pg_stats, you might find two sets of entries
for the parent table, one with inherited=TRUE and one with
inherited=FALSE.
The hierarchy is scanned for the former values.
If you collect statistics manually, you should also run ANALYZE
on the child tables.
Of course, if you use autovacuum, the right things should happen
(except that autovacuum doesn't seem to update the inherited
statistics for the parent table).
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: analyze log question on parent/children tables
@ 2012-11-08 15:25 Rural Hunter <ruralhunter@gmail.com>
parent: Albe Laurenz <laurenz.albe@wien.gv.at>
0 siblings, 0 replies; 3+ messages in thread
From: Rural Hunter @ 2012-11-08 15:25 UTC (permalink / raw)
To: Albe Laurenz <laurenz.albe@wien.gv.at>; +Cc: pgsql-admin
Got it. Thanks.
于2012年11月8日 23:21:33,Albe Laurenz写到:
> Rural Hunter wrote:
>> I'm on 9.1.3. I set auto vacuum off for some tables. I noticed one
>> thing: when I run manual analyze on parent table, It seems the
> children
>> tables are also analyzed. Here is the analyze log:
>>
>> INFO: analyzing "public.table_parent"
>> INFO: "table_parent": scanned 0 of 0 pages, containing 0 live rows
> and
>> 0 dead rows; 0 rows in sample, 0 estimated total rows
>> INFO: analyzing "public.table_parent" inheritance tree
>> INFO: "table_child1": scanned 11405 of 692945 pages, containing
> 105632
>> live rows and 103 dead rows; 11405 rows in sample, 10739605 estimated
>> total rows
>> INFO: "table_child2": scanned 1858 of 112866 pages, containing 35818
>> live rows and 0 dead rows; 1858 rows in sample, 2178974 estimated
> total rows
>> ....
>>
>> But when I check the table status in pgAdmin, I noticed the (auto)
>> analyze time of children tables was not logged. So my question here
> is:
>> should I run a separate analyze on children tables?
>
> This ANALYZE will only collect statistics for the parent.
> If you look in pg_stats, you might find two sets of entries
> for the parent table, one with inherited=TRUE and one with
> inherited=FALSE.
> The hierarchy is scanned for the former values.
>
> If you collect statistics manually, you should also run ANALYZE
> on the child tables.
>
> Of course, if you use autovacuum, the right things should happen
> (except that autovacuum doesn't seem to update the inherited
> statistics for the parent table).
>
> Yours,
> Laurenz Albe
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2012-11-08 15:25 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-11-08 14:07 analyze log question on parent/children tables Rural Hunter <ruralhunter@gmail.com>
2012-11-08 15:21 ` Albe Laurenz <laurenz.albe@wien.gv.at>
2012-11-08 15:25 ` Rural Hunter <ruralhunter@gmail.com>
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