Skip to content

Commit after truncate to reduce lock contention - #263

Merged
jqnatividad merged 1 commit into
dathere:mainfrom
EricSoroos:pg_exclusive_locking
Nov 23, 2025
Merged

jqnatividad merged 1 commit into
dathere:mainfrom
EricSoroos:pg_exclusive_locking

Conversation

@EricSoroos

Copy link
Copy Markdown
Contributor

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.

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.
@jqnatividad jqnatividad mentioned this pull request Nov 17, 2025
9 of 10 tasks

@tino097 tino097 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@tino097

tino097 commented Nov 22, 2025

Copy link
Copy Markdown
Member

@jqnatividad we can merge this and i will include into mine PR

@jqnatividad
jqnatividad merged commit 69f5481 into dathere:main Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants