3 ms·
we did the same and then switched to the native UUID type. it eliminates the need for a unique index and we saw a drop in storage space by 1/2. it's totally wor
by narfz 10y ago
we did the same and then switched to the native UUID type. it eliminates the need for a unique index and we saw a drop in storage space by 1/2. it's totally worth converting UUID to the uuid field.
ALTER TABLE my_table ALTER COLUMN my_uuid TYPE uuid USING uuid::uuid;
- olavgg 10y agoAnd you want as much of the index as possible in RAM. When the index is 10 times larger than necessary and do not fit in your RAM, you get a very expensive performance penalty!
- StevePerkins 10y agoSame, but we use raw binary columns (i.e. "BINARY(16)" for MySQL and "BYTEA(16)" for PostgreSQL). Conversion between the database-native UUID type and the application-layer UUID type is often so flaky (particularly with Java and JPA).