Re: SSI heap_insert and page-level predicate locks

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Dan Ports <drkp(at)csail(dot)mit(dot)edu>, Kevin Grittner <kevin(dot)grittner(at)wicourts(dot)gov>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SSI heap_insert and page-level predicate locks
Date: 2011-06-08 15:33:50
Message-ID: 1307545712-sup-1504@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Heikki Linnakangas's message of mié jun 08 05:45:35 -0400 2011:
> On 08.06.2011 12:36, Dan Ports wrote:

> > The only thing I'd be worried about is that at some future point we
> > might add heap page locks -- say, for sequential scans that don't read
> > the entire relation -- and expect inserts to be tested against them.
> > I'm not sure whether we'd actually do this, but we wanted to keep the
> > option open during development.
>
> I think that is only relevant for queries like "SELECT * FROM table
> WHERE ctid = '(12,34)'. You might expect that we take a lock on that
> physical part of the heap, so that an INSERT that falls on that slot
> would conflict, but one that falls elsewhere does not. At the moment, a
> TidScan only takes a predicate lock tuples that exist, it doesn't try to
> lock the range like an IndexScan would.
>
> The physical layout of the table is an implementation detail that the
> application shouldn't care about, so I don't feel sorry for anyone doing
> that. Maybe it's worth mentioning somewhere in the docs, though.

What about UPDATE WHERE CURRENT OF?

Also, people sometimes use CTID to eliminate duplicate rows.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-06-08 15:36:57 Re: reindex creates predicate lock on index root
Previous Message Greg Stark 2011-06-08 15:33:35 Re: Autoanalyze and OldestXmin