pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dmigowski@ikoffice.de
To: pgsql-bugs@postgresql.org
Subject: BUG #6325: Useless Index updates
Date: Sun, 04 Dec 2011 12:54:25 +0000
Message-ID: <E1RXBaL-0000K2-U2@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      6325
Logged by:          Daniel Migowski
Email address:      dmigowski@ikoffice.de
PostgreSQL version: 8.3.16
Operating system:   Linux
Description:        

It seems that an update to a row in a table always removes the element from
an index and adds it again. Wouldn't it be faster to check for equality of
the index parameters in the OLD and NEW record first? 

I have this problem with an functional index using a relative expensive
index function, and noticed that the index function is always called even if
the parameter to the index function has not changed. Wouldn't it be better
to validate that the input to the index functions has not changed, instead
of calling the index function over and over again? Especially since the
index functions seems to be called with the new and the old value anyway.

I can understand that this might be a precaution in the case that the index
function isn't stable (is it even possible to use such a function for an
index?), but in the stable case comparing the input parameters allows for
much much faster table updates.





view thread (9+ messages)  latest in thread

Message-ID: <E1RXBaL-0000K2-U2@wrigleys.postgresql.org>
Permalink:  ../E1RXBaL-0000K2-U2@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1RXBaL-0000K2-U2@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: dmigowski@ikoffice.de
  Subject: Re: BUG #6325: Useless Index updates
  In-Reply-To: <E1RXBaL-0000K2-U2@wrigleys.postgresql.org>
  References: <E1RXBaL-0000K2-U2@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox