Subject Re: [firebird-support] Writing to tables, ignoring concurrency
Author Helen Borrie
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:
>says that any transaction can write to any table, even those used by other
>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.