All Questions
Tagged with transaction postgresql
165 questions
0
votes
1
answer
44
views
Is there a way to get transaction time statistics on specific tables
I saw some log entries that indicated transaction time outliers of up to 10s at times, where transaction times are typically below 1s. To get a view of how often this happens, is there a way to get ...
0
votes
1
answer
33
views
postgres - ok to terminate active connections?
I am wondering whether any really bad things can result from terminating (pg_terminate_backend()).
Or would this at worst result into current transactions not being roled back.
or is current ...
2
votes
2
answers
142
views
PostgreSQL: Finding last executed statement from an "idle in transaction timeout"
Is there any way to log or find last executed statement from a session that terminated because of idle in transaction timeout? We only have slow statement logging and that did not capture it and we ...
1
vote
3
answers
151
views
Does Postgres abort transaction on error (need reference)?
Does Postgres abort current transactions on error? In any case, can you provide a reference?
Googling "site:postgres.org transaction abort rollback error" produced no results, and GPT ...
0
votes
1
answer
243
views
Postgres updates xmin on every UPDATE within a transaction
If I do an UPDATE to a row within a transaction, each time xmin increments. I thought that xmin always represents the current tx id. But it seems to be storing current xid + cmin instead.
But when ...
0
votes
2
answers
1k
views
How can a transaction view uncommitted changes made by another transaction in UNCOMMITTED READ
I know this is probably a silly question, It is my first, It seems so fundamental that I can't find the answer anywhere, because it must be so straight forward no one explained it.
I want to ...
0
votes
0
answers
18
views
Transaction reading table that may be updated by a different process
We have a cron job that reads a table, and then perform some operations for each row, and then stores the results in a different table.
To put it in an example, let's imagine we have the following ...
0
votes
3
answers
126
views
Can a new transaction claim an older sequence id?
I'm using a PostgresSQL database as an eventstore. We used to use https://github.com/SQLStreamStore/SQLStreamStore
But they had issues when having a lot of parallel transactions.
Essentially we ...
2
votes
1
answer
82
views
Atomic transactions and optimizing query for high throughput
I'm writing a system for applying discounts to invoices. This involves a table which stores the codes which can be used and how much discount to apply.
Our application is split up in multiple ...
1
vote
1
answer
446
views
Setting a value for max_locks_per_transaction
We find ourselves in a situation where we need to increase the value max_locks_per_transaction as the default isn't appropriate. I've spent some time looking and I can't find any information to ...
0
votes
2
answers
862
views
Why must I commit after the ALTER TABLE DDL to make changes visible?
If I execute this in DBeaver:
alter table classes alter column reference set not null;
on my local database which only I have open in DBeaver, it completes successfully.
But then I can't open the ...
0
votes
1
answer
481
views
Optimizing XID management in PostgreSQL: How to avoid INSERT locks in tables?
I would like to raise a question regarding the optimal practices for managing transaction age (XID) in a PostgreSQL database.
I am currently using the method of performing VACUUM FULL operations on ...
1
vote
1
answer
227
views
Limiting the number of rows that can be inserted for a given WHERE clause
In Postgres, I want to be able to confirm users' RSVPs for an event that has limited capacity. How do I do this in a way that protects against race conditions?
I have a table event_attendance with ...
2
votes
2
answers
331
views
Does a serializable transaction around a single statement have any effect compared to an implicit transaction?
I'm doing some performance auditing of our codebase and have noticed that we always run SQL statements within a serializable transaction. I've also noticed that many of these transactions only perform ...
2
votes
1
answer
2k
views
Catching exceptions and rolling back transactions
I am just trying to see if I understand this correctly:
By default, any error occurring in a PL/pgSQL function aborts
execution of the function and the surrounding transaction
I have a procedure ...