---
title: "Postgres Support Recap: Investigating Postgres Query Performance"
description: "Three starting points for diagnosing slow Postgres queries: use pg_stat_statements to find long-running queries by mean execution time and then EXPLAIN ANALYZE them, check the cache hit ratio (in Neon via the neon_stat_file_cache view, since Neon extends shared buffers with a local file cache), and look for table and index bloat caused by MVCC dead tuples."
url: "https://swe.quest/articles/postgres-support-recap-investigating-postgres-query-performance-82d2d3f876d71410"
canonical: "https://neon.com/blog/postgres-support-recap-investigating-postgres-query-performance"
source: "Neon"
published: "2024-02-29"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["postgres","performance","sql","observability"]
---

# Postgres Support Recap: Investigating Postgres Query Performance

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-02-29, 9 min read, How-to. Original: [https://neon.com/blog/postgres-support-recap-investigating-postgres-query-performance](https://neon.com/blog/postgres-support-recap-investigating-postgres-query-performance)

## Summary

Three starting points for diagnosing slow Postgres queries: use pg\_stat\_statements to find long-running queries by mean execution time and then EXPLAIN ANALYZE them, check the cache hit ratio (in Neon via the neon\_stat\_file\_cache view, since Neon extends shared buffers with a local file cache), and look for table and index bloat caused by MVCC dead tuples. A hit ratio below 99% suggests the working set doesn't fit in memory, which calls for more shared\_buffers or a larger Neon compute. Bloat is reduced with VACUUM, VACUUM FULL or REINDEX, all of which take locks. PgHero, run via Docker, gives a free dashboard alternative.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [SQL](https://swe.quest/tags/sql.md) (Languages)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)

## Prerequisites

- PostgreSQL basics ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- SQL queries ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- EXPLAIN plans

## Keywords

pg\_stat\_statements, Neon, PgHero, VACUUM, REINDEX, MVCC, neon\_stat\_file\_cache, pg\_prewarm

## Related posts

- [Performance tips for Neon Postgres](https://swe.quest/articles/performance-tips-for-neon-postgres-9739985c47432424.md): Neon · 2024-04-04 · Medium · 8 min read · PostgreSQL, Performance engineering, Serverless, SQL
  Neon's serverless Postgres follows mostly standard Postgres tuning, plus a few Neon-specific checks.
- [Debug your Postgres from the terminal: a tour of \`neon inspect db\`](https://swe.quest/articles/debug-your-postgres-from-the-terminal-a-tour-of-neon-inspect-db-388ae9813e34917e.md): Neon · 2026-07-22 · Medium · 10 min read · PostgreSQL, Observability, Developer tools, Performance engineering, Replication
  \`neon inspect db\` adds fourteen read-only Postgres diagnostic subcommands to the Neon CLI, each running one curated query against Postgres statistics and catalog views (table/index sizes, bloat, unused indexes, seq scans, long-running queries, locks, pg\_stat\_statements outliers and calls, vacuum stats, replication slots, subscriptions).
- [Introducing Postgres Query Insights in ClickHouse Cloud](https://swe.quest/articles/introducing-postgres-query-insights-in-clickhouse-cloud-a9697a827409b984.md): ClickHouse · 2026-05-07 · Medium · 7 min read · PostgreSQL, Observability, Performance engineering, Analytics & OLAP
  Postgres Query Insights, now in preview for ClickHouse Cloud Managed Postgres, ranks every normalized query pattern by impact and aggregates per-execution counters (CPU, cache vs disk reads, temp spills, unlaunched parallel workers, WAL) to explain why a pattern is slow.
- [The Postgres mistakes we all still make](https://swe.quest/articles/the-postgres-mistakes-we-all-still-make-63314d194ac77b85.md): Neon · 2026-11-28 · Medium · 15 min read · PostgreSQL, Performance engineering, Databases
  Five common Postgres mistakes all eventually show up as connection pressure: opening a connection per request, appending to JSONB columns, holding transactions open across external API calls, nightly bulk DELETEs, and unused indexes.
- [Monitor These Key Neon Metrics Via Datadog](https://swe.quest/articles/monitor-these-key-neon-metrics-via-datadog-4c621c1afdac4161.md): Neon · 2024-11-12 · Medium · 5 min read · PostgreSQL, Observability, Caching, Performance engineering
  Neon now exports database metrics to Datadog via an API-key integration covering all computes in a project.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
