Re: FWD: Update touches unrelated indexes?

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Jozsef Szalay" <jszalay(at)storediq(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: FWD: Update touches unrelated indexes?
Date: 2006-07-02 14:36:20
Message-ID: c2d9e70e0607020736x5068aafbn1e9abfad4bcd2b80@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> >This surprises you why?
>
> I don't know anything about how PG stores keys along with their
> references to the actual rows but my assumption was that that reference
> is some sort of an index into a table that maps the reference to an
> actual disk/file address. So even if the row or the page with the row on
> it is physically moved to a different location in the disk file, the
> unrelated indexes would not have to be changed because only the
> disk/file address changes but the reference does not. If PG does not
> work in a similar fashion then I understand the locks.
>

When you update a table postgres makes a copy of the row being updated
so it has to create new index entries pointing to the new version of
the row... but it keeps old index entries pointing to the prior
version of the row because if there are concurrent queries to those
tables that looks for that particular row and you haven't committed
yet we still want the old version (old index entry)...

--
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Gene 2006-07-02 21:50:37 optimizing LIKE '%2345' queries
Previous Message Mark Kirkwood 2006-07-02 06:25:56 Re: [pgadmin-support] 100% CPU