Re: Select for update with offset interferes with concurrent transactions

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Select for update with offset interferes with concurrent transactions
Date: 2011-02-01 19:05:22
Message-ID: 201102012005.22670.rsmogura@softperience.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hmm...

May I ask how this look in details. If e.g. I do select * from myeshop offset
100 limit 20, I have 1000 rows which rows will be locked?

a) 0 to 120, or
b) all rows will be locked.?

Kind regards,
Radek

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> Tuesday 01 February 2011 18:18:17
> In 9.0, LIMIT/OFFSET processing is done after FOR UPDATE locking, which
> means that rows skipped over by OFFSET still get locked, which means
> that different sessions executing this query are now practically certain
> to block each other, rather than just likely to block each other.
> This was an intentional change to improve the predictability of FOR
> UPDATE's interactions with LIMIT/OFFSET, and indeed it's improved the
> predictability of the behavior for you, just not in the direction you'd
> like :-(
>
> regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message vwu98034 2011-02-01 20:03:20 Re: Some Problems - Shall I reinstall the DB?
Previous Message Andy Colson 2011-02-01 19:04:31 Re: Select for update with offset interferes with concurrent transactions