Subject RE: [firebird-support] Writing to tables, ignoring concurrency
Author Nigel Weeks
Hmm...

I may have to create generators on the fly for different counters...

Ahh, you're brilliant Helen!!!!!!

The only problem is, if I ever do have to rapidly update a single row, in a
single table, with every page, it starts barfing as soon as three
concurrent(and constantly reloading) browsers hit it?(dual processor
server), even with an atomic Stored Procedure doing the update and return of
new value...

This is via the PHP api - it hasn't got any mention of SHARED/PROTECTED in
it anywhere...

Does it get defaulted to FOR SHARED WRITE further down in the murky
darknesses of code...?


> -----Original Message-----
> From: Helen Borrie [mailto:helebor@...]
> Sent: Thursday, 28 August 2003 14:48
> To: firebird-support@yahoogroups.com
> Subject: Re: [firebird-support] Writing to tables, ignoring
> concurrency
>
>
> At 12:18 PM 28/08/2003 +1000, you wrote:
> >I know it's bad, but in this case, it doesn't matter.
> >
> >It's a page counter on a very busy site, and it's always deadlocking.
> >
> >I have a stored procedure that selects the value of a field,
> adds one,
> >writes is back, and suspends the new count
> >
> >The trouble is, it sti takes too long, and deadlocks are a-plenty
> >
> >If I start a transaction with parameters like "no-wait shared write",
> >Claudio's site:
> >(www.cvalde.com/document/TransactionOptions.htm)
> >says that any transaction can write to any table, even those
> used by other
> >transactions...
> >
> >Does it work? Has anyone used it?
>
> FOR SHARED WRITE is the default. You don't have to ask for
> it. I think you
> misread the article.
>
> Why are you controlling the page counter this way? By far the least
> intrusive way to do this will be to keep a generator for your page
> count. No need to update any table. Just keep this query
> prepared in its
> own read-only transaction and throw it at the server whenever needed:
>
> select gen_id(TheHitCounter, 1) from rdb$database;
>
> To update your hit counter display, execute the query and read the
> output. Too simple.
>
> heLen
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~-->
> Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
> Printer at Myinks.com. Free s/h on orders $50 or more to the
> US & Canada. http://www.c1tracking.com/l.asp?cid=5511
> http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/67folB/TM
> --------------------------------------------------------------
> -------~->
>
> To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/