Junior — Middle
What are the advantages and disadvantages of using indexes in a database?
sobes.tech AI
Answer from AI
Advantages of using indexes in a database:
- Speeding up search and retrieval — indexes allow quick finding of needed records without full table scans.
- Improving performance of queries with WHERE, JOIN, ORDER BY conditions.
Disadvantages:
- Additional memory and disk space consumption.
- Slowing down insert, update, and delete operations, as indexes need to be updated when data changes.
Indexes should be used for frequently queried columns, but not created excessively to avoid degrading write performance.