From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert.Farrugia@go.com.mt
Cc: pgsql-admin@postgresql.org
Subject: Re: After VACUUM, statistics become skewed
Date: Wed, 21 May 2003 12:51:06 -0400
Message-ID: <7858.1053535866@sss.pgh.pa.us> (raw)
In-Reply-To: <20030521150018.0CBB1924EC2@developer.postgresql.org>
References: <20030521150018.0CBB1924EC2@developer.postgresql.org>
Robert.Farrugia@go.com.mt writes:
> Given a table around 4GB in size containing millions of records, before
> vacuuming the following query used the correct index
> (mo_200302_called_idx) which is built on answertime and callednumber_type.
Could we see EXPLAIN ANALYZE results for both the good plan and the bad
plan, for the same query? You're not giving us comparable results.
It would also be useful to show the pg_stats entries for the table.
I suspect that the planner is being fooled by some odd statistics of
your data, but we have not got any info here with which to speculate.
> Usually by dropping the table and reloading it from
> disk may solve the problem (it may take more than one try), but this is
> becoming unpractical due to the amount of data to restore each time.
You can get back to the un-analyzed state by deleting the rows in
pg_statistic for this table, viz
delete from pg_statistic where starelid = (select oid from
pg_class where relname = 'mobileorig_200302');
Grotty, but it sure beats dropping and reloading a big table.
regards, tom lane
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-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, Robert.Farrugia@go.com.mt
Subject: Re: After VACUUM, statistics become skewed
In-Reply-To: <7858.1053535866@sss.pgh.pa.us>
* 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