.tips
page 9 of 10, 228 small things in all. back to the first.
.december
2025, 15 tips.
Keep the original error in cause when you wrap it
typescriptdebugging
exactOptionalPropertyTypes makes undefined explicit
typescript
Type your routes with template literal types
typescript
Brand your ids so a UserId cannot be an OrderId
typescript
import type for things that are only types
typescriptbuild
Turn on noUncheckedIndexedAccess
typescript
A discriminated union, not a bag of optional fields
typescript
unknown at the boundary, never any
typescript
pg_dump with --format=custom, always
postgresqloperations
A lookup table beats an enum the day the list changes
postgresqlschema-design
LATERAL for the top N per parent
postgresql
DISTINCT ON is the latest-row-per-group query
postgresql
COPY, not a loop of INSERTs
postgresqlperformance
text, not varchar(255)
postgresqlschema-design
Store time as timestamptz, never timestamp
postgresqlschema-design
.november
2025, 10 tips.
Transaction pooling breaks session state, plan for it
postgresqloperations
Tune autovacuum per table, not globally
postgresqloperations
INCLUDE the columns the query reads as well as the ones it filters
postgresqlperformance
LIKE '%term%' needs a trigram index
postgresqlsearch
Let a generated column hold the derived value
postgresqlschema-design
Use jsonb_path_ops for containment queries
postgresqlperformance
Fix bad row estimates with CREATE STATISTICS
postgresqlperformance
Read wait_event before you guess why a query is slow
postgresqldebugging
Give the app role a statement_timeout
postgresqloperations
Kill sessions that sit idle inside a transaction
postgresqloperations