General Step:
- Generate explain plan for the SQL queries
- Interpret the explain plan to identify the performance bottlenecks
- Act by using right technique to improve the performance
Rule #1: If its linked by it, filtered by it, or sorted by it…index by it.
Technical list:
- select column instead of all (avoid full table scanning)
-
- add index & partition (pruning)
- pre-join data instead of joining same table repeatedly
- minimize the use of distinct
- Predicate pushdown (e.g. instead of having)
- Use wildcards at the end of a phrase only
- avoid using many OR for large dataset
- avoid too many join
- limit the row being return
- sort data when needed
- watch the execution plan (and statistic like disk, memory, network, process time, size)