6min chapter

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

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode