How to correctly analyze Oracle database models, tables, and indexes

Source: Internet
Author: User
In Oracle databases, we often need to manually analyze tables and indexes, as well as all tables and indexes in a certain mode. Oracle provides two Analysis Methods: db

In Oracle databases, we often need to manually analyze tables and indexes, as well as all tables and indexes in a certain mode. Oracle provides two Analysis Methods: db

In Oracle databases, we often need to manually analyze tables and indexes, as well as all tables and indexes in a certain mode. Oracle provides two Analysis Methods: The dbms_stats package and the analyze command. These are our practical methods in daily project management for reference.

Analyze all objects of a user in 10 Gb, such as user_miki.

Sys. dbms_stats.gather_schema_stats (ownname => 'user _ miki ', estimate_percent => 30, method_opt =>' for all indexed columns size auto', cascade => true, options => 'gather ');

This is an analysis method for analyzing all objects of a user in the project. The sampling ratio is 30%. It analyzes all index fields, generates column charts, and also analyzes indexes.

Analyze a table and its indexes under a user at 10 Gb, such as the info table and its indexes under user_miki.

Execute dbms_stats.gather_table_stats (ownname => 'user _ miki ', tabname => 'info', estimate_percent => 30, method_opt =>' for all indexed columns size auto ');

This is an analysis method for a single user table in the project. The sampling ratio is 30%. It analyzes all index fields, generates column charts, and also analyzes indexes.

We can also see the method of using the analzye command analysis table at google.
Analyze table table_name compute statistics;
This will analyze the index and table together;
Analyze table table_name compute statistics for table;
This is only an analysis table;
Analyze table table_name compute statistics for all columns;
This is only an analysis table, and all the above fields generate a column chart
Analyze table table_name compute statistics for all indexed columns;
This is only an analysis table, and all the indexed fields above generate a column chart
In 9i, we often use the analyze method. After 10 Gb, we changed it to a package similar to dbms_stats.gather_schema_stats to analyze database objects.
The 10g analytics function package is more flexible than the 9i analyze method.
In 10 Gb, there will be a scheduled task for the system. The new database objects and the database objects that it considers to have expired the statistical information will be automatically analyzed every 10 and two days of the weekend. This analysis result is sometimes unreliable.
Therefore, I use the dbms_stats.gather_schema_stats method provided in 10 Gb as a supplement to set a scheduled task to periodically analyze all database objects under the Business User.

For more information about Oracle, see the Oracle topic page? Tid = 12

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.