Ertan Küçükoğlu wrote:

I would like to have suggestions about GUIDs and indexes on varchar GUID columns. What I read here and there is that it is better not to use indexes on such columns (other database system users like SQL Server or PostgreSQL suggest that if my memory serves me well). My case, I must use them for this project. Also Firebird might have a different handling of indexes which is immune to such column values. I do not know.

Dimitry Sibiryakov answers:

  1. Use binary GUID representation instead of text (VARCHAR(16) CHARACTER SET OCTETS)
  2. Generate GUIDs using UuidCreateSequential
  3. Reverse order of bytes before inserting it into table (or create additional field with data filled with REVERSE() function) for indexing

In this case GUIDs will be fine for indexing.

Like this post? Share on: TwitterFacebookEmail

Related Articles


Firebird Community



Gems from Firebird Support list