Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AB91D2E1275 for ; Tue, 13 Nov 2007 20:28:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 79301-08 for ; Tue, 13 Nov 2007 20:28:27 -0400 (AST) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.191]) by postgresql.org (Postfix) with ESMTP id A6FDB2E072B for ; Tue, 13 Nov 2007 20:28:26 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id f5so2859nfh for ; Tue, 13 Nov 2007 16:28:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=wMYUBy756P+Mr18M/tx1WH+IcOjIchINCCMA+aH9KEI=; b=fpAkPKsH3BgndDJ761DDQDJLXiazYq1uuQT+fmyy9FduTU+FOkeaSWZJcy20v3ebOAVDwGLolFgMlP8l4f4LRVw0fNeiNbMub0ebFO1C7eu/47nUb1TIGOOO/IuH1BKDAcf7Yub3NXNMh4izsee55QebMWTc3zdz8eA4kUwWeTg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VuXygTeJfiLNzYfKgG4vI49G8AlKZjRc533Hcc5BcIdTyQ/EwmK+EJcD/M6enwV/WabbFyE3bcl4pwpIOwIuOyRpnTmHJQ4WEk8PV7sSJjiwcxJl5GTFuBuRasf6CRRfa/i13gjO3AvBMhQBBBm+5RPs3fsofKvSZ+rljvEMIWc= Received: by 10.78.100.1 with SMTP id x1mr6189741hub.1195000104518; Tue, 13 Nov 2007 16:28:24 -0800 (PST) Received: by 10.78.18.2 with HTTP; Tue, 13 Nov 2007 16:28:24 -0800 (PST) Message-ID: Date: Tue, 13 Nov 2007 19:28:24 -0500 From: "Merlin Moncure" To: "Jean-David Beyer" Subject: Re: Curious about dead rows. Cc: "pgsql performance" In-Reply-To: <4735FA9F.1080805@verizon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4735DBDB.5050208@verizon.net> <16627.1194714491@sss.pgh.pa.us> <4735FA9F.1080805@verizon.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/206 X-Sequence-Number: 27621 On Nov 10, 2007 1:38 PM, Jean-David Beyer wrote: > Tom Lane wrote: > > Jean-David Beyer writes: > >> I am doing lots of INSERTs on a table that starts out empty (I did a > >> TRUNCATE on it). I am not, AFAIK, doing DELETEs or UPDATEs. Autovacuum is > >> on. I moved logging up to debug2 level to see what was going on, and I get > >> things like this: > > > >> "vl_as": scanned 3000 of 5296 pages, containing 232944 live rows and 1033 > >> dead rows; 3000 rows in sample, 411224 estimated total rows > > > >> A little later, it says: > > > >> "vl_as": scanned 3000 of 6916 pages, containing 233507 live rows and 493 > >> dead rows; 3000 rows in sample, 538311 estimated total rows > > > > Well, *something* is doing deletes or updates in that table. Better > > look a bit harder at your application ... > > > OK, you agree that if I am doing only INSERTs, that there should not be any > dead rows. Therefore, I _must_ be doing deletes or updates. > > But the program is pretty simple, and I see no UPDATEs or DELETEs. I > searched all the program source files (that contain none of them) and all > the libraries I have written, and they have none either. Right now the > programs are not to the state where UPDATEs or DELETEs are required (though > they will be later). I am still developing them and it is easier to just > restore from backup or start over from the beginning since most of the > changes are data laundering from an ever-increasing number of spreadsheets. > > Am I right that TRUNCATE deletes all the rows of a table. They may then be > still there, but would not autovacuum clean out the dead rows? Or maybe it > has not gotten to them yet? I could do an explicit one earlier. what does pg_stat_all_tables say (assuming row level stats are on)? merlin