SQL Practice Logo

SQLPractice Online

Level 5 - SeniorDebugging Questions

Debug: Broken Composite Index Order

Interviewer prompt: Query pattern is WHERE tenant_id = ? AND created_at BETWEEN ? AND ? ORDER BY created_at DESC. Existing index is slow. CREATE INDEX idx_logs_created_tenant ON logs(created_at, tenant_id); Fix it.