Junior — Middle
What type of index should be used when you need to efficiently search for records across multiple fields in a table?
sobes.tech AI
Answer from AI
To efficiently search for records across multiple fields in a table, a composite (or compound) index is usually used. Such an index is created on several columns simultaneously and allows the database to quickly find records that meet conditions on multiple fields.
For example, in SQL:
CREATE INDEX idx_name ON table_name (column1, column2);
This speeds up queries with WHERE conditions on column1 and column2 together.