I want to create sync API in which users can get the changes since their last sync request, the API exposes cursor-based pagination (sync token)
A possible cursor may be to use updatedAt
column along with xmin
column (I need the xmin
because many rows may have the same timestamp).
My only concern is if it's possible to have rows with same (updatedAt) timestamp and wrapped around xmin
:
+---------------------+------------+
| timestamp | xmin |
+---------------------+------------+
| 2011-01-01 00:00:00 | 4556455456 | -> first row
+---------------------+------------+
| 2011-01-01 00:00:00 | 6 | -> second row, wrapped around xid
+---------------------+------------+
Within a specific timestamp (moment), I can be sure xmin
will behave like a simple sequence, right?