0PricingLogin
SQL Academy · Lesson

Indexes for Common Queries

Add indexes for the queries you'll run most: by user, by date, by foreign key, and measure the impact with EXPLAIN.

What Is an Index?

An index is a separate on-disk data structure that lets the database find rows by column value without scanning the table. The classic implementation is a B-tree.

Indexes Trade Writes for Reads

Every index makes INSERT/UPDATE/DELETE slightly slower (the index must be updated too). Don't add indexes you don't need.

All lessons in this course

  1. Modelling a Blog: Users Posts Comments
  2. Choosing Keys and Types
  3. Indexes for Common Queries
  4. Seeding the Database with Test Data
← Back to SQL Academy