[Lazarus] Web development and XML database (Mattias)
graemeg.lists at gmail.com
Thu Nov 17 13:12:58 CET 2011
On 17 November 2011 12:32, zeljko <zeljko at .....> wrote:
> What database do you use ? It is not optimized primary key type (and x50
> slower than eg. int) ,but wondering if it's faster than pure varchar(36)
> (because of no non-ascii chars in guid) ?
We use Firebird 2.5. I know some databases servers support a GUID
field type, but we don't use that. We simply use a varchar(36) - thus
storing any string value. And the reason we use varchar() and not
char() [which might be slightly faster] is because our DDL scripts
insert some default static lookup data which is more human readable
and using < 36 character text as primary keys.
As for the 50x slower....we have not noticed such large degradation at
all. Yes there will probably be a speed penalty because our primary
keys are not sequential - thus the DB needs to work a bit harder. But
the speed penalty is so small neither we nor our customers notice
anything. The benefits of using GUID's far outweigh the cons - in our
situation. Your mileage may vary.
> Anyone measured such things ?
Yes, some years ago I wrote a simple speed test. GUID's were indeed
slower that say Integer based primary keys. But the speed difference
was sufficiently small, so not something we needed to worry about. I
also remember the indexing algorithms for some RDBMS improved
drastically over the years, reducing the speed issue of text GUID
style primary keys even more.
- Graeme -
fpGUI - a cross-platform Free Pascal GUI toolkit
More information about the Lazarus