In operator
The advantage of using in-write SQL is that it is easier to write and understand, which is more suited to the style of modern software development. However, in SQL performance is always lower, the steps that are performed from Oracle analyze the following differences between SQL in in and No in SQL: Oracle attempts to convert it to multiple table connections, and if the conversion is unsuccessful, execute the subquery in inside and query the outer table record. If the conversion succeeds, the query is directly connected by multiple tables. This shows that in the SQL at least one more conversion process. Normal SQL can be converted successfully, but for SQL that contains packet statistics, it cannot be converted.
Recommended scenario: Try not to use the in operator in business-intensive SQL.
Not in operator
This action is recommended by the strong column because it does not apply the index of the table.
Recommended scheme: Replace with notexists or (outer join + null-judged) scheme
<> operator (not equal to)
Not equal to the operator is never used in the index, so processing it will only produce a full table scan.
Recommended solution: Replace with other operations with the same function, such as
A<>0 change to a>0 or a<0
A<> ' changed to A> '
IsNull or Isnotnull action (determines whether the field is empty)
Determining whether a field is empty generally does not apply the index because the B-tree index is not indexed for null values.
Recommendation: Replace with other operations of the same function, such as aisnotnull change to a>0 or a> '. The field is not allowed to be empty and a default value is substituted for the null value, such as the Status field in the industry expansion request is not allowed to be null, and the default is the application. Create a bitmap index (a partitioned table is not built, bitmap index is more difficult to control, such as the field value too many indexes can degrade performance, many people update operation will increase the phenomenon of block lock)
The
> < operator (greater than or less than operator)
is greater than or less than the operator is normally not adjusted, because it has an index, it uses an index lookup, but in some cases it can be optimized, such as a table with 1 million records, a numeric field A, 300,000 recorded a= 0, 300,000 records of the A=1,39 million records of the a=2,1 million recorded a=3. The effect of performing a>2 and a>=3 is very different, because Oracle will first find the record index of 2 and then compare it to the A>2, while Oracle can find the =3 record index directly when a>=3. The LIKE operator
the LIKE operator can apply wildcard queries, where the wildcard combination can be almost arbitrary, but if poorly used, it can create performance problems, such as the kind '%5400% ' query that does not refer to the index, as the ' x5400% ' The range index is referenced. A practical example: Use the yw_yhjbqk of the business number in the table to query the business number Yy_bhlike '%5400% ' This condition will produce a full table scan, if converted to Yy_bhlike ' x5400% ' oryy_bhlike ' ' b5400% ' The YY_BH index is used to make two-range queries, and the performance is certainly greatly improved.