SQL practice: Reading a Query Plan: Indexes That Earn Their Keep

Chapter 45 · 7 questions · included in full access

  1. Question 1 · easy

    Create an index named idx_orders_order_date on the orders table over order_date.

    Solve it in your browser
  2. Question 2 · easy

    Create a partial index named idx_orders_pending on orders over order_date, covering only rows whose status is 'Pending'.

    Solve it in your browser
  3. Question 3 · medium

    Create a composite index named idx_order_items_order_product on order_items over order_id and product_id, in that order.

    Solve it in your browser
  4. Question 4 · medium

    Create an expression index named idx_customers_lower_city on customers over lower(city), so that case-insensitive city lookups can use an index.

    Solve it in your browser
  5. Question 5 · medium

    Create a unique index named idx_products_name_unique on products over product_name.

    Solve it in your browser
  6. Question 6 · hard

    EXPLAIN ANALYZE shows a Seq Scan on a 50-row table. Is that a problem?

    Solve it in your browser
  7. Question 7 · hard

    EXPLAIN ANALYZE reports rows=12 estimated but rows=480000 actual on one node. What does that most likely mean?

    Solve it in your browser

These questions are part of full access.

The first chapters of every track are free. Full access is a one-time payment.

See pricing