Christof wrote:

I need to use UUDIs/GUIDs as primary keys in my DB...

Ann W. Harrison answers:

Here's some general thoughts on using UUID's and GUID's in indexes in Firebird.

First, smaller index keys are faster than larger index keys because you get more index entries per page.

Second, a binary representation of either UUID or GUID is smaller than a character based representation. So, where possible, choose a method that returns a value that you can store as a string of type octet containing binary byte values.

Third, Firebird uses prefix compression to reduce the stored size of index keys. Generally, a UUID or GUID includes a significant number of bytes that never change. Those should come first in the stored format, so the prefix compression will eliminate them.

Example: These three strings will be stored as 5 bytes for the first, and one byte for each of the next two:

ABCDE ABCDF ABCDG

These three strings will be stored as 5 bytes for each:

EDCBA FCDBA GDCBA

If whatever method you choose gives you numbers with the most volatile bytes first, invert them.

Like this post? Share on: TwitterFacebookEmail


Related Articles


Author

Firebird Community

Published

Category

Gems from Firebird Support list

Tags