MySQL common SQL optimization, mysqlsql
Avoid using where as much as possible! = Or <> operator. Otherwise, full table query is performed.
For queries that avoid full scanning, consider creating an index on the columns involved in where or order.
Avoid null Value Determination in where; otherwise, full table scan is performed.
When querying, do not * query all, specify as required
Use In and not in with caution. Otherwise, full table scan may occur.
Do not write meaningless queries
When creating an index, it depends on the situation. It is recommended that there be no more than 6 indexes in a table.
Try to use varchar to replace char
Use table variables instead of temporary tables whenever possible
Avoid returning big data to the client. If the data volume is too large, consider whether the corresponding requirements are reasonable.
Avoid large transaction operations and improve system concurrency