You are on page 1of 1

Issue : One Report taking more execution time,

Till yesterday It taken 2 mins of execution time


But today onwards it taking 20 mins for execution(to display the output )

REason / cause :
-------------------
: Query is the data source of report
Query Contains multiple tables ,
Any of one table may required Gather table stats.

sOLUTION :
fIND THE TABLE WHICH REQUIRED GATHER TABLE STATS ?

SELECT * fROM ALL_TAB_sTATISTICS WHERE STALE_STATS= 'YES';

EXECUTE THE GATHER TABLE STATS TO THE TABLE/ TABLES :


-------------------------------------------------------

Begin
Dbms_stats.gather_table_stats('HR','STAT_TEST');
End;
/

---------------------------

What is gather table stats ?


----------------------------------
Select * From Employees ;

Create table stat_test (a number ) ;

insert into stat_test Select level From Dual connect by level <=10;

sELECT * fROM stat_test;

Commit ;

Select * From user_Tables Where Table_name = 'STAT_TEST';

Begin
Dbms_stats.gather_table_stats('HR','STAT_TEST');
End;
/

sELECT * fROM USER_TAB_COLUMNS ;

SELECT * fROM ALL_TAB_sTATISTICS WHERE STALE_STATS= 'YES';

You might also like