Database engineering topic

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.

SQL Server12 minMay 27, 2026
Read

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.

MySQL16 minMay 13, 2026
Read

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.

MySQL8 minMay 13, 2026
Read

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.

MySQL33 minMay 9, 2026
Read

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.

PostgreSQL11 minMar 5, 2026
Read

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.

PostgreSQL10 minMar 5, 2026
Read

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+.

PostgreSQL13 minMar 5, 2026
Read

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.

PostgreSQL13 minMar 5, 2026
Read

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.

PostgreSQL12 minMar 5, 2026
Read

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

PostgreSQL12 minJan 6, 2026
Read

PostgreSQL Autovacuum Tuning: Prevent Table Bloat and Dead Tuples

Fine-tune PostgreSQL autovacuum to eliminate dead tuples, prevent table bloat, and maintain query performance

PostgreSQL13 minJan 4, 2026
Read

MySQL Performance Schema: A Practical Guide

Use MySQL Performance Schema to profile queries, monitor memory, and diagnose bottlenecks without guesswork

MySQL12 minJan 3, 2026
Read

PostgreSQL Wait Events: Understanding What Slows Your Database

Decode PostgreSQL wait events to diagnose lock contention, I/O bottlenecks, and CPU pressure in production

PostgreSQL11 minJan 2, 2026
Read

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

PostgreSQL12 minJan 1, 2026
Read

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.

PostgreSQL7 minDec 15, 2025
Read

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.

PostgreSQL5 minAug 18, 2025
Read

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.

MySQL1 minAug 13, 2025
Read

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.

PostgreSQL1 minAug 11, 2025
Read

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.

PostgreSQL5 minJul 16, 2025
Read

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.

PostgreSQL9 minMay 27, 2025
Read

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.

MySQL1 minMay 12, 2025
Read

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.

PostgreSQL10 minMay 9, 2025
Read

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.

PostgreSQL10 minMar 7, 2025
Read

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.

Redis6 minJan 28, 2025
Read

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.

MySQL11 minNov 12, 2024
Read

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.

MySQL7 minJul 9, 2024
Read

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.

PostgreSQL12 minJun 18, 2024
Read

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.

PostgreSQL12 minSep 19, 2023
Read

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.

PostgreSQL9 minAug 7, 2023
Read

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.

MySQL9 minJul 27, 2023
Read

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.

MySQL8 minJun 30, 2023
Read

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

PostgreSQL12 minMay 30, 2023
Read

PostgreSQL Index Bloat: Detection and Remediation

Identify bloated indexes in PostgreSQL using pgstattuple, REINDEX CONCURRENTLY, and automated monitoring

PostgreSQL11 minApr 11, 2023
Read

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.

PostgreSQL10 minMar 21, 2023
Read

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.

PostgreSQL12 minFeb 14, 2023
Read

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.

Redis7 minOct 25, 2022
Read

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.

MySQL14 minOct 12, 2022
Read

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.

MySQL16 minOct 6, 2022
Read

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.

PostgreSQL12 minSep 27, 2022
Read

MySQL Connection Limits and Max Connections: Tuning for Scale

Understand MySQL max_connections, thread caching, and connection pool sizing to handle high-concurrency workloads

MySQL11 minSep 20, 2022
Read

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.

MySQL11 minSep 6, 2022
Read

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.

MySQL12 minJul 19, 2022
Read

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.

MySQL7 minJul 15, 2022
Read

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.

PostgreSQL12 minJul 12, 2022
Read

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.

MySQL3 minJun 21, 2022
Read

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.

PostgreSQL6 minJun 7, 2022
Read

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.

MySQL7 minMar 28, 2022
Read

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.

MySQL8 minJan 30, 2022
Read

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.

PostgreSQL15 minJan 20, 2022
Read