Although adding indexes can help optimize the performance of your queries, adding indexes has a significant cost on MySQL performance.
In fact, when an index is added to a table, the performance of the writing is affected. Let me show you this from the music_album table. By examining the definition of the current table, you will notice a large number of indexes:
By performing a simple benchmarking test, we can test the insertion rate of the current music album table with the original definition that included fewer indexes:
The following are the test results:
Did you notice that inserting data into the table with additional indexes was four times slower?
This test is quite basic and there are, of course, several other elements that can negatively affect insertion speed, but it provides a clear example of...