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.
  • 相关阅读:
    django之表多对多查询
    Django之ORMselect_related和prefetch_related
    django中用户登入时初始化session中保存的数据
    django中间件判断用户有无权限访问当前的url
    django中自定议rbac权限model类
    django中的inclusion_tag配置和实现
    docker命令
    JS设置cookie、读取cookie、删除cookie
    MySQL Community Downloads
    44个CSS3制作的形状图形
  • 原文地址:https://www.cnblogs.com/arcer/p/3116030.html
Copyright © 2011-2022 走看看