Using regular UUIDs stored as a text-based primary key is very slow. Our newly released package spatie/laravel-binary-uuid aims to solve that by binary storing a slightly tweaked version of the UUID. My colleague Brent wrote a blogpost describing how it works behind the scenes. He also included some interesting benchmarks.

The binary encoding of UUIDs solved most of the issue. There's one extra step to take though, which allows MySQL to even better index this field. By switching some of the bits in the UUID, more specifically time related data, we're able to save them in a more ordered way. And it seems that MySQL is especially fond of ordered data when creating indices.