README.md
Lesson 8: Indexes and why queries get slow
Indexes and why queries get slow comes up in almost every real SQL project. We start with the why, then write code together.
Read the full lesson: https://glibcode.net/courses/sql-essentials/lessons/8
Files
indexes.sql: EXPLAIN QUERY PLAN before and after an index
Tip: Count before you delete: run the same WHERE with
SELECT COUNT(*)first.
Tip:
.mode boxand.headers onin sqlite3 make results much easier to read.
Run it
sqlite3 shop.db < ../../setup/schema.sql
sqlite3 shop.db < ../../setup/seed.sql
sqlite3 shop.db < indexes.sql
Exercises
See exercises.md. Ask in the forum once you've tried.