DEV Community

Discussion on: Eloquent UUIDs.

 
mjrider profile image
Robbert Müller

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:

  • 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