SQL Practice Logo

SQLPractice Online

Level 9 - DistinguishedDebugging Questionsm2 storage index mvcc internals

Debug Heap Fetch Heavy Read

This query causes high heap fetches and IO. Provide a safer SQL shape for the hot path: SELECT * FROM orders WHERE tenant_id = 77 AND status = 'PAID' ORDER BY created_at DESC LIMIT 200;

Schema Context

orders(order_id, tenant_id, customer_id, status, amount, created_at)