Instruction
Well done! So, when should we use indexes? Wouldn't it be a good idea to create an index for each column when we create a table?
The answer is no. Even though indexes boost the performance of SELECT statements, they slow down other operations like INSERT, UPDATE, and DELETE.
Whenever we want to add new data, delete rows, or update information, the database engine will also have to make appropriate changes to the indexes. If we update a column that is part of an index, the database will also have to update the value in the index. Because all values in an index follow a certain order, the database will have to reorganize the index structure after a value has been changed.
Making changes to indexes can take much longer than making changes to the actual data. That's why we should never create indexes "in advance." Instead, we should only create them when we see a real performance problem.

Exercise
Click to continue.



