Skip to content
TopicTracker
From HackerNewsView original
TranslationTranslation

How Small Postgres Metadata Tables Throttle Your Largest Queries

The article explains how PostgreSQL metadata tables, despite their small size, can become a bottleneck and slow down large queries due to lock contention and sequential scans. It discusses the underlying mechanics of how these system tables interact with query execution, and offers strategies to diagnose and mitigate the performance impact.

Background

- PostgreSQL uses system "metadata tables" (catalogs like `pg_class`, `pg_attribute`, `pg_statistic`) to track table schemas, statistics, and internal bookkeeping. Although these tables are physically small (thousands of rows), they are read *extremely* frequently — every query plan consults them.