![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have 3 tables which are always queried together and joined on the same key. The common wisdom tells me that an index cluster is adequate for such situation. The performance of the application did improve as a result. The problem is with analyzing the cluster. DBMS_STATS cannot do that: * 1 *select object_type from dba_objects * 2* where owner= 'UAT_INSIGHT4' and object_name='TAG_CLU' SQL> / OBJECT_TYPE ------------------- CLUSTER Elapsed: 00:00:00.14 begin DBMS_STATS.GATHER_TABLE_STATS ( * *ownname => 'UAT_INSIGHT4', * *tabname => 'TAG_CLU', * *estimate_percent => 10, * *method_opt => 'FOR TABLE FOR ALL INDEXED COLUMNS SIZE 254', * *degree *=> 4,UE); => 4, * *cascade => TRUE); end; / * 8 * *9 * 10 *begin * ERROR at line 1: ORA-20000: Unable to analyze TABLE "UAT_INSIGHT4"."TAG_CLU", insufficient privileges or does not exist ORA-06512: at "SYS.DBMS_STATS", line 15017 ORA-06512: at "SYS.DBMS_STATS", line 15049 ORA-06512: at line 2 Elapsed: 00:00:00.10 SQL> show user USER is "SYSTEM" SQL SQL> analyze cluster uat_insight4.tag_clu * 2 *estimate statistics sample 5 percent * 3 *for table for all indexed columns size 254; Cluster analyzed. Elapsed: 00:00:28.92 SQL The plain, old "ANALYZE" works like a charm. It seems that our weekly stats, which runs *dbms_stats.gather_database_stats_job_proc doesn't doa swell job with clusters. It seems that all clusters are simply left out from the list of objects for which the statistics is collected. I did have a problem with one plan, because of the incorrect statistics. So, ladies and gentlemen, you'll have to set up a job that will analyze your clusters manually. --http://mgogala.byethost5.com |
#3
| |||
| |||
|
|
Not sure if your cut/paste was wrong or you actually have a type-o in your code, but the error points to this line: |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
The plain, old "ANALYZE" works like a charm. It seems that our weekly stats, which runs dbms_stats.gather_database_stats_job_proc doesn't do a swell job with clusters. It seems that all clusters are simply left out from the list of objects for which the statistics is collected. I did have a problem with one plan, because of the incorrect statistics. So, ladies and gentlemen, you'll have to set up a job that will analyze your clusters manually. |
#6
| |||
| |||
|
|
The plain, old "ANALYZE" works like a charm. It seems that our weekly stats, which runs *dbms_stats.gather_database_stats_job_proc doesn't doa swell job with clusters. It seems that all clusters are simply left out from the list of objects for which the statistics is collected. I did have a problem with one plan, because of the incorrect statistics. So, ladies and gentlemen, you'll have to set up a job that will analyze your clusters manually. |
#7
| |||
| |||
|
|
Can you tell us your database version? I couldn't reproduce on 10.2.0.5. |
|
Both GATHER_SCHEMA_STATS as well as the GATHER_DATABASE_STATS_JOB_PROC happily analyzed all relevant objects including the cluster index. The staleness of the cluster index is determined by the staleness of any of the member tables of the cluster, so if at least one table is determined to be stale then the cluster index is also re-analyzed. Note that DBMS_STATS actually leaves out the CLUSTER object itself which is analyzed by ANALYZE but the CBO does not seem to use the statistics generated by ANALYZE on the cluster itself. The relevant statistics for some operations like NESTED LOOP joins using the cluster index in the inner row source are taken from the cluster index itself, so as long as this is analyzed that should be fine. |
#8
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |