Re: (Re)-indexing on updates

From: "Jeffrey W(dot) Baker" <jwbaker(at)acm(dot)org>
To: Yves Vindevogel <yves(dot)vindevogel(at)implements(dot)be>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: (Re)-indexing on updates
Date: 2005-08-21 19:06:05
Message-ID: 1124651165.5990.1.camel@noodles
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sun, 2005-08-21 at 20:32 +0200, Yves Vindevogel wrote:
>
>
> ______________________________________________________________________
>
> Hi,
>
> Say I have a table with column A, B, C, D
> A has a unique index on it (primary key)
> B and C have a normal index on it
> D has no index
>
> If I perform a query like update tbl set D = 'whatever' ;
> that should make no difference on the indexes on the other columns,
> right ?

What postgresql does on update is to make a new record, so there will be
two records in your table and two records in your index. You would need
to vacuum the table to mark the space for the old record free, and you
would need to reindex the table to shrink the index.

>
> Or is there some kind of mechanism that does create a sort of new
> record, thus makes the indexes go wild.

Yes.

-jwb

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Yves Vindevogel 2005-08-21 19:36:03 Fwd: (Re)-indexing on updates
Previous Message Yves Vindevogel 2005-08-21 18:32:31 (Re)-indexing on updates