1. Table name Order: does not affect the business logic case, the general case of large table in the left, the small table in the right; the crosstab appears above the three tables, then the cross table is in front.
2.WHERE clause order: Execution sequence Oracle from right to left, the efficiency is basically the same;
The right table condition of the 3.JOIN table is written as far as possible on, not after where (note: There is a difference between using a left connection);
4. The joins of several large tables should be paged and concatenated as far as possible;
5. Avoid full table scan:
5.1 Avoid function or expression operations on indexed columns;
5.2 The index column is preferably not a null column, using is NOT NULL never uses an indexed column, and is null is sometimes not used;
5.3 Avoid using <>! = does not equal the operator, it restricts the index and causes the full table query;
5.4 '%a% ', '%A ' does not use the index, ' A% ' uses the index;
5.5 Non-indexed columns using an OR query can result in a full table query;
5.6 Using not in does not use the index, with not EXISTS or (outer join + condition) substitution;
6. Avoid using "*" in the query results, substituting count (0) for Count (*);
7. Use the table alias to avoid the same column query errors.
8. Using >= instead of >; A1 = a2*100 Alternative A1/a2=100;datetime =to_char (' 20121122 ', ' YYYYMMDD ') Replace To_char (datetime, ' yyyymmdd ') = ' 20121122 '
9. Replace or with union; exists (or outer joins) replace in; (note: In the number if the char<100,int<1000 effect can be, otherwise you have to use other alternative);
Partial SQL Optimizations