2ndQuadrant/audit-trigger

Why do comments say the transaction id "May wrap, but unique paired with action_tstamp_tx"

jpollard-cs opened this issue Β· 3 comments

Hello πŸ‘‹ πŸ˜ƒ

I'm curious why the comments on the transaction_id field indicates that it

"May wrap, but unique paired with action_tstamp_tx".

The PostgreSQL docs (going back even to 9.1) say of txid_current (and related functions):

The internal transaction ID type (xid) is 32 bits wide and wraps around every 4 billion transactions. However, these functions export a 64-bit format that is extended with an β€œepoch” counter so it will not wrap around during the life of an installation. The data type used by these functions, txid_snapshot, stores information about transaction ID visibility at a particular moment in time.

Also would it be worth adding a helpful note to users that they may want to modify / remove the use of clock_timestamp if they don't need it as it could add significant performance overhead to bulk inserts? Curious what the primary use case is here? I could see this perhaps being useful if reading uncommitted data?

Thanks!

I'm curious why the comments on the transaction_id field indicates that it

I'd agree - this seems to be a thinko.

Also would it be worth adding a helpful note to users that they may want to modify / remove the use of clock_timestamp if they don't need it as it could add significant performance overhead to bulk inserts?

Here I don't see why the use of clock_timestamp may be a significant performance overhead in particular. At least I don't read that from the linked blog post. The example given there is the inability to use an index when filtering on clock_timestamp due to the volatile nature of the function.

Oh right I see what you're saying - I misread that one πŸ™ƒ

Happy to put in a PR to update if we have a high degree of confidence here that this is a thinko