Re: concurrent updates problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mwaples(at)waples(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: concurrent updates problem
Date: 2001-03-19 16:17:02
Message-ID: 19686.985018622@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

mwaples(at)waples(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lamar Owen 2001-03-19 16:39:43 Re: Cant connect if -B 1024 was set to postmaster
Previous Message Tom Lane 2001-03-19 16:12:01 Re: concurrent updates problem