Performance-Tuning
Kill Idle PostgreSQL Sessions with SQL
Mar 24, 2026 / · 5 min read · postgresql database administration sql queries connection management performance tuning pg_stat_activity postgres dba ·Kill Idle PostgreSQL Sessions with SQL These PostgreSQL scripts terminate idle sessions that have been inactive for more than 15 minutes. Two variants are provided: one that targets idle sessions across all databases on the server, and one scoped to only the currently connected database. Purpose and Overview Idle and …
Read MorePostgreSQL Query Planning Settings Query Guide
Mar 20, 2026 / · 5 min read · postgresql database administration sql queries configuration query planning performance tuning pg_settings postgres dba pg_stat_activity pg_stat_statements pg_stat_user_tables ·PostgreSQL Query Planning Settings Query Guide This PostgreSQL query retrieves all query tuning and statistics collection settings from the pg_settings system view. These parameters control how the query planner selects execution strategies, estimates costs, and collects runtime statistics. Purpose and Overview The …
Read MorePostgreSQL Resource Settings Query Guide
Mar 18, 2026 / · 5 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 MoreList PostgreSQL Tables by Size with SQL
Mar 15, 2026 / · 5 min read · postgresql database administration sql queries storage performance tuning pg_class postgres dba information_schema pg_indexes pg_namespace pg_stat_user_indexes pg_stat_user_tables ·List PostgreSQL Tables by Size with SQL This PostgreSQL query lists all tables in the current database sorted by their total size, largest first. It uses pg_total_relation_size() to include the table data, indexes, TOAST storage, and free space map in the size calculation. Purpose and Overview Disk space pressure is a …
Read MorePostgreSQL Table Row Count Estimates with SQL
Mar 14, 2026 / · 4 min read · postgresql database administration sql queries performance tuning statistics pg_stat_user_tables postgres dba pg_class pg_namespace information_schema ·PostgreSQL Table Row Count Estimates with SQL This PostgreSQL query returns estimated row counts for all user tables, sorted by the largest tables first. It reads from the statistics collector rather than scanning the tables, making it near-instant even on tables with billions of rows. Purpose and Overview Counting …
Read MoreMonitor PostgreSQL Memory Settings with pg_settings
Sep 10, 2025 / · 3 min read · postgresql database administration memory management system monitoring performance tuning sql queries database configuration pg_settings ·PostgreSQL Memory Settings Query: Monitor Database Memory Configuration This PostgreSQL query helps database administrators monitor and analyze memory-related configuration settings in their database instance. By querying the pg_settings system catalog view, you can quickly identify current memory parameters, their …
Read MorePostgreSQL Logging Configuration Query via pg_settings
Sep 9, 2025 / · 3 min read · postgresql database administration logging monitoring sql queries database configuration system settings performance tuning pg_settings ·PostgreSQL Logging Configuration Query - Monitor Database Settings This PostgreSQL query provides database administrators with essential insights into logging configuration parameters by querying the pg_settings system view. The query specifically targets logging-related settings while filtering out WAL (Write-Ahead …
Read MorePostgreSQL Lock Management Settings via pg_settings
Sep 8, 2025 / · 3 min read · postgresql database administration lock management performance tuning system catalog configuration troubleshooting sql queries pg_settings ·PostgreSQL Lock Management Settings Query Guide accessing system table pg_settings PostgreSQL's lock management system is crucial for maintaining data consistency and preventing conflicts in concurrent database operations. This guide demonstrates how to query and analyze lock-related configuration settings using the …
Read MorePostgreSQL Client Connection Settings via pg_settings
Sep 2, 2025 / · 4 min read · postgresql database-administration sql-queries configuration client-connections system-views database-management performance-tuning pg_settings ·PostgreSQL Client Connection Settings: Complete Guide to pg_settings Query This PostgreSQL query provides a comprehensive view of client connection default settings by querying the pg_settings system view, allowing database administrators to analyze and understand configuration parameters that affect client behavior. …
Read MorePostgreSQL Autovacuum Settings Query via pg_settings
Sep 1, 2025 / · 3 min read · postgresql autovacuum database-administration pg-settings sql-queries performance-tuning system-views maintenance pg_settings ·PostgreSQL Autovacuum Settings Query: Complete Guide to pg_settings Analysis This PostgreSQL query provides database administrators with essential insights into autovacuum configuration parameters by querying the pg_settings system view. Understanding these settings is crucial for optimal database performance and …
Read More