Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U2nfi-0006pT-S3 for pgsql-bugs@arkaria.postgresql.org; Tue, 05 Feb 2013 18:55:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U2nfi-0007l7-9L for pgsql-bugs@arkaria.postgresql.org; Tue, 05 Feb 2013 18:55:10 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U2nS9-0004bH-HJ for pgsql-bugs@postgresql.org; Tue, 05 Feb 2013 18:41:09 +0000 Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U2nS8-0008MO-4N for pgsql-bugs@postgresql.org; Tue, 05 Feb 2013 18:41:08 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U2nS6-0000ys-Nv for pgsql-bugs@postgresql.org; Tue, 05 Feb 2013 18:41:07 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1U2nS6-0003ky-CY for pgsql-bugs@postgresql.org; Tue, 05 Feb 2013 18:41:06 +0000 Date: Tue, 05 Feb 2013 18:41:06 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7853: Incorrect statistics in table with many dead rows. To: pgsql-bugs@postgresql.org From: jimbob@seagate.com X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 7853 Logged by: James Skaggs Email address: jimbob@seagate.com PostgreSQL version: 8.4.14 Operating system: RHEL6 Description:=20=20=20=20=20=20=20=20 After "analyze verbose", the table shows 158 million rows. A select count(1) yields 13.8 million rows. INFO: analyzing "public.stream_file" INFO: "stream_file": scanned 30000 of 2123642 pages, containing 184517 live rows and 2115512 dead rows; 30000 rows in sample, 158702435 estimated total rows Here are the table statistics. Sequential Scans 81853=09 Sequential Tuples Read 578848425234=09 Index Scans 1976513672=09 Index Tuples Fetched 2183339860=09 Tuples Inserted 65122575=09 Tuples Updated 308883671=09 Tuples Deleted 51238760=09 Tuples HOT Updated 2242897=09 Live Tuples 163981972=09 Dead Tuples 7056493=09 Heap Blocks Read 43483331819=09 Heap Blocks Hit 43121456487=09 Index Blocks Read 134539277=09 Index Blocks Hit 13606451182=09 Toast Blocks Read=09=09 Toast Blocks Hit=09=09 Toast Index Blocks Read=09=09 Toast Index Blocks Hit=09=09 Last Vacuum 2013-02-04 10:06:44.058743-07=09 Last Autovacuum 2013-02-04 16:11:34.289823-07=09 Last Analyze 2013-02-04 14:22:27.848547-07=09 Last Autoanalyze 2013-02-01 17:37:29.855553-07=09 Table Size 17 GB=09 Toast Table Size none=09 Indexes Size 34 GB Query returned successfully with no result in 4094 ms. Bad statistics led to a bad plan. We will cluster the table today to see if that fixes it, but I think statistics should be correct, regardless of the state of a table. BTW, Coverity product requries 8.x, and we'll upgrade to 8.4.15 today. Didn't see anything about better statistics in the 8.4.15 changelog. --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs