PostgreSQL Query Writing and Optimization

This domain owns SQL shape and runtime behavior in PostgreSQL: query formulation, planner choices, statistics, EXPLAIN interpretation, MVCC-visible locking behavior, deadlocks, and the tuning workflow that turns slow SQL into predictable production SQL.

Query Surface and Planner Basics

Data Types and Null Semantics

Joins, Correlation, and Set Logic

CTEs and Temporary Structures

Window Analytics

Aggregation and Numeric Analysis

Text and Pattern Logic

Temporal Logic

Semi-Structured Data

Data Modification

Upsert and Merge Logic

Predicate Shape and Indexability

Execution Plans and Plan Reading

Wait Events and Session Triage

Session Metadata and Context

Blocking, MVCC, and Locking

Deadlocks and Prevention

Race Conditions and Isolation

Procedural SQL and Error Handling

Plan Cache Regressions and Remediation