Explain the trade-offs between different database indexing strategies for a food-ordering system.
Use the supplied tables and query workload to produce the requested order totals, then explain which indexes would support this access pattern and their costs.
Output
- One row per completed order created in January 2026, excluding orders outside the date range or with another status.
- Columns:
order_id, restaurant_id, created_at, and order_total.
- Include completed orders with no items as
0.00. Order by created_at ascending, then order_id ascending.
Output details
- Include timestamps at or after
2026-01-01 00:00:00 and strictly before 2026-02-01 00:00:00.
- Treat NULL quantities or prices as contributing nothing to
order_total, returning 0.00 when no non-NULL contribution remains.