X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D99FFDACA4 for ; Thu, 27 Oct 2005 16:41:06 -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 04151-08 for ; Thu, 27 Oct 2005 19:41:03 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5012CDAACC for ; Thu, 27 Oct 2005 16:41:04 -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 j9RJf3Ex023323; Thu, 27 Oct 2005 15:41:03 -0400 (EDT) To: Denis Cc: pgsql-performance@postgresql.org Subject: Re: Update using primary key slow In-reply-to: References: <19722.1130429883@sss.pgh.pa.us> Comments: In-reply-to Denis message dated "Thu, 27 Oct 2005 18:09:57 -0000" Date: Thu, 27 Oct 2005 15:41:03 -0400 Message-ID: <23322.1130442063@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200510/428 X-Sequence-Number: 15196 Denis writes: > tgl@sss.pgh.pa.us (Tom Lane) wrote in > news:19722.1130429883@sss.pgh.pa.us: >> The 183 msec is the time needed to *fetch* the row, not the time to >> update it. So it could well be that the other time is just the time >> needed to update the table and indexes. If this seems slower than >> your hardware ought to be able to handle, I'd wonder about how >> recently the table has been vacuumed. > Here is the latest vacuum today. > INFO: "contract": removed 64146 row versions in 26115 pages > DETAIL: CPU 1.94s/2.55u sec elapsed 7.78 sec. > INFO: "contract": found 64146 removable, 5106307 nonremovable row > versions in 129154 pages > DETAIL: 890 dead row versions cannot be removed yet. > There were 1905028 unused item pointers. The "unused item pointers" number seems a bit high, but otherwise that looks pretty reasonable. Is it possible that the particular row you were updating has been updated quite a lot of times since the last vacuum? Or even quite a few times within a single transaction? The only thing I can think of that would explain such a slow fetch is if the code has to reject a bunch of recently-dead versions of the row. regards, tom lane