Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 15EC02E0069 for ; Thu, 17 Apr 2008 07:00:32 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 37052-05 for ; Thu, 17 Apr 2008 07:00:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from ptb-relay01.plus.net (ptb-relay01.plus.net [212.159.14.212]) by developer.postgresql.org (Postfix) with ESMTP id EEBDE2E0066 for ; Thu, 17 Apr 2008 07:00:21 -0300 (ADT) Received: from [84.51.143.99] (helo=server3.office.archonet.com) by ptb-relay01.plus.net with esmtp (Exim) id 1JmQud-0004z8-NE; Thu, 17 Apr 2008 11:00:15 +0100 Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 0214527405F; Thu, 17 Apr 2008 11:00:14 +0100 (BST) Message-ID: <48071FAE.1070408@archonet.com> Date: Thu, 17 Apr 2008 11:00:14 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.12 (X11/20080213) MIME-Version: 1.0 To: Gunther Mayer CC: pgsql-performance@postgresql.org Subject: Re: Exact index overhead References: <48071807.8000409@gmail.com> In-Reply-To: <48071807.8000409@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: 3417697a38175314ff8edba26f9a3070 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/231 X-Sequence-Number: 29724 Gunther Mayer wrote: > You see, all updates change most of the data fields but never ever touch > the time field. Assuming correct and efficient behaviour of postgresql > it should then also never touch the time index and incur zero overhead > in its presence, but is this really the case? If it somehow does update > the index too even though the value hasn't changed by some weird > implementation detail I'd rather not have that index and live with slow > queries for the few times a day that reporting is run. Well, until 8.3 PG does indeed update the index. That's because with MVCC an update is basically a delete+insert, so you'll end up with two versions (the V in MVCC) of the row. With 8.3 there's a new feature called HOT which means updates that don't change an index can be more efficient. So - if you are running 8.3, I'd say try the index and see what difference it makes. -- Richard Huxton Archonet Ltd