KASA
Back to interview Q&A
Full Stack DeveloperDatabase Indexingintermediate

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.
  • Indexes cost storage.
  • Indexes can slow inserts and updates.
  • Use query patterns and query plans to decide.

Community answers

0 approved answers

Add answer

No approved community answers yet

Add a clear answer with examples. It will appear after moderation.

Question discussion

Comments and follow-ups

No approved comments yet. Add useful context or ask a follow-up.

Login to join the discussion

Write an answer

Add a practical answer with examples, edge cases, project experience, and points a fresher can speak in an interview.

Login required. Your answer will be connected to your account and sent for moderation.

Keep practising

Related interview questions

Browse all