One of the most important requirements to achieve optimal performance from the MySQL database is indexing. Indexing is an internal MySQL feature that allows rapid data collection.
We see an example of a common term called "sample" with only two rows - "number" and "employee". If you execute a simple query like:
SELECT * FROM example WHERE number = 4;
MySQL will check all records and only return the one that has its value given number to 4 If you have 1 million entries, for example, this will be a slow query. In this case we have a single field - "number". Therefore, we can create an index for it. Indexing will create an internal record that is saved in the MySQL service. This can be done with the following query:
ALTER TABLE example Add INDEX (number);
Once Once this index is established, the next time you want to obtain information for employee number 4, the service will go directly to it using the index and will return the information much faster.
This is just one example very basic. For larger databases, the difference in load time can be significant. Database indexing can significantly reduce the loading time of Web applications.
Knowledgebase
- 0 Users Found This Useful