Middle
What indexes have you worked with in a database?
sobes.tech AI
Answer from AI
In working with databases, I have encountered several types of indexes:
- B-Tree index — the most common type, used for fast search, sorting, and range queries.
- Hash index — effective for exact key lookups but does not support range queries.
- Bitmap index — used in analytical systems for columns with low cardinality.
- Composite (compound) index — an index on multiple columns, speeds up complex queries filtering by several fields.
- Full-text index — for quick text searches, for example, in articles or descriptions.
Example of creating a composite index in PostgreSQL:
CREATE INDEX idx_user_status ON users (status, created_at);
This index will speed up queries filtering by status and sorting by creation date.