Relational databases

Tables, indexes, transactions and ACID guarantees: how a relational database stays correct and fast, and what to know so as not to slow it down or corrupt it.

  • 33 cards
  • 3 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Scenarios
  3. Trade-offs and failures

A few cards from the deck

  • Index: what is it?

    Show the answer

    A structure, often a B-tree, that finds rows without scanning the whole table.

    Filtered reads become fast, but every write must also update the index.

  • The query « WHERE email = ? » is slow on 10 million rows. What do you do?

    • An index on the email column
    • More memory on the web server
    • The browser cache
    • Shard the users
    Show the answer

    An index on the email column

    Without an index the database scans every row; with one it goes straight to the right ones.

  • Transaction: what is it?

    Show the answer

    A set of operations run as a whole: everything is committed, or everything is rolled back.

    The database is never left half modified.

  • You add ten indexes on a heavily written table. Consequence?

    • Slower writes and more disk space
    • Slower reads
    • None
    • Rolled-back transactions
    Show the answer

    Slower writes and more disk space

    Each insert or update must update every index.