Index Scan vs Sequential Scan
Understanding the Core Difference in Database Query Performance When working with relational databases like PostgreSQL , MySQL , or Oracle Database , one of the most important concepts for performance tuning is understanding how data is read from tables. Two common access methods used by database query planners are: Index Scan Sequential Scan (Full Table Scan) If you’re preparing for DBA interviews or optimizing production queries, this topic is extremely important. Let’s understand both in detail. What is a Sequential Scan? A Sequential Scan (also called a Full Table Scan) means the database reads every row in the table , one by one, to find matching records. How It Works: Database starts from the first data block. Reads every block in order. Checks each row against the WHERE condition. Returns matching rows. Example: SELECT * FROM employees WHERE department = 'HR' ; If there is no index...