For storing a 128 bits UUID there are multiple storage options:
- a byte[16] column
- two bigint/long(64 bits) columns
- a CHAR(36) column - 32 hex digits + 4 dashes.
- a UUID database specific column, if db supports it
From an indexing point of view which of those are the most efficient? If the db doesn't support a dedicated uuid type which of 1, 2, 3 are the best candidates?
raw(16)in Oracle anduuidin PostgreSQL. – Colin 't Hart Jun 28 '14 at 11:31uuid>>bytea>>textwithCHECKconstraint >varchar(36)>>char(36). See: https://dba.stackexchange.com/a/89433/3684 and https://dba.stackexchange.com/a/115316/3684. – Erwin Brandstetter Dec 20 '19 at 19:02