PostgreSQL

2138 readers
1 users here now

The world's most advanced open source relational database

Project
Events
Podcasts
Related Fediverse communities

founded 2 years ago
MODERATORS
26
27
28
29
30
31
32
33
34
35
36
 
 

Example usage:

-- Register with default settings (41 timestamp bits, 10 type bits, 12 counter bits)
CALL snowflake.register('user_id');

-- Generate a user ID
SELECT snowflake.generate_user_id(now(), 1, 1);

-- Register with custom bit allocation
CALL snowflake.register('order_id', 42, 8, 13);

-- Generate an order ID with specific type and counter
SELECT snowflake.generate_order_id('2023-12-01 10:30:00 UTC', 5, 1000);
37
38
39
40
41
42
43
44
45
46
47
48
49
50
view more: ‹ prev next ›