Skip to main content
Community Generate a UUIDv7 object based on the current time. The UUID contains a UNIX timestamp split into millisecond and sub-millisecond parts, followed by random bits. UUIDv7 microseconds You can use this function to generate a time-ordered series of UUIDs suitable for use in a time-partitioned column in .

Samples

  • Generate a UUIDv7 object based on the current time
    postgres=# SELECT generate_uuidv7();
               generate_uuidv7
    --------------------------------------
     019913ce-f124-7835-96c7-a2df691caa98
    
  • Insert a generated UUIDv7 object
    INSERT INTO alerts VALUES (generate_uuidv7(), 'high CPU');