Mysql Query consumes cpu time. help me to see how to optimize this mysql structure $ sqll & nbsp ;=& nbsp; "SELECT & nbsp; * & nbsp; FROM & nbsp; 'shops' & nbsp; WHERE & nbsp; 'subdomain '& nbsp ;! = Mysql queries cpu consumption time. let's see how to optimize the mysql structure.
$ Sqll = "SELECT * FROM 'shops' WHERE 'subdomain '! = ''Order by rand () LIMIT 15 ";
Only this query is used. for subdomain queries, the mysql cpu time is very high. Sina's app requires money. I don't know how to optimize it to reduce the mysql cpu time. is it necessary to create an index? How should I create it? Why can we optimize the primary key?
Below is the structure
------ Solution --------------------
Try to create an index for the subdomain field. I don't know if I can use the index. Try it yourself.
------ Solution --------------------
You do not need to add any indexes. you can add the index fields.
------ Solution --------------------
Useful for adding an index to subdomain
The primary key automatically generates a unique index.
------ Solution --------------------
RAND () does not use this function to generate random numbers.