task Indexes · hard
Cover the event export
Export event_at and amount for shopper 7 on January 4, 2025. Create a full index with exactly (shopper_id, event_at, amount) and make the final query use a covering indexed search.
what to return
- Columns
event_atamountin this order- Rows
- 16 rows · in the order asked
- Watch for
- Use the half-open interval [2025-01-04 00:00:00, 2025-01-05 00:00:00). Order by event_at then amount, ascending.
- Choose any index name. Keep the source data unchanged. This task checks covering access, not execution time.
- Skill
- Build an index that supplies the selected payload without a table lookup. Refresher: Partitioning & workload trade-offs →
expected result
Your query should return exactly these columns and values. Run it and compare.
expected result16 rows · in this order
| event_at | amount |
|---|---|
| 2025-01-04 00:52:00 | 372 |
| 2025-01-04 02:29:00 | 469 |
| 2025-01-04 04:06:00 | 66 |
first 3 of 16 rows
data you can query
Sample rows from each table. Each column shows its type underneath; → marks a link to another table.
market_query_log5 columns · 0 rows
all 0 rows
solution.sql
Hints and the answer are always available. Using them counts the question as solved with help.