What should be paid attention to in query optimization of big data in mysql
Notes for big data query optimization in mysql: 1. To optimize the query, try to avoid full table scanning; 2. Try to avoid judging the null value of the field in the where clause; 3. in and Not in should also be used with caution; 4. Try to avoid using or to connect in the where clause; 5. Try to avoid using cursors. The method of big data query optimization in mysql: 1. To optimize the query, you should try your best To avoid full table scans, first consider building indexes on the columns involved in where and order by. 2. You should try to avoid judging the null value of the field in the where clause, otherwise it will cause the engine to give up using the index and perform a full table scan, such as: select id from t where num is null can be in num Set the default value to 0, make sure there is no null value in the num column in the table, and then query like this: select id from t where num=0 3. Try to avoid using the != or operator in the where clause, otherwise the engine will give up using…