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 6CA769FA5FC for ; Fri, 30 Jun 2006 03:44:07 -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 57497-06 for ; Fri, 30 Jun 2006 03:43:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 9C2B19FA0EC for ; Fri, 30 Jun 2006 03:43:57 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5U6hsaN020926; Fri, 30 Jun 2006 02:43:54 -0400 (EDT) To: Josh Berkus cc: pgsql-performance@postgresql.org Subject: Re: FWD: Update touches unrelated indexes? In-reply-to: <44A4C5B0.2090303@agliodbs.com> References: <44A4C5B0.2090303@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Thu, 29 Jun 2006 23:33:20 -0700" Date: Fri, 30 Jun 2006 02:43:54 -0400 Message-ID: <20925.1151649834@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/493 X-Sequence-Number: 19850 Josh Berkus forwards: > I hope someone can explain what I'm seeing on our system. I've got a > table with about four million rows in it (see schema below). Almost > every column has one or two indexes. What I've found is that when I > issue an update statement to zero out the content of a particular > column, the pg_locks table indicates that every other, seemingly > unrelated index is locked/changed. This surprises you why? > I expect the idx_test_table_col_27 index to have write locks during this > operation but seeing RowExclusiveLock entries on every other index > puzzles me. Interestingly enough these locks are not present if the > table is smaller. That last I don't believe at all --- PG updates every index on every row update. Most likely the OP is just not querying pg_locks fast enough to see the locks. If he's really concerned about update performance then he probably needs to think harder about whether every one of those indexes is really carrying its weight. regards, tom lane