When I read the Wix Engeenering blog post "MySQL is a better NoSQL" I remained curious about the performance difference between generating GUID values in the application code vs. doing it in the database itself. Although MySQL provides a UUID() function, the CREATE TABLE
statement only accepts literals for the DEFAULT
values, thus the only way to do the job is using triggers. Will that have much negative impact? Let's see.
I've set up a Lumen installation to use a UUID primary key in the User model as described by Steve Azzopardi, and created a parallel user model called Tuser
(T for trigger). The former uses laravel-uuid package to generate a version 1 UUID on the application before the INSE