Indexing in RDBMS
Index: An index is a special data structure that improves the speed of data retrieval operations on a database table. Think of it as an alphabetical index at the end of a book, which helps you quickly find the page where a specific topic is discussed.
How Indexing Works:
Why Use Indexes?
Example:
Imagine you have a table called students with columns id, name, and grade. You create an index on the name column:
CREATE INDEX idx_name ON students(name);
Now, if you run a query to find all students named "Alice":
SELECT * FROM students WHERE name = 'Alice';
The database can use the index to quickly find the rows where the name is "Alice" instead of scanning every row in the table.
For more bite-sized design insights, follow Design Shots. https://www.dhirubhai.net/company/designshots/