Why this matters
Proper indexing drastically improves query performance and reduces timeouts.
Index frequently filtered or joined columns and verify with query plans.
Proper indexing drastically improves query performance and reduces timeouts.
Side-by-side examples engineers can pattern-match during review.
// No index on Email; queries scan entire table// Migration: CreateIndex("Users", "Email", unique: true);WHERE Email = @p0 (no index)CREATE INDEX IX_Users_Email ON Users(Email)From 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.