Adding to above. Below are the outputs.
select count(*) from pg_stat_sys_tables where n_tup_ins =0 ;
count
-------
326
(1 row)
select count(*) from pg_stat_sys_tables where n_tup_upd =0 ;
count
-------
358
(1 row)
select count(*) from pg_stat_sys_tables where n_tup_del =0 ;
count
-------
344
(1 row)
select count(*) from pg_stat_sys_tables where n_tup_hot_upd =0 ;
count
-------
358
(1 row)
select count(*) from pg_stat_sys_tables where n_live_tup =0 ;
count
-------
326
(1 row)
select count(*) from pg_stat_sys_tables where n_dead_tup =0 ;
count
-------
346
(1 row)
Sent from Outlook From: pgsql-general-owner@xxxxxxxxxxxxxx <pgsql-general-owner@xxxxxxxxxxxxxx> on behalf of dhaval jaiswal <dhavallj@xxxxxxxxxxx>
Sent: Monday, November 21, 2016 11:04 PM To: Kevin Grittner; Alvaro Herrera Cc: Adrian Klaver; David G. Johnston; pgsql-general@xxxxxxxxxxxxxx Subject: Re: pg_class (system) table increasing size. I did check and found it was the bloated size of pg_class which was slowing down
the performance. It got fixed by adding in routine maintenance task. Things are fine now.
However, I want to know how come pg_class (system table) get bloated/affected. What could be the possible ways, where i can look into.
Due to business impact auto vacuum is off.
Sent from Outlook From: Kevin Grittner <kgrittn@xxxxxxxxx>
Sent: Friday, November 18, 2016 3:49 AM To: Alvaro Herrera Cc: dhaval jaiswal; Adrian Klaver; David G. Johnston; pgsql-general@xxxxxxxxxxxxxx Subject: Re: pg_class (system) table increasing size. On Thu, Nov 17, 2016 at 3:16 PM, Alvaro Herrera
<alvherre@xxxxxxxxxxxxxxx> wrote: > Looks like you lost the stat data awhile ago (probably due to a server > crash, or pg_stats_reset()) and it never got updated. I suggest doing > "ANALZYE pg_class" to create initial stats; that might prompt autovacuum > to vacuum the table. If the bloat is excessive, vacuuming might take a > very long time, in which case perhaps consider VACUUM FULL (but be very > aware of its consequences first). > > I think it's likely that this has happened to other catalogs as well, so > check the pg_stat_sys_tables view for other entries with all zeroes in > the n_tup_* columns. +1 Also, you may want to review your autovacuum settings to make sure they are aggressive enough. You didn't describe you machine, your workload, or your vacuum regimen, but if it's a large machine you would probably need to raise autovacuum_vacuum_cost limit. And if autovacuum somehow got turned *off* you are likely to have all kinds of problems with bloat, and may need to schedule some down time to get it cleaned up. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company |