Re: [PHPLIB] WaitOnLock error with db_pgsql.inc From: Florian Gnägi (gnaegi <email protected>)
Date: 12/04/99

hi

try it with mysql instead of postgres. mysql is much faster. i wouldn't
use postgres on a large dynamic website!

i don't quite understand why you need a lock for your update. i guess
bevor your update you have something like

select stat from products where id='$id';

then you put stat in $x, $x++ and then you write $ back, right? well, this
is an atomic action for the database and doesn't need a lock if you do it
this way:

update products set stat=stat+1 where id='$id';

at least this works with mysql.

or just log the whole thing to another table or a flat file and by the end
of the day you count your stuff and update the database. this can be done
during the night so your system gets faster during the day...

hope this helps

-florian

On Sat, 4 Dec 1999, admin wrote:

> I am getting a WaitOnLock error when too many people are searching my
> database simultaneously. I am keeping statistics of which products are
> being accessed, so there is a write for each returned product.
> The error message points to the query() function in db_pgsql.inc, on the
> following line:
> $this->Query_ID = pg_Exec($this->Link_ID, $Query_String);
>
> The query in my code causing this error looks like:
> update products set stat='$x' where id='$id';
>
> I, myself, am probably at the source of the problem having abused of the
> system with multiple concurrent writes to the db, but I'm hoping the
> phplib mailing list will be able to provide somekind of alternative for me
> to keep logging statistics while providing multiple simultaneous
> connections.
>
> My current OS and software are:
> Freebsd 3.3-CURRENT with the following ports:
> apache+php+mod_ssl-1.3.9+3.0.12+2.4.2
> postgresql-5.4.1
> And installed phplib_7, of course.
>
> Thanks in advance,
> Marc
>
> -
> PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
> To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
> the body, not the subject, of your message.
>

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.