There are three final objectives for writing SQL statements: 1. fast response time 2. Minimum CPU resources and 3 minimum I/O operations
Tips for promoting the best SQL
* From the I/O perspective, full table scanning is encouraged when indexes are meaningless.
If index scan accesses more blocks than full table scan, full table scan is very effective.
* If SQL contains subqueries, optimize them. in fact, they should be optimized first. if the subquery cannot be executed well, the primary query cannot be executed well. if a connection provides the subquery function, you should first try the connection method before trying to use the subquery method. note that subqueries are associated because they are expensive and frequently used by the CPU.
* Use not exists to replace not in the where condition of an SQL statement.
* Use the like operator with leading characters to replace the substr function. The like operator with leading characters (for example, 'a % 'in the compared value) will use indexes.
The substr function will invalidate the index, unless the database version is Oracle8i and a function-based index has been created.
-- Unfinished --