PLSQL _ Statistical Information Series 2 _ errors in program performance (CASE) and plsql statistics

Source: Internet
Author: User

PLSQL _ Statistical Information Series 2 _ errors in program performance (CASE) and plsql statistics

Created By BaoXinjian

I. Summary

In a stable database with performance, all jobs must be completed within a certain period of time.

In the past, in a banking system, a job was originally completed in 30minutes, but after 3hours, it was still running

Excluding the impact of data size changes, you need to check whether the parsing plan of the program is changed. In a stable system, the explain plan corresponding to the job is usually fixed through sqlplan management and rarely changed.

Check whether the sqlplan explain corresponding to the job changes.

In general, changes to the resolution plan will also cause such problems.

 

Ii. Solution

Step 1. view the corresponding session of the program

select sid, sql_id from v$session where sid = 1001

Step2. view the SQL statement currently running the corresponding session

select b.begin_interval_time, 
a.disk_reads_total,
a.buffer_gets_total,
a.buffer_gets_delta,
a.rows_processed_total,
a.plan_hash_value from dba_hist_sqlstat a, dba_hist_snapshot b where a.snap_id = b.snap_id
and sql_id = '466bpq7055f4c'
order by 1 desc;

Step3. check whether the resolution plan corresponding to the long-running SQL statement has been changed during this period.

select* from v$sql_plan

Step 4. view the statistical time of the table

select name, last_analized from dba_tables

Step 5. generate statistical information for the table

exec dbms_stats.gather_table_stats(
ownname=>'SCOT',
tabname=>'GAVIN',
estimate_percent=>3,
degree=>32,
granularity=>'GLOBAL',
cascade=>FALSE,
no_invalidate=>FALSE);

Thanks and Regards

 

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.