Why this matters
Smaller types improve storage, index efficiency, and query speed.
Use appropriate column types/lengths (e.g., NVARCHAR(128) vs NVARCHAR(MAX)) for fields with known bounds.
Smaller types improve storage, index efficiency, and query speed.
Side-by-side examples engineers can pattern-match during review.
NVARCHAR(MAX) for code/slug fieldsNVARCHAR(64) for slugs; NVARCHAR(256) for titlesnvarchar(max) on short codesnvarchar(64) for short codesFrom the same buckets as this rule.
Review SQL/database migrations for operations that can lock large tables or cause downtime. Examples: creating indexes without CONCURRENTLY (Postgres), ALTER COLUMN TYPE on big tables, adding NOT NULL without backfill, long-running updates without batching. Require an online migration strategy (CONCURRENTLY, backfill in batches, dual-write/expand-contract) and a rollback plan.