Oracle's SQL statement optimization
Optimization of SQL statements
1. The Oracle optimizer cannot use indexes when using is NULL or is not NULL in the WHERE clause.
2. For connected columns, even if the most one is a static value, the optimizer does not use indexes such as: SELECT * from Employss where first_name| | "| | Last_name= ' Beill Cliton ' to be written: SELECT * from Employss where first_name= ' Beill ' and last_name= ' Beill Cliton ' then Oracle uses the base Index in Last_Name
3. Wildcard characters (%) Like statements such as: SELECT * from the employee where last_name '%cliton% '; % at the beginning of the word the Oracle system cannot use the last_name index; select * FROM employee where last_name like ' cliton% '
4:order by any non-indexed item or expression in the order BY statement will reduce the query efficiency;
5:not $amp;<amp; $gt; is equivalent to not p= "" When Oracle Encounters "not, he stops using the index instead of performing a full-table scan. <=" "not produces the same effect as using functions on an indexed column. =" " ① and ② query results are the same, but ② allows Oracle to use indexes on salary columns, high efficiency = "<3000=" "salary=" "or=" ">3000=" "from=" "*=" "select= amp;<amp; $gt; 3000;= "" ①= ">
6:exist instead of in-not exist instead of in-select * from A where-ID in (select-ID from B) the above query uses the in statement, in () executes only once, it detects all the ID fields in table B and caches them. After that, check that the ID of table A is equal to the ID in table B, and if it is equal, add the records of table A to the result set until all records of table A are traversed. exist performs more efficiently than in
7:
Order of 8.where conditions
9:union All and UNION
Oracle's SQL statement optimization