zoukankan      html  css  js  c++  java
  • Oracle Performance TuningTips for Avoiding Problematic Queries(转载至databasejournal)

    声明:本文为转载,如果有侵犯知识版权,请通知本人,本人将即刻停止侵权行为:

    转载网址:http://www.databasejournal.com/features/oracle/article.php/3548291/Oracle-Performance-Tuning-150-Part-1.htm

    Oracle Performance Tuning - Part 1

    17 Tips for Avoiding Problematic Queries

    The source of these 17 tips is from Oracle9i Performance Tuning: Optimizing Database Productivity by Hassan Afyouni (Thompson Course Technology, 2004). These tips provide a solid foundation for two outcomes: making a SQL statement perform better, and determining that nothing else can be done in this regard (i.e., you have done all you can with the SQL statement, time to move on to another area).

    The 17 tips are listed below.

    1.  Avoid Cartesian products,避免笛卡尔积
    2.  Avoid full table scans on large tables,避免对大的表进行全表扫描
    3.  Use SQL standards and conventions to reduce parsing,使用标准规则的SQL,减少不必要的SQL解析(指定SQL的规则,要么大写,要么小写)
    4.  Lack of indexes on columns contained in the WHERE clause,没有索引的列包含在where子句中。
    5.  Avoid joining too many tables,避免连接过多的表
    6.  Monitor V$SESSION_LONGOPS to detect long running operations,查询V$SESSION_LONGOPS视图,检测运行长时间的操作。
    7.  Use hints as appropriate,在合适的时候使用hint(优化hint)
    8.  Use the SHARED_CURSOR parameter,使用shared_cursor参数
    9.  Use the Rule-based optimizer if I is better than the Cost-based optimizer,使用RBO愚弱他的效率高于CBO(在10以及后续的版本,已经抛弃了RBO,改用了基于成本的CBO)
    10. Avoid unnecessary sorting,避免不必要的排序
    11. Monitor index browning (due to deletions; rebuild as necessary)监控index的状态,主要是因为删除,在必要的时候,进行索引的重建
    12. Use compound indexes with care (Do not repeat columns),小心的使用联合索引,避免重复的列
    13. Monitor query statistics,监控查询统计信息。
    14. Use different tablespaces for tables and indexes (as a general rule; this is old-school somewhat, but the main point is reduce I/O contention)对表和索引使用不同的表空间,(作为一个基本的准则,索然有点老,但是最主要的是,他可以减少I/O的争用)
    15. Use table partitioning (and local indexes) when appropriate (partitioning is an extra cost feature),在必要的时候,对表和本地的索引,进行合适的分区。
    16. Use literals in the WHERE clause (use bind variables),在where子句中使用绑定变量
    17. Keep statistics up to date,时刻更新统计资料,使优化器总能够得到得到最新的统计信息,便于给出最新的执行计划。

        That is quite a list and overall is thorough and accurate. Step 9, referring to the use of the Rule-based optimizer, may cause a reliance or dependency on a feature Oracle has identified as a future item to be deprecated. You are eventually going to have to solve the problem using the CBO, so you may as well start now and forget about the RBO. Step 14 should be changed to something along the lines of "reduce I/O contention" instead of its currently stated "separate index and table tablespaces" guidance.

  • 相关阅读:
    P1092 虫食算
    P1040 加分二叉树
    cfER76 abcd
    cf599 div2 a/b1/b2/c
    AtCoder Contest 144 DE
    Round G 2019
    luogu3084 Photo 单调队列优化DP
    luogu4234 最小差值生成树
    luogu1373 小a和uim之大逃离
    luogu1070 道路游戏 单调队列
  • 原文地址:https://www.cnblogs.com/caroline/p/2678177.html
Copyright © 2011-2022 走看看