From: Jaime Casanova <systemguards@gmail.com>
To: Jozsef Szalay <jszalay@storediq.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: FWD: Update touches unrelated indexes?
Date: Sun, 2 Jul 2006 09:36:20 -0500
Message-ID: <c2d9e70e0607020736x5068aafbn1e9abfad4bcd2b80@mail.gmail.com> (raw)
In-Reply-To: <E387E2E9622FDD408359F98BF183879E4D44C1@dc1.storediq.com>
References: <E387E2E9622FDD408359F98BF183879E4D44C1@dc1.storediq.com>
> >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
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: systemguards@gmail.com, jszalay@storediq.com, tgl@sss.pgh.pa.us
Subject: Re: FWD: Update touches unrelated indexes?
In-Reply-To: <c2d9e70e0607020736x5068aafbn1e9abfad4bcd2b80@mail.gmail.com>
* 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