Subject | Re: AW: AW: [firebird-support] difficult question |
---|---|
Author | Ann Harrison |
Post date | 2013-12-06T16:46:23Z |
Since this discussion has wandered off into German, I'm going to put this
as bluntly as possible in English.
Never use "select max (id) + 1 from targetTable" to create unique identifiers. It's
the worst kind of bug - one that works when you test your code in single user
mode, and fails unpredictably in production. It's also very slow.
This warning applies to Firebird and all MVCC databases, and to databases
that use lock-based concurrency control if you use either Read Committed or
Repeatable Read isolation modes.
Generators (aka sequences) were created for a reason. Use them.
Luck doesn't enter into it.
Cheers,
Ann