Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U2qZQ-0002aI-PC for pgsql-bugs@arkaria.postgresql.org; Tue, 05 Feb 2013 22:00:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U2qZQ-0002nm-5v for pgsql-bugs@arkaria.postgresql.org; Tue, 05 Feb 2013 22:00:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U2qZO-0002mR-WA for pgsql-bugs@postgresql.org; Tue, 05 Feb 2013 22:00:51 +0000 Received: from nm2.bullet.mail.bf1.yahoo.com ([98.139.212.161]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U2qZM-0006Xn-PO for pgsql-bugs@postgresql.org; Tue, 05 Feb 2013 22:00:50 +0000 Received: from [98.139.215.142] by nm2.bullet.mail.bf1.yahoo.com with NNFMP; 05 Feb 2013 22:00:47 -0000 Received: from [98.139.212.197] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 05 Feb 2013 22:00:47 -0000 Received: from [127.0.0.1] by omp1006.mail.bf1.yahoo.com with NNFMP; 05 Feb 2013 22:00:47 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 72709.11903.bm@omp1006.mail.bf1.yahoo.com Received: (qmail 25947 invoked by uid 60001); 5 Feb 2013 22:00:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s1024; t=1360101646; bh=qoH/vaiDZRXHnbLtdSWMCMz0d7DQv0Rb7TaklNlTzRI=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=JfeIxqKCRZHjRdtUVjqRlKpQubqE6LMlebcon/lw+/+69xXdALXeFpuYvCMqWaoZD9sQSlwUovE57h9m8AWTmgqwSjkF5Uz5odyBURcRSrUX/aNrF7sAgEDHP+5n/XsQdovUmiOww/lMIuqKGTOuljoUw4hfq5VOlRME6PmS0Bk= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=ymail.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=XoyD9AGDyjBuONschO+pwRWP526ne6BzPItMvC2jV6XqwoIcwSmK76LEZUk+67OV7fgy0Gs2i80RrluAPxItSH6354aguyOH5+1l7jNZrrTrHv5dNCrQ8i8rKwJIJOfoi81Crd4JoaaNNwCDSJdEwE3DxqM53kZ50k0BHoQ9cdY=; X-YMail-OSG: lOfpgdwVM1ke8qng5L2rA7P1eVTG6o193uccyjCruwjfJ37 Bpsf84spHYSZiWvJ7JX7bBpkGSSdXhWiV._3R336AfMIJyPxGnTcL.S4Dul. IyCxAko_m.jj6FbVpmiJOR1a506l.mIVzBZEWL36dyyFfoLXeZMRfKvr_3Sq L9b6K0U_wNIXFjvhyhgU.M_EZHFxY9YqIsgrl5rrPv5gaI_bGq6fU5ysh6Jj QEv_hXv6cOSoIjCDTa9t8a3pedWuYvkO6ny21LkQyCAMi2Pl2i2UqQ0hgEAh eAh1q2yKhYe9FUA3TeyMz5m8cOQxn9NlAzW6yKn1nvcaKVkosKpI1Sr9DLWd EUvdcrO3TakvTGjxr4nNz3E2PMUf7jAowZDNlX6hxSYJRkHeroyc9HcYLrtn ShTXp8du5g7lgALVEy4BFIzBCXJZMxsYXQl5dKyLB40ROLuxv3jNQJMRPyBh Fhs04DbhRnYFa8TkNeqP1Otz3jAju Received: from [76.255.19.161] by web162901.mail.bf1.yahoo.com via HTTP; Tue, 05 Feb 2013 14:00:46 PST X-Rocket-MIMEInfo: 001.001, ImppbWJvYkBzZWFnYXRlLmNvbSIgPGppbWJvYkBzZWFnYXRlLmNvbT4gd3JvdGU6Cgo.IElORk86wqAgYW5hbHl6aW5nICJwdWJsaWMuc3RyZWFtX2ZpbGUiCj4gSU5GTzrCoCAic3RyZWFtX2ZpbGUiOiBzY2FubmVkIDMwMDAwIG9mIDIxMjM2NDIgcGFnZXMsIGNvbnRhaW5pbmcKPiAxODQ1MTcgbGl2ZSByb3dzIGFuZCAyMTE1NTEyIGRlYWQgcm93czsgMzAwMDAgcm93cyBpbiBzYW1wbGUsCj4gMTU4NzAyNDM1IGVzdGltYXRlZCB0b3RhbCByb3dzCgoxODQ1MTcgbGl2ZSByb3dzIGluIDMwMDAwIHJhbmRvbWwBMAEBAQE- X-Mailer: YahooMailWebService/0.8.132.503 References: Message-ID: <1360101646.24672.YahooMailNeo@web162901.mail.bf1.yahoo.com> Date: Tue, 5 Feb 2013 14:00:46 -0800 (PST) From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: BUG #7853: Incorrect statistics in table with many dead rows. To: "jimbob@seagate.com" , "pgsql-bugs@postgresql.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -0.1 (/) 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 "jimbob@seagate.com" wrote: > INFO:=A0 analyzing "public.stream_file" > INFO:=A0 "stream_file": scanned 30000 of 2123642 pages, containing > 184517 live rows and 2115512 dead rows; 30000 rows in sample, > 158702435 estimated total rows 184517 live rows in 30000 randomly sampled pages out of 2123642 total pages, means that the statistics predict that a select count(*) will find about=A0 13 million live rows to count. > After "analyze verbose", the table shows 158 million rows. A > select count(1) yields 13.8 million rows. OK, the estimate was 13 million and there were actually 13.8 million, but it is a random sample used to generate estimates.=20 That seems worse than average, but close enough to be useful. The 158.7 million total rows includes dead rows, which must be visited to determine visibility, but will not be counted because they are not visible to the counting transaction.=A0 Having over 90% of your table filled with dead rows is a bad situation to be in, from a performance standpoint.=A0 You should use aggressive maintenance (like VACUUM FULL or CLUSTER) to fix the existing extreme bloat, and then review your autovacuum settings and overall vacuum regimen to prevent future bloat. This does not look like a bug from the information provided so far. -Kevin --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs