X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 14EDC9FA605 for ; Sun, 2 Jul 2006 11:36:31 -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 74798-04 for ; Sun, 2 Jul 2006 11:36:22 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.179]) by postgresql.org (Postfix) with ESMTP id 663029FA50D for ; Sun, 2 Jul 2006 11:36:22 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id 39so687158pyu for ; Sun, 02 Jul 2006 07:36:20 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=JXKXYkDqYU3KBEPcgnqoa6bVRhqPHPoYyq3+me9knLkhoMEB+yP6Sk/3fxuHWAPaebPTP0AEGAw9VomyNgdDA3eGhghAhcrso2Cxs0BQk7czrJaXyQAaXN5pAHM8zuxzOvpFulygTzPhD6ZFE1jJGXyCnMbzldBEgBujtk+4uRw= Received: by 10.35.70.17 with SMTP id x17mr2062846pyk; Sun, 02 Jul 2006 07:36:20 -0700 (PDT) Received: by 10.35.48.20 with HTTP; Sun, 2 Jul 2006 07:36:20 -0700 (PDT) Message-ID: Date: Sun, 2 Jul 2006 09:36:20 -0500 From: "Jaime Casanova" To: "Jozsef Szalay" Subject: Re: FWD: Update touches unrelated indexes? Cc: "Tom Lane" , pgsql-performance@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/2 X-Sequence-Number: 19862 > >This surprises you why? > > I don't know anything about how PG stores keys along with their > references to the actual rows but my assumption was that that reference > is some sort of an index into a table that maps the reference to an > actual disk/file address. So even if the row or the page with the row on > it is physically moved to a different location in the disk file, the > unrelated indexes would not have to be changed because only the > disk/file address changes but the reference does not. If PG does not > work in a similar fashion then I understand the locks. > When you update a table postgres makes a copy of the row being updated so it has to create new index entries pointing to the new version of the row... but it keeps old index entries pointing to the prior version of the row because if there are concurrent queries to those tables that looks for that particular row and you haven't committed yet we still want the old version (old index entry)... -- regards, Jaime Casanova "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the universe trying to produce bigger and better idiots. So far, the universe is winning." Richard Cook