how does ordering by UUID works on postgresql? -


is there ordering guarantee on using uuid_generate_v1() on postgresql?

if yes, guarantees per machine or not matter on machine uuid generated? (since v1 uuid timestamp + mac address, postgresql internally orders timestamp part , mac ?).

can "order by" uuid type column , expect work (seems work)?

i want generate uuids on multiple machines (with postgresql uuid_generate_v1()), copy them 1 postgresql instance , order uuid column. must guarantee order machine, not order of uuids of machines.

thanks.

uuids aren't designed ordered.

if want select records based on creation order, should use timestamp date_creation, auto-increment column (not particular case), or create own ids algorithm guaranteeing ordering; concat timestamp + uuid, or timestamp + auto-increment example.

you can create function in database later option.


Comments