DBMS & SQL · Pro · Topic 3 of 5
Indexing & Query Optimization
5 questions.
Your progress0%
- 1st Visit
- 0/5
- 2nd Visit
- 0/5
- Revise
- 0/5
Overview
An index is an extra data structure, usually a B+ tree, that lets the database find rows without scanning the whole table, much like the index at the back of a book. A good index turns a full table scan into a lookup of a few pages, but every extra index slows down inserts, updates and deletes and uses storage. This topic covers how B and B+ trees work, clustered versus non-clustered and dense versus sparse indexes, and how to find and fix slow queries with EXPLAIN. Strong answers tie each index to a specific query pattern and weigh its read benefit against its write cost.
Questions
| # | Problem | Platform | Difficulty | Open | 1st1st Visit | 2nd2nd Visit | RevRevise |
|---|---|---|---|---|---|---|---|
| 1 | What is indexing in DBMS, and why does it make queries faster? | Concept | Easy | Read the answer to What is indexing in DBMS, and why does it make queries faster? | |||
| 2 | What is the difference between a B tree and a B+ tree? | Concept | Medium | Read the answer to What is the difference between a B tree and a B+ tree? | |||
| 3 | What is the difference between a clustered and a non-clustered index? | Concept | Medium | Read the answer to What is the difference between a clustered and a non-clustered index? | |||
| 4 | What is the difference between a dense index and a sparse index? | Concept | Medium | Read the answer to What is the difference between a dense index and a sparse index? | |||
| 5 | How would you find and fix a slow SQL query? | Concept | Hard | Read the answer to How would you find and fix a slow SQL query? |