Subject: can a blocked transaction affect the performance of one that is blocking it?

From: Eric Schwarzenbach <[email-masked]>
Date: Mon, 9 Dec 2024 13:42:30 -0500

Hi,

Could one transaction (one that should be relatively simple and short) 
cause another complex, long running transaction (involving INSERTS, on a 
table the first transaction may be reading from) to take many orders of 
magnitude longer than it would normally? (short of competing for system 
resources, like CPU time etc, of course)

I don't believe my scenario involved a deadlock but I expect my short 
transaction was probably blocked by my long one. Does it make any sense 
that this could very significantly affect the performance of the 
non-blocked transaction?

Thanks,

Eric

---

From: Nikolay Samokhvalov <[email-masked]>
Date: Mon, 9 Dec 2024 15:10:32 -0800

> that this could very significantly affect the performance of the

Have you tried wait event analysis (looking at wait_event_type, wait_event,
state, query samples from pg_stat_activity)?

---

From: David Mullineux <[email-masked]>
Date: Tue, 10 Dec 2024 09:22:37 +0000

Yes.
Also, are you sure you mean deadlock ? It sounded like this is just a
simple lock conflict and not a deadlock.
The first transaction could be blocked on something else (even tho it's not
ally short and quick ).
Lock requests  are in a queue