Back to MD Exchange
    Project Blueprintspostgresqlperformancedatabaseindexing

    PostgreSQL Performance Tuning Guide

    Index strategies, EXPLAIN ANALYZE, connection pooling, vacuum tuning, and partitioning decisions.

    J
    jakemorrison|March 1, 2026|Updated Oct 8
    131 downloads52 stars

    Uploaded markdown content, not a verification of tool compatibility or results. Review the raw text, commands, and permissions before using it. Stars require an account.


    name: pg-performance


    PostgreSQL Performance Tuning

    When to Index

    • WHERE clause columns (>1K rows)
    • JOIN columns
    • ORDER BY on large tables

    When NOT to Index

    • Tables <1000 rows
    • Write-heavy columns
    • Low-cardinality columns when queries select a large share of rows; selective partial indexes can still help

    Connection Pooling (PgBouncer)

    Sizing heuristic: start around 2 Γ— CPU cores, then measure and adjust for your workload and total connection budget. PgBouncer configuration requires an integer, not this expression.
    Example setting: default_pool_size = 25

    Vacuum Tuning

    autovacuum_vacuum_cost_delay = 2ms
    autovacuum_naptime = 15s