Oracle Database Performance Optimization general rule:
One, reduce data access (reduce the number of drive room visits)
Second, return less data (reduce network transmission or disk access)
Third, reduce the number of interactions (reduce network transmission)
Iv. reduced server overhead (reduced CPU and memory overhead)
V. Utilization of additional resources (increased resources)
=================== Specific Instructions =================
One, reduce data access (reduce the number of drive room visits)
1. Reduce data access
1.1. Create and use the correct index
Indexes can greatly increase the overhead of DML (pruning) "a reasonable index will greatly increase the efficiency by 100 times times, 1000 times times, but unreasonable indexes will even degrade performance by 100 times Times"
There can be multiple indexes in a table, and an index can consist of multiple fields
When the index is used:
Index_column>?
index_column<?
Index_column=?
Index_column>=?
Index_column<=?
Index_columnbetween? and?
Index_columnin (?,?...?)
Index_columnlike? | | % ' (back-guided blur query)
t1.index_column= t2.culunm2 (two tables are associated by an indexed field)
Conditions that do not use the index:
Index_column<>?
Index_columnnot in (?,?...?)
--------------not equal to not using the index
function (index_column) =?
Index_column+1=?
index_column| | ' AAA ' =?
--------------fields that pass normal or function operations do not use indexes
Index_columnis NULL
----------------Index does not hold null values so is NULL does not use the index
Index_column= ' 12345 '
index_column=12345
--------------Oracle converts the left and right sides into the same type when a numeric comparison is performed, which is equivalent to using a function. Do not use indexes
a.index_column= a.column_!
The value--------to the index query should be known, and the unknown is not to use the indexed
Common Indexing considerations:
You need to add an index:
1. Primary key
2. Foreign key
3. Fields with object or identity meaning
Use the index carefully:
1. Date
2. Month
3. Status identification
4. Regional
5. Operation Personnel
6. Value
7, long characters
Not suitable for indexed
1. Describe the Memo field
2, large print paragraph
Other than that:
Several query fields that are often used together can create a composite index
such as: Select Id,name from company where type= ' 2 ';
If you use this frequently, you can create a composite index on id,name,type;
Remember: Performance optimization is endless. When you meet the requirements, do not extremes meet
Second, less return data
1, Data paging processing (client paging, server paging, database paging)
2. Return only required fields
Third, reduce the number of interactions (batch commit, increase fech_size, use stored procedures)
To be continued-------learning progress together