What is the main advantage of using an index in a database?
a) Faster retrieval of data
b) Reduced storage space
c) Improved security
d) Data redundancy
Answer:
a) Faster retrieval of data
Explanation:
The main advantage of using an index in a database is faster retrieval of data. Indexes allow the database to quickly locate rows based on the values in the indexed columns, reducing the time required to search through the entire table.
Indexes are especially useful for large tables and frequently queried columns. They work like a book’s index, allowing users to quickly find information without scanning every row.
However, indexes can also increase the size of the database and slow down write operations (inserts, updates, and deletes) because the index must be updated when data changes.