X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1131952C3B for ; Thu, 14 Jul 2005 20:57:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28199-09 for ; Thu, 14 Jul 2005 23:57:26 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1B46752BC7 for ; Thu, 14 Jul 2005 20:57:25 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6ENvRLR005894; Thu, 14 Jul 2005 19:57:27 -0400 (EDT) To: alison@mirrabooka.com (Alison Winters) Cc: pgsql-performance@postgresql.org Subject: Re: lots of updates on small table In-reply-to: <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> References: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> <20050714162114.GA19778@alvh.no-ip.org> <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> Comments: In-reply-to alison@mirrabooka.com (Alison Winters) message dated "Fri, 15 Jul 2005 09:42:12 +1000" Date: Thu, 14 Jul 2005 19:57:27 -0400 Message-ID: <5893.1121385447@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/197 X-Sequence-Number: 13438 alison@mirrabooka.com (Alison Winters) writes: >>> Our application requires a number of processes to select and update rows >>> from a very small (<10 rows) Postgres table on a regular and frequent >>> basis. These processes often run for weeks at a time, but over the >>> space of a few days we find that updates start getting painfully slow. No wonder, considering that your "less than 10 rows" table contains something upwards of 100000 tuples: > INFO: --Relation public.plc_fldio-- > INFO: Pages 1221: Changed 3, reaped 256, Empty 0, New 0; Tup 108137: Vac 4176, Keep/VTL 108133/108133, UnUsed 19, MinLen 84, MaxLen 84; Re-using: Free/Avail. Space 445176/371836; EndEmpty/Avail. Pages 0/256. > CPU 0.04s/0.14u sec elapsed 0.18 sec. What you need to do is find out why VACUUM is unable to reclaim all those dead row versions. The reason is likely that some process is sitting on a open transaction for days at a time. > Isn't it normal to have processes that keep a single database > connection open for days at a time? Database connection, sure. Single transaction, no. > Regarding the question another poster asked: all the transactions are > very short. Somewhere you have one that isn't. Try watching the backends with ps, or look at the pg_stat_activity view if your version of PG has it, to see which sessions are staying "idle in transaction" indefinitely. regards, tom lane