ReinDBby Bandlei

Appendix A. Checklists

Brett Rosenblatt · Database tuning guide v1.3 · PDF

A.1First hour on an unfamiliar database

  • Version, patch level, edition and platform recorded
  • Time since the last restart known (it limits what the counters cover)
  • Size, growth and storage headroom for data, log or WAL, temp and archive destinations
  • Last good backup confirmed; replica lag checked
  • Top wait classes and the time model read
  • Top statements by total time listed
  • Blocking chains, long transactions and sessions idle inside one checked
  • Statistics freshness and maintenance job history checked
  • Recent deployments, parameter changes and incidents collected
  • Settings far from defaults listed

A.2Statement tuning

  • Goal stated as a number, with the hours it applies to
  • Baseline recorded: executions, time per execution, logical reads per execution, rows, plan identifier
  • Full text and representative parameter values captured, including skewed values
  • Actual plan captured with runtime row counts
  • First large gap between estimated and actual rows found
  • One hypothesis written in one sentence
  • Least invasive fix chosen (rewrite, statistics, index, plan pin, setting, schema)
  • Tested on production-like data with several parameter values; logical reads compared
  • Rollback script written and tested
  • Deployed at a quiet hour; owners told
  • Verified against the baseline at the same hours on following days
  • Change, reason and numbers recorded

A.3Index change

  • The queries the index serves are listed, with their share of database time
  • Column order follows equality, then range, then order, then covering columns
  • Overlap with existing indexes checked; redundant ones identified
  • Write overhead considered for the table's insert, update and delete rate
  • Built online or concurrently; invisible first where the engine supports it
  • Top statements on the table re-checked for plan changes afterwards
  • For drops: counters cover a full business cycle; not used for keys, uniqueness, foreign keys or replicas

A.4Settings change

  • Workload class and the right moment (average or peak) identified
  • Current value, proposed value and reason recorded
  • Scoped override considered before a global change
  • Restart or reboot requirement known (static parameters, parameter groups)
  • One change at a time; measured at the same hours on following days
  • Approved configuration in version control updated

A.5Monitoring starter set

  • Statement history source on for every database (Chapter 2)
  • Least-privilege monitoring login on every database
  • At least 14 days of hourly history kept
  • Dashboards: fleet overview, per database, statement drill-down, with normal ranges shown
  • Deploys and changes annotated on dashboards
  • Alerts: unreachable, load far above usual, blocking, replication lag, storage, backup age, stale measurements
  • Each alert has an owner, severity, runbook link and dashboard link
  • Monthly alert review on the calendar

A.6Running on a managed service

  • License model known (included or brought) and what it allows: edition, packs and options
  • Monitoring login works without SYSDBA, sysadmin or superuser rights (section 2.5)
  • Parameter groups or flags kept in version control; static parameters and reboot needs known
  • Storage IOPS, throughput and burst credits monitored against their limits
  • Instance class limits known: CPU credits, network and log throughput
  • Extensions, plugins and options you rely on are on the provider's list
  • Provider monitoring tier, retention and cost known
  • Logs and trace files reachable through the console or API
  • Maintenance windows and automatic minor upgrades annotated on dashboards

Appendix B. Version notes

B.1Oracle 11g against 19c

Oracle 11g (11.2) is long past the end of its support, but plenty of it still runs. 19c is the long-term support release most estates have moved to. The differences below change how you tune.

Area11g Release 219c
Top-N and paging syntaxROWNUM around an ordered subqueryFETCH FIRST n ROWS ONLY and OFFSET (12c+)
ArchitectureNon-CDB onlyMultitenant (CDB and PDB); V$ views carry CON_ID, and a PDB user sees only its PDB. Non-CDB is deprecated but still supported in 19c
Adaptive optimizationCardinality feedbackAdaptive plans (on by default), statistics feedback and SQL plan directives; adaptive statistics off by default from 12.2
HistogramsFrequency and height-balancedAdds top-frequency and hybrid histograms (12c), built when statistics are gathered with AUTO_SAMPLE_SIZE (the default)
Statistics for bulk loadsGather after the loadOnline statistics gathering for CREATE TABLE AS SELECT and direct-path loads into empty tables (12c)
Real-time statistics, high-frequency statistics, automatic indexing, SQL QuarantineNot availableNew in 19c, but licensed only on Exadata: Enterprise Edition on Exadata, Exadata Database Service (including Oracle Database@Azure, Google Cloud and AWS) and Autonomous Database. Not on Base Database Service or Amazon RDS (section 2.6)
PGA controlPGA_AGGREGATE_TARGET is a target onlyPGA_AGGREGATE_LIMIT hard cap (12c)
Index usageALTER INDEX ... MONITORING USAGE, visible to the index owner in V$OBJECT_USAGEDBA_INDEX_USAGE, collected automatically (12.2+)
Partitioned indexesFull indexes onlyPartial indexes switched on or off per partition (12c)
Online operationsOnline index builds and some redefinitionOnline partition moves (12c), online table moves and online conversion to partitioned (12.2)
Key generationSequence plus triggerIdentity columns (12c)
Identifier length30 bytes128 bytes (12.2)
PL/SQL called from SQLContext switch per callPRAGMA UDF and WITH FUNCTION reduce the cost (12c)
Approximate aggregatesNot availableAPPROX_COUNT_DISTINCT (12c) and approximate percentiles (12.2) for fast estimates over large data
Plan displayDBMS_XPLAN with ALLSTATS LASTAdds +ADAPTIVE (12c) and a hint usage report (19c) that shows which hints were used or ignored

B.2SQL Server

VersionChanges that matter for tuning
2016Query Store; live query statistics; with SP1, partitioning, compression and columnstore in all editions, and CREATE OR ALTER
2017Automatic plan correction; adaptive joins and memory grant feedback (batch mode); interleaved execution for multi-statement functions; per-query wait statistics in Query Store; resumable online index rebuilds
2019Scalar UDF inlining; table variable deferred compilation; batch mode on rowstore; row-mode memory grant feedback; OPTIMIZE_FOR_SEQUENTIAL_KEY; last actual plan (LAST_QUERY_PLAN_STATS); accelerated database recovery; resumable online index creation
2022Parameter Sensitive Plan optimization; Query Store on by default for new databases, and Query Store hints; degree-of-parallelism and cardinality estimation feedback; granular permissions such as VIEW SERVER PERFORMANCE STATE; Parquet and Delta files in S3-compatible object storage
2025Optimized locking (needs accelerated database recovery); optional parameter plan optimization for catch-all predicates; cardinality estimation feedback for expressions; degree-of-parallelism feedback on by default; the ABORT_QUERY_EXECUTION hint to block a known bad query; tempdb space resource governance; Query Store on readable secondaries

Many of the newer optimizer features depend on the database compatibility level, not just the server version. Upgrading the server without raising the compatibility level leaves them switched off. SQL Server 2016 left extended support in July 2026.

B.3PostgreSQL

VersionChanges that matter for tuning
10Declarative partitioning; CREATE STATISTICS for correlated columns; the pg_monitor role
11Hash partitioning and default partitions; INCLUDE columns in indexes; JIT compilation; procedures that can COMMIT
12REINDEX CONCURRENTLY; plan_cache_mode; most-common-value extended statistics; common table expressions inlined by default (add MATERIALIZED to keep the old behavior)
13pg_stat_statements renames its timing columns (total_exec_time) and adds planning time; incremental sort; B-tree deduplication
14DETACH PARTITION CONCURRENTLY; query identifiers computed in core (compute_query_id); pg_stat_wal
15MERGE; cumulative statistics kept in shared memory instead of a statistics collector process
16pg_stat_io; EXPLAIN (GENERIC_PLAN)
17Incremental backups; much more memory-efficient vacuum; EXPLAIN options SERIALIZE and MEMORY
18Asynchronous I/O; B-tree skip scan; planner statistics kept through pg_upgrade
19 (release candidate, October 2026)NOT IN turned into an anti-join when no NULLs are possible; parallel autovacuum workers; EXPLAIN (ANALYZE, IO); the pg_stat_lock view; generic and custom plan counts in pg_stat_statements; log_lock_waits on by default

PostgreSQL 13 has been out of support since November 2025, and 14 reaches end of life on November 12, 2026.

B.4MySQL

VersionChanges that matter for tuning
5.7Optimizer hints; JSON; the sys schema included. End of life since October 2023
8.0Common table expressions and window functions; histograms; invisible and descending indexes; functional indexes and skip scan (8.0.13); hash joins and EXPLAIN ANALYZE (8.0.18); instant ADD COLUMN; the query cache removed; innodb_redo_log_capacity (8.0.30). End of life since April 2026
8.4 LTSSeveral InnoDB defaults changed (for example, the adaptive hash index is off by default and innodb_io_capacity is higher); review settings carefully when upgrading
9.7 LTSReleased April 2026. The hypergraph join optimizer and the telemetry component are now in the Community edition. Turn the hypergraph optimizer on for one session (optimizer_switch) and compare plans before using it more widely

Check the vendor's current support status for any release you run.

Appendix C. Glossary

TermMeaning
Average active sessions (AAS)Database time divided by elapsed time: how many sessions were working or waiting, on average. Compare it with the number of CPU cores
BaselineA description of normal for a database at a given time, used to tell real change from routine variation
CardinalityThe number of rows an operation returns, or the number of distinct values in a column
Clustering factorHow closely a table's physical row order follows an index's order; it decides how expensive index range scans are
Covering indexAn index that contains every column a query needs, so the table isn't read
Database timeTotal time sessions spend working or waiting in the database (CPU plus non-idle waits)
DriftA measurable departure from a database's or statement's own normal behavior
Hard parseCompiling a new statement and choosing its plan, as opposed to reusing a cached one
HistogramStatistics describing how values are distributed in a column, used for skewed data
Implicit conversionA type conversion the engine adds on its own; on a column, it usually disables the index
Keyset paginationPaging by remembering the last key and seeking past it, instead of using OFFSET
Logical readA read of a block or page from memory; the most stable measure of a statement's work
Median absolute deviation (MAD)A robust measure of spread: the median of the distances from the median
Partition pruningSkipping partitions that can't contain matching rows, based on predicates on the partition key
Plan regressionA statement getting slower because the optimizer chose a different, worse plan
RBAR"Row by agonizing row": procedural, one-row-at-a-time processing where a set operation would do
SargableA predicate that can use an index to find matching rows directly
Seasonal baselineA baseline that compares each hour with the same hour on previous days
SelectivityThe fraction of rows a predicate matches
Wait eventA named reason a session is waiting instead of working: I/O, locks, commits, network
WatermarkThe boundary value that separates data in one tier (or one load) from the next

Appendix D. Sources and further reading

Vendor documentation is the final word on behavior and licensing for your exact version.

This is one chapter of the free database tuning guide for PostgreSQL, MySQL, SQL Server and Oracle. Download the whole guide as a PDF.