0Pricing
SQL Academy · Lesson

Sequential Scans vs Index Scans

Know when a sequential scan is fine, when an index scan is required, and how the planner decides.

Two Ways to Find Rows

The database has two basic strategies for reading rows:

  • Sequential Scan — read every page of the table
  • Index Scan — walk an index, fetch matching rows

When Sequential Scan Is Right

If you need most of the table anyway, scanning is cheaper than reading the index AND fetching each matching row. Roughly: over ~10–20% of rows → seq scan wins.

All lessons in this course

  1. Reading EXPLAIN and EXPLAIN ANALYZE
  2. Sequential Scans vs Index Scans
  3. Hash Join vs Merge Join vs Nested Loop
  4. Identifying and Fixing Slow Queries
← Back to SQL Academy