Postgres FM cover image

pg_stat_statements

Postgres FM

CHAPTER

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,

00:00
Transcript
Play full episode

Remember Everything You Learn from Podcasts

Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.
App store bannerPlay store banner