Oh sure, sorry I was not clear. I was talking about the distinction between the concepts of integers vs strings in the general sense, not an implementation-specific one.
I figured the size require was a given, but probably should not have assumed.
with innodb, the primary key is added to every indexrow.
so lets say we have the following table
|uuid|name(10)|password(10)|
with indexes:
primary key uuid, index row length 16
index name, index row length 16+10
index name,password, index row length 16+10+10
this adds quite the overhead, i would go for the layout
|id(int)|uuid|name(10)|password(10)|
id: auto increment, only used for internal inter table relations
uuid: used as unique id on the outside of the application
where we guarantee that uuid will stay the same for ever, and is used the user identification
id could change when we export/import the dataset in a new application or when we connect to an external application
where
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
when using mysql as reference; Substitute integer with binary(16) because a integer is just 4 bytes long, and a UUID needs 16 bytes
Oh sure, sorry I was not clear. I was talking about the distinction between the concepts of integers vs strings in the general sense, not an implementation-specific one.
I figured the size require was a given, but probably should not have assumed.
I see MySQL does not have an integer type that can contain a UUID:
dev.mysql.com/doc/refman/5.7/en/in...
That said, how well will a binary column work as a PK and for FK relationships?
Bad,
with innodb, the primary key is added to every indexrow.
so lets say we have the following table
|uuid|name(10)|password(10)|
with indexes:
this adds quite the overhead, i would go for the layout
|id(int)|uuid|name(10)|password(10)|
id: auto increment, only used for internal inter table relations
uuid: used as unique id on the outside of the application
where we guarantee that uuid will stay the same for ever, and is used the user identification
id could change when we export/import the dataset in a new application or when we connect to an external application
where