Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 7B1571337BCD for ; Fri, 4 Mar 2011 10:21:15 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 82676-05-2 for ; Fri, 4 Mar 2011 14:21:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iy0-f174.google.com (mail-iy0-f174.google.com [209.85.210.174]) by mail.postgresql.org (Postfix) with ESMTP id 59F491337C4F for ; Fri, 4 Mar 2011 10:20:46 -0400 (AST) Received: by iyb26 with SMTP id 26so1924095iyb.19 for ; Fri, 04 Mar 2011 06:20:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=eqAqFBx1DzTT2X5SCgtDmL7ViDr679Je54gVZJu8ZSM=; b=MPJZykqDBQuv4OTMbpZBxXs7//aDP76R7lii/9ICn4ro7r5+Va8e9V8xmL1TySK5hX 1KYnUsFiTGPsE6+FXqhPyY0pzunb3xl78eM5v5humK5vU0U02gzRj2VPRnOknIUW9VFG SPEYX83iLlRjJY5SSJTWsX32/wi6NNJbQ0XZA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=TpxC6sozf4HzDKVOeKAMQ5VLMF/GNBcA+bRTPC1BXHQf/y3qUAHTMinH5dNJ3+TsU3 U6SuNNTjVF7c/0wg3d5wMLXadJKhgn20GLlt8djTUMaDBWCpBdEQVXIclHuF0zObCvi5 GsPRo0EFw4BX9efV1Hh63QVh4re8mMN8PNuzI= MIME-Version: 1.0 Received: by 10.43.62.4 with SMTP id wy4mr799103icb.62.1299248446251; Fri, 04 Mar 2011 06:20:46 -0800 (PST) Received: by 10.43.68.208 with HTTP; Fri, 4 Mar 2011 06:20:46 -0800 (PST) In-Reply-To: <4D70AF32.7020706@icritical.com> References: <4D6FA208.1040800@icritical.com> <4D70AF32.7020706@icritical.com> Date: Fri, 4 Mar 2011 09:20:46 -0500 Message-ID: Subject: Re: Slowing UPDATEs inside a transaction From: Robert Haas To: Matt Burke Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201103/44 X-Sequence-Number: 42723 On Fri, Mar 4, 2011 at 4:21 AM, Matt Burke wrote: > Robert Haas wrote: >> Old row versions have to be kept around until they're no longer of >> interest to any still-running transaction. > > Thanks for the explanation. > > Regarding the snippet above, why would the intermediate history of > multiply-modified uncommitted rows be of interest to anything, or is the > current behaviour simply "cheaper" overall in terms of cpu/developer time? Because in theory you could have a cursor open. You could open a cursor, start to read from it, then make an update. Now the cursor needs to see things as they were before the update. We might be able to do some optimization here if we had some infrastructure to detect when a backend has no registered snapshots with a command-ID less than the command-ID of the currently active snapshot, but nobody's put in the effort to figure out exactly what's involved and whether it makes sense. It's a problem I'm interested in, but #(needed round-tuits) > #(actual round-tuits). -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company