SQL practice: Reading a Query Plan: Indexes That Earn Their Keep
Chapter 45 · 7 questions · included in full access
Question 1 · easy
Solve it in your browserCreate an index named idx_orders_order_date on the orders table over order_date.
Question 2 · easy
Solve it in your browserCreate a partial index named idx_orders_pending on orders over order_date, covering only rows whose status is 'Pending'.
Question 3 · medium
Solve it in your browserCreate a composite index named idx_order_items_order_product on order_items over order_id and product_id, in that order.
Question 4 · medium
Solve it in your browserCreate an expression index named idx_customers_lower_city on customers over lower(city), so that case-insensitive city lookups can use an index.
Question 5 · medium
Solve it in your browserCreate a unique index named idx_products_name_unique on products over product_name.
Question 6 · hard
Solve it in your browserEXPLAIN ANALYZE shows a Seq Scan on a 50-row table. Is that a problem?
Question 7 · hard
Solve it in your browserEXPLAIN ANALYZE reports rows=12 estimated but rows=480000 actual on one node. What does that most likely mean?
These questions are part of full access.
The first chapters of every track are free. Full access is a one-time payment.
See pricing