top | item 42581967

(no title)

peferron | 1 year ago

Perhaps as a tie breaker if you insert multiple rows in a table within one transaction? In this situation, the timestamp returned by e.g. `now()` refers to the start of the transaction, which can cause it to be reused multiple times.

discuss

order

fastball|1 year ago

I meant in a context with a random ID and a timestamp.

If you need to retrieve rows by time/order, you use the timestamp. If you need a row by ID, you use the ID.

The use-cases where you actually need to know which row was inserted first seem exceedingly rare (mostly financial / auditing applications), and even then can probably be handled with separate transactions (as you touch on).