pg_locks in production

2024-09-20 Thread Wizard Brony
If performance is not an issue, is it valid to use the pg_locks system view in 
production code? Or are there other concerns besides performance that would 
make its use inappropriate for production?




CREATE DATABASE command concurrency

2024-09-18 Thread Wizard Brony
What are the concurrency guarantees of the CREATE DATABASE command? For 
example, is the CREATE DATABASE command safe to be called concurrently such 
that one command succeeds and the other reliably fails without corruption?




Repeatable Read Isolation Level "transaction start time"

2024-09-24 Thread Wizard Brony
https://www.postgresql.org/docs/16/transaction-iso.html#XACT-REPEATABLE-READ

The PostgreSQL documentation for the Repeatable Read Isolation Level states the 
following:

“UPDATE, DELETE, MERGE, SELECT FOR UPDATE, and SELECT FOR SHARE commands behave 
the same as SELECT in terms of searching for target rows: they will only find 
target rows that were committed as of the transaction start time.”

What is defined as the "transaction start time?" When I first read the 
statement, I interpreted it as the start of the transaction:

BEGIN;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;

But in my testing, I find that according to that statement, the transaction 
start time is actually "the start of the first non-transaction-control 
statement in the transaction" (as mentioned earlier in the section). Is my 
conclusion correct, or am I misunderstanding the documentation?