9 ms·
Sometimes it's the CPU waiting. Sometimes there is a connection open to the DB which acquired a lot of locks during a long-running transaction. The DB is proce
by koliber 3y ago
Sometimes it's the CPU waiting.
Sometimes there is a connection open to the DB which acquired a lot of locks during a long-running transaction. The DB is processing this transaction on one DB connection, and many other DB connections are blocked because they can not access certain tables, pages, or rows. The other sessions are literally doing nothing and are waiting.
Potential ways to improve it:
- Reducing the scope of transactions
- committing more often within the transaction
- optimizing just the most impactful queries which contribute to the blocking session's runtime (not ones that don't block at all)
- loosening the transaction isolation level