Learn Everything

Paths/Data Engineer/SQL & Query Craft / Indexes & Query Plans

Practice Taskintermediateubuntu:24.04Ask AI

Index the Warehouse

An index is a bet on the queries you actually run. Write the indexes for the two hot paths of the orders table.

Validator

⏱ 0:00

IDLE — checks run live as you type commands; submit when done

01Requirements

live checks
  • File ~/warehouse/indexes.sql exists○
  • The file creates a composite index over the status and the created_at column○
  • The file creates an index on the customer column○

02Walkthrough

1 of 3 revealed
  1. 01

    Write the composite index

    The order of the columns matters - equality first, range last. status is filtered on exactly, created_at is sorted on.

    echo CREATE INDEX idx_orders_status_created_at ON orders (status, created_at DESC); > ~/warehouse/indexes.sql
  2. 2 locked · each failed submit reveals one

03Stuck?

0 of 3 revealed

Take a hint without losing the lab — each one points at the thing to look at, not at the answer.

04AI Tutor

guides, never solves

Tell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?

04Notebook

saved locally in this browser

learner@lab — ubuntu:24.04

↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list