zoukankan      html  css  js  c++  java
  • OCP-1Z0-053-V12.02-165题

    165.View the Exhibit exhibit1.

    In the CUSTOMERS_OBE table, when the value of CUST_STATE_PROVINCE is "CA", the value of COUNTRY_ID is "US."

    View the Exhibit exhibit2 to examine the commands and query plans. The optimizer can sense 8 rows

    instead of 29 rows, which is the actual number of rows in the table. What can you do to make the

    optimizer detect the actual selectivity?

    A. Change the STALE_PERCENT value for the CUSTOMERS_OBE table.

    B. Set the STATISTICS_LEVEL parameter to TYPICAL.

    C. Create extended statistics for the CUST_STATE_PROVINCE and CUSTOMERS_OBE columns.

    D. Set the OPTIMIZER_USE_PENDING_STATISTICS parameter to FALSE.

    Answer: C

    答案解析:

     参考:http://docs.oracle.com/cd/E11882_01/server.112/e41573/stats.htm#PFGRF94728

    Managing Extended Statistics

    DBMS_STATS enables you to collect extended statistics, which are statistics that can improve cardinality estimates when multiple predicates exist on different columns of a table, or when predicates use expressions. An extension is either a column group or an expression.

    Oracle Database supports the following types of extended statistics:

    • Column group statistics

      This type of extended statistics can improve cardinality estimates when multiple columns from the same table occur together in a SQL statement. See"Managing Column Group Statistics".

    • Expression statistics

      This type of extended statistics improves optimizer estimates when predicates use expressions, for example, built-in or user-defined functions. 


    Managing Column Group Statistics

    When the WHERE clause of a query specifies multiple columns from a single table (multiple single column predicates), the relationship between the columns can strongly affect the combined selectivity for the column group.

    For example, consider the customers table in the sh schema. The columns cust_state_province and country_id are related, with cust_state_provincedetermining the country_id for each customer. Suppose you query the customers table where the cust_state_province is California:

    SELECT COUNT(*)
    FROM   sh.customers
    WHERE  cust_state_province = 'CA';

    The preceding query returns the following value:

    COUNT(*)
    ----------
        3341

    Adding an extra predicate on the country_id column does not change the result when the country_id is 52790 (United States of America). Assume that you run the following query:

    SELECT COUNT(*)
    FROM   customers
    WHERE  cust_state_province = 'CA'
    AND    country_id=52790;

    The preceding query returns the same value as the previous query:

    COUNT(*)
    ----------
        3341

    Assume that the country_id has a different value, such as 52775 (Brazil), as in the following query:

    SELECT COUNT(*)
    FROM   customers
    WHERE  cust_state_province = 'CA'
    AND    country_id=52775;

    In this case the returned value is as follows:

    COUNT(*)
    ----------
           0

    With individual column statistics, the optimizer has no way of knowing that the cust_state_province and the country_id columns are related. By gathering statistics on these columns as a group (column group), the optimizer has a more accurate selectivity value for the group, instead of having to generate the value based on the individual column statistics.

    You can create column groups manually by using the DBMS_STATS package. You can use this package to create a column group, get the name of a column group, or delete a column group from a table.


     
  • 相关阅读:
    【前端进阶】VUE高性能组件引用
    「前端进阶」高性能渲染十万条数据(虚拟列表) (自己修改版本)
    页面缓存、离线存储技术localforage(案例篇)
    页面缓存、离线存储技术localforage(介绍篇)
    websocket快速搭建(node+websocket)
    一款程序员的杀手级应用:TabNine代码补全工具
    如何把es6的代码转成es5,ECMAScript 2015+代码转换神器——Babel
    如何使用echarts画一个简单k线图
    深入浅出理解 . 深拷贝 . 浅拷贝
    JS高级一看就懂什么是原型链
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13316520.html
Copyright © 2011-2022 走看看