Check this,
In firebird (maybe other DBMS)
the primary key has ascending order, and the statement
select max(id) don't use this index. So in tables of millions of records,
this query has a high resources consuming, unless you create a descending index in primary key field.
Regards