Sobes.tech
Junior — Middle

Can you give examples of different types of indexes used in databases?

sobes.tech AI

Answer from AI

Databases use various types of indexes to speed up data search and sorting:

  • B-Tree index — the most common type, suitable for quick range searches.
  • Hash index — efficient for exact key lookups but does not support range queries.
  • Bitmap index — used for columns with a small number of unique values, such as gender or status.
  • Full-text index — used for fast text searches, for example, in articles or comments.

Example of creating a B-Tree index in SQL:

CREATE INDEX idx_user_name ON users (name);