pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pallav Kalva <pkalva@deg.cc>
To: John A Meinel <john@arbash-meinel.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Wrong Stats and Poor Performance
Date: Mon, 27 Dec 2004 14:51:21 -0500
Message-ID: <41D067B9.5080308@deg.cc> (raw)
In-Reply-To: <41D06223.9060500@arbash-meinel.com>
References: <41D059EB.9090201@deg.cc>
	<41D06223.9060500@arbash-meinel.com>

John A Meinel wrote:

> Pallav Kalva wrote:
>
>> Hi Everybody.
>>
>>      I have a table in my production database which gets updated 
>> regularly and the stats on this table in pg_class  are totally 
>> wrong.  I used to run vacuumdb on the whole database daily once and 
>> when i posted the same problem of wrong stats in the pg_class most of 
>> them from this list and also from postgres docs suggested me to run 
>> the "vacuum analyze" more frequently on this table.
>>
>> I had a setup a cronjob couple of weeks ago to run vacuum analyze 
>> every 3 hours on this table and still my stats are totally wrong. 
>> This is affecting the performance of the queries running on this 
>> table very badly.
>> How can i fix this problem ?  or is this the standard postgres 
>> behaviour ?
>>
>> Here are the stats from the problem table on my production database
>>
>> relpages |  reltuples
>> ----------+-------------
>>   168730 | 2.19598e+06
>>
>> If i rebuild the same table on dev db and check the stats they are 
>> totally different, I was hoping that there would be some difference 
>> in the stats from the production db stats but not at this extent, as 
>> you can see below there is a huge difference in the stats.
>>
>> relpages | reltuples
>> ----------+-----------
>>    25230 |    341155
>>
>>
>> Thanks!
>> Pallav
>>
>
> What version of the database? As I recall, there are versions which 
> suffer from index bloat if there is a large amount of turnover on the 
> table. I believe VACUUM FULL ANALYZE helps with this. As does 
> increasing the max_fsm_pages (after a vacuum full verbose the last 
> couple of lines can give you an indication of how big max_fsm_pages 
> might need to be.)
>
> Vacuum full does some locking, which means you don't want to do it all 
> the time, but if you can do it on the weekend, or maybe evenings or 
> something it might fix the problem.
>
> I don't know if you can recover without a vacuum full, but there might 
> also be something about rebuild index, or maybe dropping and 
> re-creating the index.
> John
> =:->

Hi John,

    Thanks! for the reply,  My postgres version is  7.4.2.  since this 
is on a production database and one of critical table in our system I 
cant run the vacuum full analyze on this table because of the locks. I 
recently rebuilt this table from the scratch and recreated all the 
indexes and after 2-3 weeks the same problem again. My max_fsm_pages are 
set to the default value due think it might be the problem ? i would 
like to change it but that involves restarting the postgres database 
which i cant do at this moment . What is index bloat ?  do you think 
rebuilding the indexes again might help some extent ?

Pallav




view thread (5+ messages)  latest in thread

Message-ID: <41D067B9.5080308@deg.cc>
Permalink:  ../41D067B9.5080308@deg.cc/
Also on:    postgresql.org/message-id/41D067B9.5080308@deg.cc

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: pkalva@deg.cc, john@arbash-meinel.com
  Subject: Re: Wrong Stats and Poor Performance
  In-Reply-To: <41D067B9.5080308@deg.cc>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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