Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Does MySQL indexes speed up new data aswell

From my understanding, adding an index on a MySQL column speeds up requests using this column in the where clause by creating a brand new table. So select become faster but insert/modify become slower because there are now two tables to insert data into but in my case it’s not even relevant.

Am I then right assuming that any new data in that table will be retrieved faster aswell?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

UPDATE and DELETE have WHERE clauses too. If you want your change to be applied to a specific row, it improves performance if that row can be found using an index, instead of forcing the UPDATE or DELETE to scan the entire table.

Indexes are kept in sync with all the rows.* So if you define an index for the table, any subsequent INSERT/UPDATE/DELETE changes entries in the index. Thus new rows also benefit from the performance improvement.


* Some other brands of SQL database have "partial indexes" that apply only to a subset of the rows of a table, but MySQL doesn’t have this feature.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading