Pay attention to the following points when using the SQL statement:
1. Avoid using incompatible data types. For example, Float and Integer, Char and Varchar, Binary, and long binary are not compatible. The incompatibility of data types may enable optimizers to fail to perform some optimized operations. E.g:
SELECT EMP_NAME FORM EMPLOYEE WHERE SALY> 3000;
If Saliff is a float type, the optimizer is difficult to optimize because 3000 is an integer, and we should use 3000.0 to make DBMS to transform when programming.
2, try not to use expressions, because it is unable to get it, SQL can only use its average density to estimate the number of records that will hit.
3. Avoid using other mathematical operators for search parameters. Such as:
SELECT EMP_NAME FROM EMPLOYEE WHERE SALY * 12> 3000;
Should be changed to:
SELECT EMP_NAME FROM EMPLOYEE WHERE SALY> 250;
4. Avoid using the operators such as! = Or <>, because it will not use the index without using the index, but can only search the data in the table.