Oracle Performance tuning-Histogram

Source: Internet
Author: User

The maximum and minimum values of Histogram are oracle internal. The values queried by SQL select are encrypted.

For example, all_tab_cols.low_value and all_tab_cols.high_value store the maximum and minimum values of a field in a table. However, if you select the field directly, it is a password and cannot be read.

Oracle provides two methods to solve the problem of reading the maximum and minimum values:

1. utl_raw package

2. dbms_stats package

The following is an application of the utl_raw package. dbms_stats must be called using pl/SQL, so we haven't studied it yet:

Select *
From
(Select owner, table_name, column_name, data_type,
Low_value,
Decode (DATA_TYPE,
'Clob', UTL_RAW.CAST_TO_VARCHAR2 (LOW_VALUE ),
'Blob ', UTL_RAW.CAST_TO_VARCHAR2 (LOW_VALUE ),
'Number', utl_raw.cast_to_number (low_value ),
'Char ', utl_raw.cast_to_varchar2 (low_value ),
'Varchar2', utl_raw.cast_to_varchar2 (low_value ),
'Date', to_date ('01-may-11', 'dd-MON-YYYY '),
Utl_raw.cast_to_varchar2 (low_value) as low_value_text,
High_value,
Decode (data_type,
'Clob', utl_raw.cast_to_varchar2 (high_value ),
'Blob ', UTL_RAW.CAST_TO_VARCHAR2 (high_value ),
'Number', UTL_RAW.CAST_TO_NUMBER (high_value ),
'Char ', UTL_RAW.CAST_TO_VARCHAR2 (high_value ),
'Varchar2', UTL_RAW.CAST_TO_VARCHAR2 (high_value ),
'Date', TO_DATE ('01-JUN-11 ', 'dd-MON-YYYY '),
UTL_RAW.CAST_TO_VARCHAR2 (high_value) AS high_VALUE_TEXT
From all_tab_cols
Where owner = 'SC' and (table_name = 'activitym1 'or table_name = 'propsummarya2' or table_name = 'propsummarym1 ')
)

The Owner and table_name In the instance are all in the self-developed database, not required

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.