Hands-on task
PostgreSQL: seq scan → index scan
In the shop database, the events table (100,000 rows) has no indexes — the query SELECT * FROM events WHERE user_id = 42 goes through a Seq Scan. Create an index on user_id so the planner switches to index access, and save the query plan (EXPLAIN) to /root/plan.txt.
- explain
- seq scan
- index scan
- analyze
- postgresql