Sobes.tech
Junior — Middle

Can you name the types of indexes used in SQL database management systems?

sobes.tech AI

Answer from AI

SQL database management systems use various types of indexes to speed up data search and sorting:

  • B-Tree index — the most common type, suitable for fast search, insertion, and deletion. Used for equality and range queries.
  • Hash index — efficient for equality operations but does not support range queries.
  • Bitmap index — used for columns with a small number of unique values, well-suited for analytical queries.
  • Full-text index — for quick text searches, supports word and phrase searches.
  • Spatial index — for geographic data, e.g., R-Tree.

Example of creating a B-Tree index in SQL:

CREATE INDEX idx_user_name ON users(name);