Home > database >  MYSQL index failure problem
MYSQL index failure problem

Time:04-26

This is my table structure



This is my SQL query



I created a cover index



Again the query SQL



Index did not effective, no matter how I create index, cannot take effect, is this why?

CodePudding user response:

Your query index with you, have what relation?

Index is speed up the process of screening data records, not accelerate the return to the field to select

If you are not used in the query condition index, then the index has nothing to do with you this query

CodePudding user response:

Your query to the view field as sort, the original view field to establish index and some use, but you should give this index to cover off,,,,

CodePudding user response:

Index to associated with your query to use,

1. Where the back of the field;
2. The order by the back of the field;
The two more important,
If you want to a bit better, can be covered again behind the select field,
But this will cause increase space utilization, you need to balance for big table,

In addition to screening sex stronger fields will have effect,
For example:
Find out the whole of China all men, so that is very difficult, you the isDeleted, is actually built also useless,
But:
Find the id number is: XXXX yyyy ZZZZ person, very fast,

In simple terms, one is to you, or even one thousand one, is the appropriate indexes fields,
How not to do?
That is to find a way to create conditions,

In front-end search, for example: mandatory input date/time, because most of the business and the date is relevant,
On the date/time index, the effect is very good,



  • Related