Re: row vs page locking...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: John (jsparrowNOSPAM_at_ecclesdeletethiscollege.ac.uk)
Date: 09/06/04


Date: Mon, 6 Sep 2004 19:21:10 +0100

The Firebird guys don't consider this a bug, just an artifact of a different
concurrency system... it's certainly something you should be aware of. I
think there are thousands of systems out there that are potentially buggy in
multi-user situations (I know some of mine are! shhhhhh).

Maybe it's a problem of Interbase marketing - it used to be aimed at dbase /
Access crowd, whereas actually it is *very* specialist and arguably the
concurrency semantics are more tricky to learn than SQL Server.

I agree it would be nice if these were deferred until commit. That would
seem to be 1) easier to implement 2) more logical. While it may be a pain in
the ass for client/server systems (long transaction), n-tier and web systems
would be fine with it. Who writes long transaction apps these days?? (leave
the room, now! grin).

Consider checking for overlapping periods. Table UserCosts like:

pk int primary key
startdate datetime (timestamp in Interbase)
enddate datetime

You want to prevent overlapping periods. Can't do it with indexes, so no
Interbase 'magic' can't come into play. In SQL Server you can write a
trigger something like:

if exists(select i.entryid from inserted i inner join UserCosts u on
not(i.startdate > u.enddate or i.enddate < u.startdate) and i.entryid <>
u.entryid)
begin
 raiserror('UserCost intersects another record',16,1)
 rollback transaction
 return
end

In Interbase / Firebird you can't see other uncommitted records!!! You have
two choices: 1) use table_stability isolation, and essentially go
single-user. or 2) implement a dodgy linked-list style approach.

Interbase has a 'check contraint select' that is totally broken - because it
uses the user context and not the 'magic' system context.

After exploring these issues, I switched development of a project from
Firebird to SQL Server.

Having said all this, I do think Firebird is cool. You just need to be aware
of it's quirks and limitations. It's not in the same league as SQL Server.
But it is very good (and free, more so than MySQL, and multi-platform).

Perhaps in the n-tier / webby world, cool concurrency with long-duration
transactions is not so important?

John

"Randall Sell" <randall@bytewise.nospam.com.au> wrote in message
news:UKR_c.20876$D7.9498@news-server.bigpond.net.au...
>
> John wrote:
>>
>> My only reservation about Firebird is the 'magic' it has to use to
>> enforce unique indexes, foreign keys etc. Ie you could get a situation
>> like this:
>>
>> Trans 1:
>> Insert into mytable values (1); -- this is the PK
>> -- don't commit yet
>>
>> Trans 2:
>> Insert into mytable values (1); -- doesn't work, PK violation. So try
>> this:
>> Select count(*) from mytable where pkfield = 1 -- returns 0. hhhmmmm!
>>
>
> Indeed, I can produce the same issue. I would have though that changing
> the isolation level would address this, but it does not. This borders (in
> my mind) as a bit of a bug. Since the second transaction shouldn't know
> anything about an inserted record of "1" from the first transaction hence
> it should also execute successfully, and not until one of the two commits,
> should the other raise an exception.
>
> Thanx for pointing this out.



Relevant Pages

  • Re: PostgreSQL and Firebird comparison via digg
    ... "The truth of the matter is, InterBase does not come with a very rich ... around using Firebird as a embedded database, ... One misbehaving thread can bring the whole server crashing down, ... the need for a guardian service on Interbase and Firebird. ...
    (borland.public.delphi.non-technical)
  • Re: Firebird 1.5 Final is out...
    ... Firebird is definitely not InterBase, not because it is not compatible ... There is also the Yafill fork ... at their code-cleaning and porting of C codebase of IB to C++ FB v1.5. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Interbase Turbo?
    ... much as existing IB customers. ... IBExpress (prescribed Interbase non BDE component set), ... Firebird 2.x because it doesn't work with it! ... convert your app to use another (completely ...
    (borland.public.delphi.non-technical)
  • Re: Firebird / Interbase - wer weiss mehr als Wiki?
    ... ja, gibt es, schon seit der ersten Firebird Version ... Interbase-Komponente, ... Jahre, die nun schon Firebird von Interbase trennen, einiges an ... aber für den Einsteiger ist der datensensitive kram ganz nett. ...
    (de.comp.lang.delphi.datenbanken)
  • Re: PostgreSQL vs Firebird
    ... > Firebird databases will grow at a huge rate because of the transaction ... > overhead, while this happens in Postgres, they have the vacuum daemon ... Firebird has garbage collector that will do the same, ... The database has grown to 2g right now and it still run at a reasonable ...
    (borland.public.delphi.non-technical)