Re: concurrent updates problem - Mailing list pgsql-general

From Tom Lane
Subject Re: concurrent updates problem
Date
Msg-id 19686.985018622@sss.pgh.pa.us
Whole thread Raw
In response to Re: concurrent updates problem  (mwaples@waples.net)
List pgsql-general
mwaples@waples.net writes:
> Im using aolserver - but its Im writing it in php later too.
> code is below

> set sql "BEGIN WORK"
> ns_db exec $db $sql

> set sql "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE"
> ns_db exec $db $sql

> set sql "UPDATE threads set views = views + 1 WHERE forum_id = $forum_id
> AND thread_id = $thread_id"
> ns_db dml $db $sql

> set sql "COMMIT WORK"
> ns_db exec $db $sql

Are you sure that ns_db exec isn't "helpfully" doing a commit after each
command?

> But 5 or 6 concurrent requests always produce the correct results, any
> more than that things go wrong.

Sounds like you might be running into some sort of number-of-concurrent-
connections limit in AOLserver.  I'm not sure what happens when there
are too many threads for the available number of database connections in
AOLserver, but this example suggests that it's not good.  Anyone know?

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: concurrent updates problem
Next
From: Lamar Owen
Date:
Subject: Re: Cant connect if -B 1024 was set to postmaster