AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
The Pros and Cons of PG Stat Statements
PG stat statements and auto explain were added in the same release of Postgres 8.4. PGS statments has special list of queries in normalized form, so-called normalized format. When a new entry needs to be inserted, it needs an exclusive lock on shared memory area for PGS statment or PGS stat K cash. If some selects are happening concurrently in parallel, those selects hold a shared lock and your insert needs to wait. For example, imagine we have like 5,000 that's default records in PGS statings, and somebody is slowly reading them during, for example, 100 milliseconds. It's quite slow. And while they are reading it, one session,