Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Internally, `snowflakes` are 64 bit integers represented externally as `bigint`
```
bit 63 - unused (sign of int8)
bits 22-62 - timestamp with millisecond precision
Copy link

@ashwinstar ashwinstar Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(no specific to this PR) I am curious to learn on the design choice -

  • why timestamp was introduced? ideally node-id + counter should give unique sequence values to each node as well
  • If timestamp with millisecond precision is used then why is there a need to WAL log the updates to this sequence type?

bits 10-21 - counter within one millisecond
bits 0-9 - unique PostgreSQL node number set in postgresql.conf
bits 12-21 - counter within one millisecond
bits 0-11 - unique PostgreSQL node number set in postgresql.conf
```

* The timestamp is a 41-bit unsigned value representing millisecond
Expand Down