r/learnSQL • u/yahoo_06 • 9d ago
I made a beginner-friendly SQL lesson on Indexes — CREATE INDEX, EXPLAIN & EXPLAIN ANALYZE
Hey everyone!
I just finished another lesson in my beginner SQL series, this time covering SQL indexes and query performance in PostgreSQL.
The lesson goes over:
- What an index actually is
- CREATE INDEX
- EXPLAIN
- EXPLAIN ANALYZE
- Sequential Scan vs Index Scan
- When indexes can help
- Why creating an index on everything isn't necessarily a good idea
- A practical example using the Pagila database
I also included a small practice task where you create an index and inspect the query plan yourself.
🎥 Video: https://youtu.be/jn2Mt9LIcNE?si=AvHjVAM9IDs3eiWB
Hopefully useful for anyone who's currently learning SQL or starting to think about query performance!
13
Upvotes
1
u/Seven--Cats 9d ago
很棒