What is a database index and when should you use it?
This question checks whether a candidate understands query performance and trade-offs.
0
Asked by KASA community7 Jul 20261 view
KASA answer
A database index helps the database find rows faster without scanning the entire table. It is useful on columns that are frequently used in WHERE, JOIN, ORDER BY, or UNIQUE constraints. For example, indexing an email column helps login lookup quickly find a user.
Indexes are not free. They take extra storage and must be updated whenever data is inserted, updated, or deleted. Too many indexes can make writes slower. A good answer should mention that indexes should be based on real query patterns and checked using query plans.
Cover these points
Index speeds up read queries.
Useful for WHERE, JOIN, ORDER BY, and unique lookup columns.