Solved

Analyze Table in Oracle

Posted on 2009-04-14
6
937 Views
Last Modified: 2012-05-06
Hi,
   When i analyze the table with below command, the table is getting analyzed. I want to know the corresponding index also got analyzed or not?

 DBMS_STATS.gather_table_stats ('XXQP', 'XXQP_SAMPLE', estimate_percent => 30);

Thanks
0
Comment
  • 4
  • 2
6 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 24138206
by default NO, indexes are not gathered with table stats.

However, in 10g and above the default is configurable
you can check the default with this in 10g and above

BEGIN
    IF DBMS_STATS.to_cascade_type(DBMS_STATS.get_param('CASCADE'))
    THEN
        DBMS_OUTPUT.put_line('indexes gathered with table stats');
    ELSE
        DBMS_OUTPUT.put_line('indexes NOT gathered with table stats');
    END IF;
END;
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 24138224
In 8i and 9i the default is always FALSE for "cascade"
0
 

Author Comment

by:Suriyaraj_Sudalaiappan
ID: 24138875
Hi,
  I have oracle 10g and i am running the your code. It is returning 'indexes NOT gathered with table stats'.
How?

Thanks
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 74

Accepted Solution

by:
sdstuber earned 125 total points
ID: 24138909
"How?"  what are you asking?


The output means your default has not been modified.
So indexes are not gathered when you gather table stats unless you override that default.

set cascade  TRUE if you want to gather indexes when you gather tables

DBMS_STATS.gather_table_stats ('XXQP', 'XXQP_SAMPLE', estimate_percent => 30, cascade=>TRUE);

0
 

Author Closing Comment

by:Suriyaraj_Sudalaiappan
ID: 31569865
GOOD ONE
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 24146860
glad I could help
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question