#536·uuid

Uuid v7 generated in wrong order

Author: fannyfan414Created Feb 7, 2024Updated Jul 6, 2026
Labelsbughelp wanted

Hello, I came across a strange case where the library generated uuid v7 incorrectly in time.

Here example of table id = Uuid::uuid7()->toString() and created_at (server datetime), sorted by id (asc)

id, created_at 018d7fca-3ae5-7306-a040-204628e43dc9, 2024-02-06T18:59:36.000000Z 018d7fdc-0ba8-7006-8047-41a572a695c6, 2024-02-06T19:19:03.000000Z 018d8030-0dab-7206-a042-31238ed9cb48, 2024-02-06T20:50:49.000000Z 018d8041-7c1b-7106-8043-6c5e69c8fbbd, 2024-02-06T21:09:51.000000Z 01a6ce4c-5a19-7006-b045-197ad8210718, 2024-02-06T19:19:54.000000Z

For some reason, ID=01a6ce4c-5a19-7006-b045-197ad8210718 was generated incorrectly