Perfectly Awesome
Posts by Date
Posts by Topic
Posts by Title
About
Database (SQL) Techniques - book notes
Data Manipulation:
Preventing lock contention (for updates on hot rows)
Updates based on a select query
Return modified row values
Delete duplicate rows
Table cleanup after bulk updates
Queries:
Reduce amount of group-by columns
Fill table with test data
Nullable columns
Prevent division by zero
Sort order with nullable columns
Ordering & pagination
Efficient pagination
Database locks
Common table expressions
First of many similar rows
Multiple aggregates
Row limits and ties
Fast row count estimates
Date-based statistical queries
Table joins - for-each loops
Schemas:
Rows & overlapping dates
Trees
JSON columns
Tag storage - JSON arrays
Data strictness
JSON validation
UUID keys
Fast delete of big data - partitions
Presorted tables
Pre-aggregated tables
Indexes:
Functions & expressions
Finding unused indexes
Deleting unused indexes
Index-only ops - including more columns
Partial indexes - reducing index sizes
Partial indexes - uniqueness constraints
Wildcard searches
Multi-column indexes
Hash indexes
Descending indexes - order by
Ghost conditions