From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Daniel Caune" <daniel(dot)caune(at)ubisoft(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE |
Date: | 2007-11-28 20:33:07 |
Message-ID: | 20830.1196281987@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
"Daniel Caune" <daniel(dot)caune(at)ubisoft(dot)com> writes:
> I did the following test, removing all the where-clause from the SELECT statement. Every statement completes immediately, i.e. it doesn't block.
I think you left out some critical information, like who else was doing
what to the table.
What it looks like to me is that the third and fourth rows in this view
were live according to your transaction snapshot, but were committed
dead as of current time, and so FOR UPDATE wouldn't return them.
> agoratokens=> select id from "Tokens" where id IN (47, 104, 44, 42) limit 3 for update;
> This time, the statement returns the row where id equals to 44.
No, it returns *some* row where id equals 44. Not necessarily the same
one seen in the seqscan. (I imagine this query is using an index, and
so would visit rows in a different physical order.) Printing the ctid
of the rows would confirm or disprove that theory.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Caune | 2007-11-28 21:28:47 | Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE |
Previous Message | Daniel Caune | 2007-11-28 19:50:55 | Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE |