Why this matters
Prevents loading excess data and running logic client-side.
Ensure LINQ queries translate to SQL efficiently (avoid client evaluation, use projections, defer ToList until needed).
Prevents loading excess data and running logic client-side.
Side-by-side examples engineers can pattern-match during review.
ctx.Users.ToList().Where(u => u.Active).Select(u => u.Name)ctx.Users.Where(u => u.Active).Select(u => u.Name).ToListAsync()ToList() then Where()Where().Select().ToListAsync()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.