Subject Re: [firebird-support] Re: max() on primary key very slow
Author Woody
From: "bigmarcman2000" <firefly13@...>
> Thank you for your answers.
>
> First of all, I'm using Firebird since version 1.0 in many different
> projects and was always pleased with the performance and stability.
>
> I don't want to complain about Firebird, I was just a bit surprised to
> find a performance problem, where I never expected it (and did not
> understand it), especially compared to other databases.
>
> In my current project, I'm developing a middelware, using an SQL database
> as persistence. I try to support many different databases and like to keep
> the code as common as possible. (That's why I try not to add procedures
> and triggers)
>

Since you control all the access, why not create an ID table that holds the
next ID for each table instead of relying on the speed of MAX? It's no more
dangerous in a multi-user environment and as a matter of fact, given the
proper attention to locking, is much safer and easier to deal with. I do
this with many of my relations and have never had any problems with multiple
users. It also eliminates any speed issues no matter which database you use.
:)

Woody (TMW)