Mysql – Why and how to index a MySQL database

indexMySQL

How to do indexing and what is the use? Please explain in such way so I can use it practically.

Best Answer

Indexing can have several purposes: - Access your data faster and to accelerate the execution time of your queries - Define the degree of uniqueness of a given column: Should every field be unique? Are duplicates allowed?

When you send a request to your MySQL server, it is first assigned to the "parser" SQL which aims to verify the syntax of your request is correct.After that, the request goes through "optimizer" to determine the query execution plan so that it runs as fast as possible.

Optimizer detects whether any indexes are available, if this is the case he decides to use it ... or not: it is sometimes faster to not use an index! .. when an index has a big size than original table.
more information
You can find How to create and manage indexes here :
how to do indexing in mysql