orders has two indexes, idx_orders_status and idx_orders_created. For this query either could be used, and the planner picks one on its own:
SELECT COUNT(*) FROM orders WHERE status = 'paid' AND created_on >= '2024-06-01';
Sometimes you know better than the planner (or you want to be sure a particular plan is used). SQLite lets you hint an index with INDEXED BY.
Write the count so that it must use idx_orders_created.
created_on >= '2024-06-01'INDEXED BY idx_orders_createdSyntax: FROM orders INDEXED BY idx_orders_created.
If the named index cannot be used for the query, SQLite raises an error instead of falling back.
No results yet
Run your code to check it against the examples, or submit to run every test.