Database Performance
Articles about database optimization and performance tuning
51 canonical articles
SQL Server Wait Stats: A Diagnostic Playbook for Slow Queries
Read SQL Server wait stats like a senior DBA: the four DMV sources, the eight wait types that cover 95% of incidents (PAGEIOLATCH, LCK_M, CXPACKET, WRITELOG…), and the remediation for each. A 30-minute diagnostic workflow from page to plan.
InnoDB Architecture Explained (2026): Buffer Pool, Redo Log & Production Tuning
Deep dive into InnoDB storage engine internals. Understand buffer pool, redo log, undo log, change buffer, and adaptive hash index for expert-level MySQL optimization.
MySQL 8.4 Parallel DDL: innodb_parallel_read_threads & innodb_ddl_threads Tuning
Leverage MySQL 8.4 InnoDB parallel DDL for faster schema changes. Learn parallel index creation, online DDL improvements, and reduced maintenance windows.
MySQL Architecture Explained (2026): Query Path, InnoDB Engine & Buffer Pool Internals
MySQL architecture from query parser to disk: optimizer pipeline, InnoDB buffer pool, redo log, and storage internals every production DBA needs in 2026.
auto_explain: Automatic Query Plan Logging for Slow Queries in PostgreSQL
Configure auto_explain to automatically log EXPLAIN output for slow PostgreSQL queries. Covers log_analyze, log_buffers, sample_rate, JSON format, and RDS setup.
hypopg: Test PostgreSQL Index Impact Without Building the Index
Use hypopg to test how a new PostgreSQL index would affect query plans before building it. Includes install, hypothetical index creation, EXPLAIN workflow, and index sizing.
PostgreSQL LISTEN/NOTIFY: Real-Time Application Events Without Kafka
PostgreSQL Huge Pages: Linux Configuration and Memory Performance Guide
PostgreSQL TOAST: Understanding Large Column Storage, Bloat, and Compression
Understand how PostgreSQL TOAST stores large columns, diagnose TOAST bloat with SQL, choose the right storage strategy, and use LZ4 compression in PG14+.
pgBadger: PostgreSQL Log Analysis and Slow Query Reporting Guide
Learn how to use pgBadger to analyze PostgreSQL logs, find slow queries, and automate daily reporting. Includes postgresql.conf setup, cron automation, and RDS tips.
PostgreSQL Tablespaces: Moving Tables and Indexes Across Storage Tiers
Use PostgreSQL tablespaces to distribute tables and indexes across NVMe, SSD, and archive storage. Covers creation, ALTER TABLE SET TABLESPACE, monitoring, and backup.
PostgreSQL Table Bloat and pg_repack: Reclaim Disk Without Downtime
Measure PostgreSQL table and index bloat, then use pg_repack to reclaim space with zero downtime
PostgreSQL Autovacuum Tuning: Prevent Table Bloat and Dead Tuples
Fine-tune PostgreSQL autovacuum to eliminate dead tuples, prevent table bloat, and maintain query performance
MySQL Performance Schema: A Practical Guide
Use MySQL Performance Schema to profile queries, monitor memory, and diagnose bottlenecks without guesswork
PostgreSQL Wait Events: Understanding What Slows Your Database
Decode PostgreSQL wait events to diagnose lock contention, I/O bottlenecks, and CPU pressure in production
pg_stat_statements: Query Performance Analysis in PostgreSQL
How to use pg_stat_statements to identify slow queries, analyze execution stats, and optimize PostgreSQL performance
5 Surprising Truths About Database Performance
Five counterintuitive database performance truths every engineer gets wrong — over-indexing costs, N+1 queries, connection pool sizing, replica reads, and EXPLAIN limitations.
PostgreSQL Query Planner Hints: pg_hint_plan and Statistics Tuning
Guide the PostgreSQL query planner with enable_xxx settings, pg_hint_plan extension, and extended statistics for correlated columns. Fix bad plans without rewriting queries.
sysbench MySQL Benchmarking: OLTP Workloads and Performance Baselines
Benchmark MySQL with sysbench OLTP workloads. Covers setup, read/write and read-only suites, interpreting TPS and 95th percentile latency, and comparing before/after changes.
pgbench: PostgreSQL Benchmarking for Configuration Validation
Use pgbench to benchmark PostgreSQL before and after configuration changes. Covers scale factor selection, TPC-B and read-only workloads, custom SQL scripts, and latency percentiles.
PostgreSQL Parallel Query: Configuration, JIT, and Tuning for Analytics
Enable and tune PostgreSQL parallel query for analytical workloads. Covers max_parallel_workers settings, PARALLEL SAFE functions, JIT compilation, and execution plan verification.
Database Connection Management at Scale: PgBouncer and ProxySQL Patterns
Connection exhaustion is one of the most common causes of database downtime at scale. Here is how production teams use PgBouncer and ProxySQL to handle 10,000+ concurrent connections.
MySQL Partitioning Strategies: RANGE, HASH, and Partition Pruning
Implement MySQL table partitioning with RANGE and HASH strategies. Covers instant partition drops for data lifecycle, partition pruning verification, and key gotchas.
Welcome PostgreSQL 18: A Revolutionary Leap in Database Performance and Developer Experience
Explore PostgreSQL 18 revolutionary features including async I/O, improved parallelism, enhanced JSON support, and developer experience improvements coming in 2025.
PostgreSQL Indexing Best Practices: The Complete Guide for Production
PostgreSQL offers multiple index types for different access patterns — and choosing wrong means slow queries or wasted space. A comprehensive guide to indexing strategy, from type selection to monitoring and maintenance.
Redis 8 vs Valkey 8: Which In-Memory Database to Run in Production
Choose Redis 8 or Valkey 8 from licensing, feature, managed-service, and operational requirements, then migrate within the documented compatibility boundary.
MySQL Performance Tuning (2026): Fix Buffer Pool, Kill Unused Indexes, Stop Slow Queries
Master MySQL performance optimization with this comprehensive 2025 guide. Learn expert techniques for query tuning, indexing strategies, memory configuration, and InnoDB optimization to achieve 10x database performance improvements.
MySQL 8.4 LTS: Production-Ready InnoDB Defaults Transform Database Performance
MySQL 8.4 LTS introduces production-optimized InnoDB defaults out of the box. Learn new default values, performance implications, and upgrade considerations.
PostgreSQL Connection States: Understanding pg_stat_activity for Production Diagnosis
PostgreSQL's pg_stat_activity view exposes every connection's state — but understanding what 'idle in transaction' means and why it's dangerous requires knowing the full lifecycle of a PostgreSQL backend process.
PgBouncer vs Odyssey vs pgcat: Choosing a PostgreSQL Connection Pooler
A detailed comparison of PgBouncer, Odyssey, and pgcat for PostgreSQL connection pooling — architecture differences, threading models, pool modes, TLS support, and decision criteria for each workload type.
Database Connection Pool Sizing: The Formula, the Variables, and the Common Mistakes
How to size your database connection pool correctly — the HikariCP formula, the variables that determine optimal pool size, and the mistakes that cause connection exhaustion or underutilization.
Demystifying MySQL EXPLAIN FORMAT=TREE: Read Query Plans Like a DBA
MySQL 8.0 introduced EXPLAIN FORMAT=TREE — a hierarchical, human-readable query plan format that reveals join order, access methods, and cost estimates in a way that the traditional tabular EXPLAIN cannot.
Improving Query Performance with Multi-Valued Indexes in MySQL 8.0
MySQL 8.0 introduced multi-valued indexes — allowing you to index individual elements of a JSON array so queries using MEMBER OF or JSON_OVERLAPS can use an index.
Query Plan Regression: Detecting and Fixing Bad PostgreSQL Plans
Detect query plan regressions in PostgreSQL using auto_explain, pg_hint_plan, and plan baseline management
PostgreSQL Index Bloat: Detection and Remediation
Identify bloated indexes in PostgreSQL using pgstattuple, REINDEX CONCURRENTLY, and automated monitoring
PostgreSQL Table Partitioning with pg_partman: Complete Guide
pg_partman automates PostgreSQL partition lifecycle. This guide covers create_parent(), retention policies, partition pruning, and migrating existing tables without downtime.
PostgreSQL JSONB vs JSON: Indexing, Performance, and When to Use Each
A deep dive into PostgreSQL JSONB vs JSON storage formats, GIN and B-tree indexing strategies, containment operators, and the performance characteristics that determine which to use for document storage workloads.
Redis Performance Tuning for High-Traffic Applications
Tune Redis from measured latency and memory behavior: bound command work, fix big and hot keys, choose eviction intentionally, and test persistence.
MySQL InnoDB Locking: Deadlocks, Gap Locks, and Next-Key Locks Explained
A deep dive into InnoDB locking — record locks, gap locks, next-key locks, how READ COMMITTED eliminates gap locks, diagnosing deadlocks with SHOW ENGINE INNODB STATUS and performance_schema, and prevention patterns.
Save Space on MySQL Data with Column Compression: InnoDB Page Compression and ROW_FORMAT
MySQL InnoDB supports multiple compression strategies — from ROW_FORMAT=COMPRESSED to transparent page compression using punch holes. Choosing the right approach can cut storage by 40-70% for text-heavy workloads.
Database Connection Pooling: PgBouncer, ProxySQL, and HikariCP Compared
A comprehensive guide to database connection pooling — comparing PgBouncer, ProxySQL, and HikariCP with configuration examples, pool mode trade-offs, and production sizing recommendations.
MySQL Connection Limits and Max Connections: Tuning for Scale
Understand MySQL max_connections, thread caching, and connection pool sizing to handle high-concurrency workloads
MySQL EXPLAIN Explained: How to Read Query Plans and Fix Slow Queries
MySQL's EXPLAIN command reveals exactly how the query optimizer plans to execute your SQL — which indexes it will use, how many rows it expects to examine, and where it may sort or create temporary tables.
MySQL Slow Query Log: Enabling, Analyzing with pt-query-digest, and Fixing the Top Patterns
A production guide to MySQL slow query log — enabling with long_query_time and log_queries_not_using_indexes, analyzing with pt-query-digest, reading EXPLAIN output, and fixing full table scans and N+1 loops.
Descending Indexes in MySQL 8.0: When and How to Use Them
MySQL 8.0 finally supports true descending indexes — eliminating the filesort that MySQL 5.7 required when sorting results in descending order. Here's how descending indexes work and when to add them.
PostgreSQL Performance Tuning: shared_buffers, work_mem, and Memory Configuration
A complete guide to PostgreSQL memory configuration and performance tuning, covering shared_buffers, work_mem, effective_cache_size, checkpoint tuning, and autovacuum settings that matter in production.
Top 10 MySQL Configuration Mistakes That Kill Performance
Avoid these common MySQL configuration mistakes that cripple performance. Learn proper buffer pool sizing, connection limits, and InnoDB settings for production workloads.
PostgreSQL VACUUM Tuning: A Comprehensive Guide
Master PostgreSQL VACUUM and autovacuum configuration for optimal database health. Learn dead tuple management, bloat prevention, and vacuum optimization strategies.
MySQL Error Log Table Explained: Using performance_schema for Error Analysis
MySQL 8.0 exposes error logs through performance_schema.error_log — enabling SQL-based filtering by severity, component, and timestamp without grep-ing log files.
Monitoring MySQL Using ProxySQL: Query Stats, Connection Metrics, and Alerting
ProxySQL maintains a rich internal stats schema that most teams never fully explore. Here's how to use ProxySQL's built-in monitoring to track query latency, backend health, and connection pool utilization.
PgPool-II for PostgreSQL: Installation, Configuration, and Connection Pooling
PgPool-II provides connection pooling, read/write splitting, and automatic failover for PostgreSQL — but its extensive configuration can be overwhelming. Here's a practical guide to getting PgPool-II running in production.