• [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.
  • 相关阅读:
    time 时间模块的函数调用
    str 文本函数的调用
    批量分发公钥
    K8s集群部署(四)------ Flannel网络部署
    kuberbetes基础概念
    K8s集群部署(三)------ Node节点部署
    K8s集群部署(二)------ Master节点部署
    K8s集群部署(一)------ETCD集群部署
    日常更新脚本
    CentOS7系统安装
  • 原文地址:https://www.cnblogs.com/arcer/p/3116030.html
Copyright © 2020-2023  润新知