zoukankan      html  css  js  c++  java
  • [bbk5333] 第80集 第10章 SQL Performance 01

    AWR能够帮助DBA识别占用资源最多的SQL语句.

    SQL Tune Advisor执行步骤

    1. 捕获到占用资源较多的SQL
    2. Advisor对捕获到的、占用资源较多的SQL进行分析
    3. Advisor产生建议的SQL
    4. 执行实施SQL

    SQL Tuning Advisor:Overview

    Automatic SQL Tuning:Overview

    • Automatic SQL Tuning automates the entire SQL tuning process and replaces manual SQL tuning.
    • Optimizer modes:
      • Normal modes:
      • Tuning mode or Automatic Tuning Optimizer(ATO)
    • SQL Tuning Advisor is used to access tuning mode.
    • You should use tuning mode only for high-load SQL statements.

    Application Tuning Challenges

    Stale or Missing Object Statistics

    • Object statistics are key inputs to the optimizer
    • ATO verifies object statistics for each query object.
    • ATO uses dynamic sampling and generates:
      • -Auxiliary object statistics to compensate for missing or stale object statistics
      • -Recommendations to gather object statistics where appropriate:
    DBMS_STATS.GAHTER_TABLE_STATS(
    
    ownname=>'SH',tablename=>'CUSTOMERS',estimate_percent=>DBMS_STATS.AUTO_SAMPLE_SIZE
    
    );

    SQL Statement Profiling

    • Statement statistics are key inputs to the optimizer.
    • ATO verifies statements statistics such as :
      • Predicate selectivity
      • Optimizer settings(FIRST ROWS versus ALL_ROWS)
    • Automatic Tuning Optimizer uses
      • Dynamic samling
      • Partial execution of the statement
      • Past execution history statistics of the statment
    • ATO builds a profile if statistics were generated:
    EXEC :profile_name := DBMS_SQLTUNE.accept_sql_profile(task_name => 'my_sql_tuning_task');
    View Code

    Plan Tuning Flow and SQL Profile Creation

    Using the SQL Tuning Advisor

    • Use the SQL Tuning Advisor to analyze SQL statements and obtain performance recommendations.
    • Sources for SQL Tuning Advisor to analyze:
      • -Top Activity:Analyzes the top SQL statements currently active.
      • -SQL Tuning Sets:Analyzes a set of SQL statements you provide.
      • -Historical SQL(AWR):Analyzes SQL statements from statements collected by AWR snapshots.
  • 相关阅读:
    设计模式(23)>解释器模式 小强斋
    设计模式(21)>享元模式 小强斋
    访问者模式与双分派 小强斋
    将BMP格式的灰度图像或24位真彩图像二值化
    如何使用自定义Title
    ACM. Digital Roots
    jpegEncode
    ACM.Ones
    剩余定理
    ACM.DNA Sorting
  • 原文地址:https://www.cnblogs.com/arcer/p/3116030.html
Copyright © 2011-2022 走看看