1. *(all) 를 가급적 지양하고 필요한 컬럼만 기술하여 사용하자.
Use:
SELECT customer_id, last_name, first_name, street, city FROM customer;
Rather than,
SELECT * FROM customer;
2. 부정비교 보다는 비교연산으로 대체하여 사용하자.
Use:
SELECT client, date, amount FROM sales WHERE amount > 0;
Rather than:
SELECT client, date, amount FROM sales WHERE amount != 0;
Use:
SELECT account_name, trans_date, amount FROM transaction WHERE amount > 0;
Rather than:
SELECT account_name, trans_date, amount FROM transaction WHERE amount NOT=0;
!=, <>, ^= 중에 아무거나 사용해도 상관 없긴 하나 어쩔수 없이 사용해야 한다면 <> 를 권고.
UNION 보다는 UNION ALL이 더 낫고,
필터 조건의 왼쪽을 가공 연산하지 않고,
DATA NULL 처리는 집계함수(COUNT, SUM, MIN 등)와 결합해서 어떻게 사용할지 등의 자료
참고Site)
https://www.linkedin.com/pulse/oracle-sql-tuning-tips-mahesh-birajdar
Oracle SQL Tuning Tips
consideration when writing an SQL statement is that it returns a correct result. The second is that it be the most efficient for a given situation.
www.linkedin.com
시간이 많이 흘렀고,
인터넷에 찾아보면 수 많은 자료가 있으므로...