Pg_stat_database
pg_stat_database — Query PostgreSQL Database Statistics
Apr 15, 2026 / · 11 min read · postgresql administration monitoring database performance pg_stat_database ·Monitor PostgreSQL Databases with pg_stat_database pg_stat_database is the database-level statistics view in PostgreSQL. It holds one row per database, and each row carries cumulative counters for transactions, block reads, row activity, temporary files and deadlocks. It is a quick first stop when you want to compare …
Read MorePostgreSQL Resource Settings Query Guide
Mar 18, 2026 / · 6 min read · postgresql database administration sql queries configuration performance tuning resource management pg_settings postgres dba pg_stat_database ·PostgreSQL Resource Settings Query Guide This PostgreSQL query retrieves all resource usage configuration settings from the pg_settings system view. Resource settings control how PostgreSQL allocates memory, disk, and CPU resources across queries, background processes, and maintenance operations. Purpose and Overview …
Read MorePostgreSQL Statistics Settings Query Guide This PostgreSQL query retrieves all statistics collection configuration settings from the pg_settings system view. These parameters control what runtime data PostgreSQL collects about query execution, table activity, and performance, feeding into the pg_stat_* monitoring …
Read MoreFind Unused PostgreSQL Indexes with pg_stat_all_indexes
Apr 10, 2024 / · 7 min read · postgresql performance indexing index maintenance pg_stat_all_indexes pg_index pg_stat_database ·Find Unused PostgreSQL Indexes Before They Cost You Which indexes have gone unused since the statistics were last reset? pg_stat_all_indexes counts every index scan per index, and an index whose idx_scan is still zero after weeks of normal traffic is a candidate to drop. The query below lists those indexes, largest …
Read MorePostgreSQL Backend Connections via pg_stat_database
Mar 20, 2024 / · 3 min read · postgresql database administration performance optimization pg_stat_database ·Database Connections: A Look at PostgreSQL Backends This article delves into a PostgreSQL code snippet that sheds light on the number of backend connections established for each database within a PostgreSQL instance. We'll dissect the code, explore its purpose, and glean valuable insights for database administrators …
Read MoreHow Many Connections Can Your PostgreSQL Database Handle?
Mar 18, 2024 / · 7 min read · show postgresql database performance optimization pg_stat_activity pg_settings pg_stat_database pg_database pg_roles ·How Many Connections Can Your PostgreSQL Database Handle? PostgreSQL 16 split the connection limit into more than one pool. Besides the slots held back for superusers, a second block of slots can now be reserved for ordinary roles that have been granted pg_use_reserved_connections. The number of sessions an application …
Read More