datapusher-plus icon indicating copy to clipboard operation
datapusher-plus copied to clipboard

Commit after truncate to reduce lock contention

Open EricSoroos opened this issue 2 months ago • 0 comments

Truncate takes an AccessExclusive lock on the table, which blocks all other transactions from accessing the table, including select for datastore_info and any other access to the table contents. Since those operations are called from the web interface, the UI can hang for the timeout period or untill the copy finishes. This is poor user experience when dealing with large files.

So, truncate in it's own transaction, so that the AccessExclusive lock is held for the least amount of time possible.

EricSoroos avatar Nov 17 '25 14:11 EricSoroos