Skip site navigation (1) Skip section navigation (2)

Re: MVCC & indexes?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Ivan Voras <ivoras(at)fer(dot)hr>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: MVCC & indexes?
Date: 2006-10-31 22:36:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Ivan Voras wrote:
> Ok, so MVCC is the best thing since a guy put a round stone on a stick
> and called it "the wheel", but I've seen several references on this list
> about "indexes not being under MVCC" - at least that's how I read it,
> the original posts were explaining why indexes can't be used for solving
> MIN()/MAX()/COUNT() aggregates. Is this correct?
> In particular, I'm trying to find out is there (b)locking involved when
> concurrently updating and/or inserting records in an indexed table. My
> guess is that, since PG does copy+delete on updating, even updating a
> non-indexed field will require fixups in the index tree (to point to the
> new record) and thus (b)locking.

Well, there certainly is locking involved in inserting index entries,
but it's more fine-grained than you seem to think.  Only one page of the
index is locked at any time, resulting in that typically there's very
little blocking involved.  Two processes can be inserting into the same
index concurrently (btree and GiST indexes at least; GiST only gained
concurrency in a recent release, I don't remember if it was 8.0 or 8.1).

Alvaro Herrera                      
The PostgreSQL Company - Command Prompt, Inc.

In response to


pgsql-performance by date

Next:From: John MajorDate: 2006-10-31 23:18:38
Subject: Help w/speeding up range queries?
Previous:From: Ivan VorasDate: 2006-10-31 21:55:40
Subject: MVCC & indexes?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group