Unsigned Integers vs UUIDs for Laravel Distributed Systems

preview_player
Показать описание
Laravel Edition. In this quick tutorial I explain why using unsigned AUTO_INCREMENTED integer IDs for your database tables is bad and why you should use UUIDs instead. Using Laravel, I will show you how to do that quickly.
Рекомендации по теме
Комментарии
Автор

You should now recommend UUID v7 instead of v4. v4 drawback is that its random and hence makes db indexes slow whereas v7 is lexicographically sortable, because it encodes a timestamp when generating a uuid, so its the new recommended version to keep your db indexes happy. Laravel already has HasVersion7Uuids trait implemented since some time now. Also you don't need to mark a primary key unique because primary key index already implies uniqueness, no need to separately create another index.

SiddharthPant