On 05/23/2010 02:15 AM, rihad wrote:
In this query:
UPDATE foo
SET allocated_to=?
WHERE id=(SELECT MIN(id) FROM foo WHERE allocated_to IS NULL)
AND allocated_to IS NULL
RETURNING id
Isn't the "AND allocated_to IS NULL" clause redundant?
--
Lew
--
Sent via pgsql-general mailing list (pgsql-gen
On 05/24/2010 01:29 AM, Grzegorz Jaśkiewicz wrote:
don't lock tables explicitly. That's a killer for (concurrent) performance.
Just write queries properly, and use appropriate transaction level.
And you are sorted.
Read Committed is fine, as long as I restart the UPDATE query RETURNING
nothing.
don't lock tables explicitly. That's a killer for (concurrent) performance.
Just write queries properly, and use appropriate transaction level.
And you are sorted.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org
On 05/23/2010 08:19 PM, Tom Lane wrote:
=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= writes:
find in docs part that talks about transaction isolation levels, and
translate it to your problem.
Yes, please read the fine manual:
http://www.postgresql.org/docs/8.4/static/mvcc.html
What I think will happ
=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= writes:
> find in docs part that talks about transaction isolation levels, and
> translate it to your problem.
Yes, please read the fine manual:
http://www.postgresql.org/docs/8.4/static/mvcc.html
What I think will happen in your example is that all concurren
by default query is wrapped in a transaction (if it is not run under a
transaction). And this will be default transaction isolation level.
some people think it works magic, but that's not true.
find in docs part that talks about transaction isolation levels, and
translate it to your problem.
--
S
On 05/23/2010 03:15 PM, Grzegorz Jaśkiewicz wrote:
every single query in postrgresql runs as a transaction, on top of it,
some are atomic, like when you use RETURNING statement. This is
because postgresql doesn't actually have to select these rows as
separate query.
Please note the cooperation
every single query in postrgresql runs as a transaction, on top of it,
some are atomic, like when you use RETURNING statement. This is
because postgresql doesn't actually have to select these rows as
separate query.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make cha
Hello,
In this query:
UPDATE foo
SET allocated_to=?
WHERE id=(SELECT MIN(id) FROM foo WHERE allocated_to IS NULL)
AND allocated_to IS NULL
RETURNING id
Is it guaranteed in any way that there will only be one id allocated and
returned even if multiple clients are executing this query co