0
0
DBMS Theoryknowledge~10 mins

Why indexing speeds up data retrieval in DBMS Theory - Visual Breakdown

Choose your learning style9 modes available
Concept Flow - Why indexing speeds up data retrieval
Start Query
Check for Index
Use Index
Find Data Quickly
Return Result
The database checks if an index exists for the query. If yes, it uses the index to find data quickly. If no, it scans the whole table row by row.
Execution Sample
DBMS Theory
SELECT * FROM Employees WHERE EmployeeID = 123;
This query looks for an employee with ID 123. Using an index on EmployeeID speeds up finding this record.
Analysis Table
StepActionIndex Used?Rows CheckedResult
1Start query executionNo0No data yet
2Check if index on EmployeeID existsYes0Index found
3Use index to locate EmployeeID=123Yes1Found matching row quickly
4Retrieve full row dataYes1Row data ready
5Return result to userYes1Query complete
💡 Index used to find the row in 1 check instead of scanning all rows
State Tracker
VariableStartAfter Step 2After Step 3After Step 4Final
Index UsedFalseTrueTrueTrueTrue
Rows Checked00111
Result StatusNoneIndex foundRow foundRow retrievedQuery complete
Key Insights - 2 Insights
Why does using an index check fewer rows than a full table scan?
Because the index is like a shortcut that points directly to the matching rows, so the database does not have to look at every row. See execution_table step 3 vs step 5.
What happens if there is no index on the searched column?
The database must scan every row one by one to find matches, which is slower. This is shown in the concept_flow branch 'No' leading to 'Full Table Scan'.
Visual Quiz - 3 Questions
Test your understanding
According to the execution_table, how many rows does the database check when using the index?
A0
B1
CAll rows
DDepends on table size
💡 Hint
Look at the 'Rows Checked' column at step 3 in the execution_table.
In the concept_flow, what happens if no index is found?
APerform full table scan
BReturn no result
CUse index anyway
DStop query
💡 Hint
Check the 'No' branch from 'Check for Index' in the concept_flow diagram.
If the index was not used, how would the 'Rows Checked' variable change in variable_tracker?
AIt would stay at 1
BIt would be 0
CIt would increase to total rows in table
DIt would be negative
💡 Hint
Refer to key_moments about full table scan and concept_flow showing scanning all rows.
Concept Snapshot
Indexing creates a shortcut to data rows.
When a query uses an indexed column, the database finds data quickly.
Without an index, it scans every row, which is slower.
Indexes reduce the number of rows checked, speeding up retrieval.
Always create indexes on columns used in search conditions.
Full Transcript
When a database receives a query, it first checks if there is an index on the column used in the search condition. If an index exists, the database uses it to jump directly to the matching rows, checking very few rows. This is much faster than scanning the entire table row by row. If no index exists, the database must perform a full table scan, checking every row until it finds matches. This difference explains why indexing speeds up data retrieval significantly. The execution table shows the steps where the index is found and used, reducing rows checked to just one. The variable tracker confirms the index usage and the low number of rows checked. Understanding this flow helps beginners see why indexes are important for fast queries.