X-Original-To: pgsql-admin@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 1193F923348 for ; Wed, 21 May 2003 18:26:48 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 03975-02 for ; Wed, 21 May 2003 18:26:02 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by developer.postgresql.org (Postfix) with ESMTP id 1ACA1924FB5 for ; Wed, 21 May 2003 12:51:20 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h4LGp7U6007859; Wed, 21 May 2003 12:51:08 -0400 (EDT) To: Robert.Farrugia@go.com.mt Cc: pgsql-admin@postgresql.org Subject: Re: After VACUUM, statistics become skewed In-reply-to: <20030521150018.0CBB1924EC2@developer.postgresql.org> References: <20030521150018.0CBB1924EC2@developer.postgresql.org> Comments: In-reply-to Robert.Farrugia@go.com.mt message dated "Wed, 21 May 2003 17:00:21 +0200" Date: Wed, 21 May 2003 12:51:06 -0400 Message-ID: <7858.1053535866@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/277 X-Sequence-Number: 8839 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