X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 3E9BC11F605A for ; Fri, 28 Apr 2006 23:22:12 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 43190-08 for ; Fri, 28 Apr 2006 23:22:04 -0300 (ADT) X-Greylist: delayed 00:34:43.331369 by SQLgrey- Received: from imsm058dat.netvigator.com (imsm058.netvigator.com [218.102.48.211]) by postgresql.org (Postfix) with ESMTP id 36A1211F6002 for ; Fri, 28 Apr 2006 23:22:00 -0300 (ADT) Received: from n2.netvigator.com ([218.103.190.155]) by imsm058dat.netvigator.com (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060429014714.MMTR18293.imsm058dat.netvigator.com@n2.netvigator.com> for ; Sat, 29 Apr 2006 09:47:14 +0800 Received: from n2.netvigator.com ([127.0.0.1]) by [127.0.0.1] with ESMTP (SpamPal v1.594) sender ; 29 Apr 2006 09:47:10 +???? Message-Id: <6.2.1.2.0.20060429084119.05290438@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.1.2 Date: Sat, 29 Apr 2006 09:46:06 +0800 To: pgsql-performance@postgresql.org From: K C Lau Subject: Re: Why so slow? In-Reply-To: <20060428190005.GA15689@wolff.to> References: <20060428145842.GI97354@pervasive.com> <20060428190005.GA15689@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/684 X-Sequence-Number: 18768 At 03:00 06/04/29, Bruno Wolff III wrote: >On Fri, Apr 28, 2006 at 17:37:30 +0000, > Bealach-na Bo wrote: > > >The above shows that the indexes contained 10M rows and 160M of dead > > >space each. That means you weren't vacuuming nearly enough. > > > > How is it that a row in the table can grow to a size far exceeding the sum > > of the maximum sized of the fields it consists of? > >Because unless you run vacuum, the old deleted rows are not reused. Those >rows cannot be deleted immediately, because the rows may be visible to >other transactions. Periodic vacuums are used to find deleted rows which >are no longer visible to any transactions. > >You probably want to read the following: >http://developer.postgresql.org/docs/postgres/routine-vacuuming.html Would recycling dead tuples on the fly (mentioned in p.14 in the article http://www.postgresql.org/files/developer/transactions.pdf ) significantly reduce the need for periodic vacuums? Without knowing the internals, I have this simplistic idea: if Postgres maintains the current lowest transaction ID for all active transactions, it probably could recycle dead tuples on the fly. The current lowest transaction ID could be maintained in a doubly linked list with maximum entries. A backward link in the tuple header might be needed too. Any comments? Cheers, KC.