AlgoViz

SQL databases

easy 25 min

A SQL (relational) database keeps data in tables with declared columns, joins those tables by key when you ask a question, and enforces rules such as unique emails and valid references.

What each level should show

The same question is judged differently for mid, senior and staff.

  • Mid

    Must show

    • Models tables with keys
    • Explains the ACID letters
    • Adds an index for a query

    Will be probed on

    • Normal forms
    • Join types
    • What an index costs

    Stands out

    Uses a constraint to close a race.

  • Senior

    Must show

    • Reads a plan and fixes it
    • Picks an isolation level for a reason
    • Scales reads and plans for failover

    Will be probed on

    • Replica lag
    • Schema change without downtime
    • Hot rows

    Stands out

    Gives the growth trigger in numbers.

  • Staff

    Must show

    • Chooses shard keys from access patterns
    • Weighs distributed SQL against operations
    • Owns the data model across teams

    Will be probed on

    • Cross-shard transactions
    • Migration risk
    • Cost per transaction

    Stands out

    Keeps the system on one primary while the numbers allow it, and can prove that they do.