RTS questionnaire · Q09 · Relational-database proof

Have you worked with relational databases such as Microsoft SQL Server or PostgreSQL? How many years of experience do you have with them?

A runnable review of how a slow screen is taken from a scan to a seek: the statements used, the measurements that prove the change, and the rules the answer is held to.

Status: reviewed Live query-tuning workflow SQL Server · PostgreSQL · 20+ years Jump to live proof ↓

9. Relational databases and years of experience

Answer as submitted

“Yes — 20+ years: SQL Server, PostgreSQL, Oracle and MySQL: T-SQL, PL/pgSQL, tuning.”
Technical decision: expand. The submitted line states the engines and the duration but not what the experience actually consists of. This page is the separate, detailed version: it shows the tuning loop step by step — measure, rewrite, index, refresh estimates, choose isolation — with the reads and timings that prove the result.

Expanded answer

Yes — more than 20 years with relational engines, and SQL Server and PostgreSQL as the two I know deepest. That covers T-SQL and PL/pgSQL development (stored procedures, functions, CTEs, window functions, JSONB modelling), schema and index design, execution-plan analysis, partitioning and statistics, ETL/ELT integration with SSIS and Airflow, plus the operational side: connection pooling, isolation choices, deadlock and blocking analysis, index maintenance, backup/restore and capacity planning. Oracle (9i–12c) and MySQL round out the same profile, and every hot query is validated against a real execution plan before release.

DecisionTypical statementWhy it is done this way
Predicate shapesargable ranges, no functions on columnsThe optimiser can seek the index instead of scanning the table.
Plan reviewSET STATISTICS IO, TIME / EXPLAIN (ANALYZE)Changes are justified by measured reads and time, not by intuition.
Index designkey order + INCLUDECovers the query shape and removes the key lookup.
StatisticsUPDATE STATISTICS … FULLSCAN / ANALYZECardinality estimates decide the join strategy and memory grant.
Isolationread-committed snapshot / snapshotReaders stop blocking writers without weakening the write path.
Transactionsexplicit scope + rowversionOne atomic business operation with optimistic concurrency.
Operationspooling, lock analysis, index maintenancep95 latency and stability in production, not just correct results.

Live query-tuning workflow proof

The running component below changes its statement/result view through real event binding. Select a step to see the exact statement, the reasoning behind it, and the measurement that proves the effect.

LIVE PREVIEW
RUNNING
SQL WORKFLOWRUNNING

Choose a tuning step

Select a step to inspect the statement, the reasoning and the measured result.

$ SELECT o.Id, o.CreatedAt, o.Total FROM Orders o WHERE o.CustomerId = 42 AND o.Status = 'Open' ORDER BY o.CreatedAt DESC

Predicates are written sargable: no functions on indexed columns and no implicit conversions, so the optimiser can seek instead of scanning.

Index Seek (IX_Orders_Customer_Status, nonclustered)
logical reads 24  ·  137 rows  ·  3 ms

How the tuning loop is run

Rules I apply. Measure before touching anything; fix the query shape before adding an index; add an index only when the plan shows the seek it buys, and count its write cost; refresh statistics when estimates drift; choose isolation deliberately so readers do not block writers; and keep every business operation inside one explicit transaction with optimistic concurrency. The result is judged on p95 latency and logical reads, not on a single fast run on a warm cache.
Boundary for Q09: this page covers query and schema tuning on relational engines. Cross-engine migration projects, database-level high availability topology and cloud managed-service sizing are separate topics.

Source files

Select a file to inspect the proof with syntax highlighting and line numbers. The first file is the code running the component above; the other two are the production shapes of the same tuning session.

Acceptance criteria