2 ms·
Imagine a database trying to solve SELECT client_id, invoice_id, invoice_status, invoice_date FROM invoices WHERE client_id IN (123, 567) AND invoi
by willvarfar 7y ago
Imagine a database trying to solve
SELECT client_id, invoice_id, invoice_status, invoice_date
FROM invoices
WHERE client_id IN (123, 567) AND invoice_status != 'PAID';
Imagine that there is an index for client_id.
The DB engine can scan the index, finding all the pages in the table that contain rows with one of those two client_ids in.
It requests these pages as soon as it finds them in the index.
It scans the pages in the order it finds them completed, though, which can be a completely different order than it requested them in.