Indexes and transactions

How indexes make searches fast and what they cost, and how transactions keep data correct when changes go wrong or happen at the same time.

About 7 hours of study

Learning objectives

Lessons

  1. 1

    Indexes and how queries find rows

    A full table scan reads every row; an index, usually a B+ tree, finds rows in a few steps. CREATE INDEX, EXPLAIN QUERY PLAN, and the cost of every index.

  2. 2

    Transactions and concurrency

    BEGIN, COMMIT and ROLLBACK; the ACID properties; savepoints; what goes wrong when transactions run at once, and how isolation levels, locks and logs prevent it.

Module practice

Module quiz

1. What is a full table scan?
2. What does ROLLBACK do?
3. What is the main cost of an index?
4. There is an index on (dept, marks). Which search can it not help?
5. T1 reads a value that T2 later rolls back. What is this called?
6. Which ACID property promises that committed data survives a crash?
7. What does ROLLBACK TO a savepoint do?

‹ Database designFinal assessment ›