TGViewer
Coding Interview Preparation Coding Interview Preparation @coding_interview_preparation · 5.9K subscribers
Post #1238 678
❔Interviewer:
How does database indexing improve performance?


✅ Answer:

Database indexing improves performance by creating a data structure, typically a B-tree or hash based structure, that allows the database engine to locate rows quickly without scanning the entire table.

Without an index, queries often require full table scans, which are O(n). With a proper index, lookups can be reduced to O(log n) or even O(1) depending on the index type.

However, indexes come with trade offs. They consume additional storage and can slow down write operations because the index must be updated whenever the data changes. Therefore, indexes should be added selectively based on query patterns.
  • ❤ 4
  • 👍 1
More from @coding_interview_preparation
  1. Oct 10, 2026100 SQL interview questions
  2. Oct 8, 2026If you're prepping for system design interviews, this repo is gold It contains a curated,…
  3. Oct 6, 2026document post
  4. Oct 4, 2026💼 Why Your Resume Gets Rejected Before a Human Reads It You may have good skills and proj…
  5. Oct 2, 2026🧠 Coding Myths You Should Stop Believing There's a lot of advice online about learning to…
  6. Oct 1, 2026Most Asked Topics in AI Engineer Interviews Based on 2026 candidate reports
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →