Re: Exact index overhead

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Gunther Mayer <gunther(dot)mayer(at)googlemail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Exact index overhead
Date: 2008-04-17 10:02:47
Message-ID: 48072047.7030407@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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.

Updates do generally modify the indexes as well. The way MVCC has been
implemented in PostgreSQL, UPDATE is internally very much like
DELETE+INSERT. A new row version is inserted, new index pointers are
added for the new row version, and the old row version is marked as deleted.

In version 8.3, however, the new HOT feature reduces the need for that.
In a nutshell, if the new row version fits on the same page as the old
one, no new index pointers need to be created.

I would suggest just testing how much additional overhead the new index
incurs. It might be less expensive than you think.

You didn't mention how often the inserts happen, in other words, how
fast you expect the table to grow. If the table is expected to grow
orders of magnitude larger, you might want to partition the table by date.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Pavan Deolasee 2008-04-17 10:16:05 Re: Exact index overhead
Previous Message Richard Huxton 2008-04-17 10:00:14 Re: Exact index overhead