1,索引:
exec dbms_stats.gather_table_stats(ownname=>'ETL',tabname=>'f_p10ids_classcode_l');
analyze index index1 validate structure:
analyze index index1 compute statistics:
2, 谓词上移 & 谓词下推 predicate push
相关文章 :
a, http://wenku.baidu.com/view/4702ae1aff00bed5b9f31ddc.html
b, http://blog.nominet.org.uk/tech/2006/01/31/view-predicate-pushing/
c , http://www.easyora.net/blog/push_predicate_sql_tuning.html
d, http://blogs.oracle.com/optimizer/2011/01/basics_of_join_predicate_pushdown_in_oracle.html
e, CBO hint:no_unnest,push_subq,push_pred的用法 http://www.itpub.net/viewthread.php?tid=1308385
3, table join :
key: SEMI
4,分析函数:
select address ,disk_reads ,executions ,100 * ratio_to_report(disk_reads) over() pct from sys.v_$sql where command_type != 47 and parsing_schema_name = 'CCFRAME_APP' order by disk_reads desc ;
5 ,使用如下语句,查出此时,系统消耗多的SQL
-- ETL drop table temp_v$sql ; create table temp_v$sql ( SQL_ID VARCHAR2(30), SQL_TEXT VARCHAR2(1000), EXECUTIONS VARCHAR2(30), PARSE_CALLS VARCHAR2(30), DISK_READS VARCHAR2(30), BUFFER_GETS VARCHAR2(30), USER_IO_WAIT_TIME VARCHAR2(30), ROWS_PROCESSED VARCHAR2(30), CPU_TIME VARCHAR2(30), ELAPSED_TIME VARCHAR2(30), TYPE VARCHAR2(30), DTTM DATE ) ; grant select,insert,update,delete on temp_v$sql to ccframe_app ; -- CCFRAME delete from etl.temp_v$sql ; COMMIT; insert into etl.temp_v$sql select SQL_ID ,MAX(SQL_TEXT) SQL_TEXT ,sum(EXECUTIONS) EXECUTIONS ,sum(PARSE_CALLS) PARSE_CALLS ,sum(DISK_READS) DISK_READS ,sum(BUFFER_GETS) BUFFER_GETS ,sum(USER_IO_WAIT_TIME) USER_IO_WAIT_TIME ,sum(ROWS_PROCESSED) ROWS_PROCESSED ,sum(CPU_TIME) CPU_TIME ,sum(ELAPSED_TIME) ELAPSED_TIME ,'before' ,sysdate from sys.v_$sql where command_type != 47 and parsing_schema_name = 'CCFRAME_APP' group by SQL_ID ; commit; insert into etl.temp_v$sql select SQL_ID ,MAX(SQL_TEXT) SQL_TEXT ,sum(EXECUTIONS) EXECUTIONS ,sum(PARSE_CALLS) PARSE_CALLS ,sum(DISK_READS) DISK_READS ,sum(BUFFER_GETS) BUFFER_GETS ,sum(USER_IO_WAIT_TIME) USER_IO_WAIT_TIME ,sum(ROWS_PROCESSED) ROWS_PROCESSED ,sum(CPU_TIME) CPU_TIME ,sum(ELAPSED_TIME) ELAPSED_TIME ,'after' ,sysdate from sys.v_$sql where command_type != 47 and parsing_schema_name = 'CCFRAME_APP' group by SQL_ID ; commit; select * from (select bef.sql_id ,bef.SQL_TEXT ,aft.executions - bef.executions executions ,trunc((100 * ratio_to_report(aft.executions - bef.executions) over()),2) pct_executions ,aft.parse_calls - bef.parse_calls parse_calls ,trunc((100 * ratio_to_report(aft.parse_calls - bef.parse_calls) over()),2) pct_parse_calls ,aft.disk_reads - bef.disk_reads disk_reads ,trunc((100 * ratio_to_report(aft.disk_reads - bef.disk_reads) over()),2) pct_disk_reads ,aft.buffer_gets - bef.buffer_gets buffer_gets ,trunc((100 * ratio_to_report(aft.buffer_gets - bef.buffer_gets) over()),2) pct_buffer_gets ,aft.user_io_wait_time - bef.user_io_wait_time user_io_wait_time ,trunc((100 * ratio_to_report(aft.user_io_wait_time - bef.user_io_wait_time) over()),2) pct_io_wait_time ,aft.rows_processed - bef.rows_processed rows_processed ,trunc((100 * ratio_to_report(aft.rows_processed - bef.rows_processed) over()),2) pct_rows_processed ,aft.cpu_time - bef.cpu_time cpu_time ,trunc((100 * ratio_to_report(aft.cpu_time - bef.cpu_time) over()),2) pct_cpu_time ,aft.elapsed_time - bef.elapsed_time elapsed_time ,trunc((100 * ratio_to_report(aft.elapsed_time - bef.elapsed_time) over()),2) pct_elapsed_time from etl.temp_v$sql bef, etl.temp_v$sql aft where bef.sql_id = aft.sql_id and bef.type = 'before' and aft.type = 'after') tt order by elapsed_time desc; --SQL ordered by Elapsed Time order by cpu_time desc; --SQL ordered by CPU Time order by buffer_gets desc ;-- SQL ordered by Gets order by disk_reads desc ; -- SQL ordered by Reads order by executions desc ; -- SQL ordered by Executions order by parse_calls desc; --SQL ordered by Parse Calls
6 常用AIX命令:
ls | awk '{print "du -sm "$1}' | sh