Re: pg_* Tables

From: Samuel Stearns <SStearns(at)internode(dot)com(dot)au>
To: Greg Williamson <gwilliamson39(at)yahoo(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: pg_* Tables
Date: 2010-12-07 03:21:26
Message-ID: 68B59BEDCD36854AADBDF17E91B2937A07844CCBEF@EXCHMAIL.staff.internode.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Yep, small row counts. Thanks, Greg!

From: Greg Williamson [mailto:gwilliamson39(at)yahoo(dot)com]
Sent: Monday, 6 December 2010 5:34 PM
To: Samuel Stearns; pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] pg_* Tables

Samuel Stearns wrote:

>> Howdy,
>>
>> Environment:
>>
>> Solaris 10
>> Postgres 8.3.3
>>
>> I’m getting high sequential scans for some pg_* tables:
>>
>> <database>=# select relname, sum(seq_scan) as seq_scan,sum(seq_tup_read)
>> as seq_tup_read,sum(idx_scan) as idx_scan, sum(idx_tup_fetch) as idx_tup_fetch,
>> sum(n_tup_ins) as n_tup_ins, sum(n_tup_upd) as n_tup_upd, sum(n_tup_del) as n_tup_del
>> from pg_stat_all_tables group by 1 order by 2 desc limit 4;
>> relname | seq_scan | seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del
>> ---------------------------------+----------+--------------+----------+---------------+-----------+-----------+-----------
>> <table> | 6896498 | 91295702 | 107663 | 469057 | 103966 | 103966 | 103966
>> pg_authid | 3119053 | 125950392 | 12000732 | 12000718 | 1 | 1 | 0
>> pg_am | 2642438 | 2642440 | 5 | 5 | 0 | 0 | 0
>> pg_database | 1349020 | 14771768 | 6953392 | 6953392 | 0 | 0 | 0
<...>
>> Is this normal? Is it advisable to index pg_* tables?

Do you vacuum the database regularly ?

What are the number of rows in those tables ?

It is possible that the planner is doing a sequential scan because the tables are small and that's faster than doing indexed reads.

Greg Williamson

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message paulo matadr 2010-12-07 15:12:12 restore In parallel postgres 9
Previous Message Imre Oolberg 2010-12-06 22:49:11 Re: failing to compile v. 9.0.1 on debian squeeze with readline