You later post shows an oddity:
|* 3 | TABLE ACCESS BY INDEX ROWID | EXT_T | 29528 | 1614K| 1344 (0)| 00:00:19 |
| 4 | DOMAIN INDEX | EXT_TEXT_IND | | | 13441 (0)| 00:03:09 |
Was there really a cost of 13441 for the index but only 1344 for the table, or was this a copying error?
Jonathan,
the TIME column suggests that it is coincidence but the real cost (19 secs. to 189 secs., 1344 to 13441 single block reads as cost).
It's quite hard to give you good advice for dealing with this example since it's mixing domain indexes and query rewrite and that's a rare option. One (short-term) option would be to try disable index joins - either with an alter session command, or with the hint opt_param('_index_join_enabled','false')
Is this really query rewrite? I thought that query rewrite shows up as "MAT_VIEW
REWRITE ACCESS" operation in the plan, but I'm not entirely sure if this is correct in all cases.
Why disable the index join option when this seems to be the "good" plan?
To the OP:
- How do you analyze the tables and what do you mean by "not having statistics"?
- Can you show us the exact command used to analyze and the command to get rid of the statistics?
- Does the execution "without" statistics show the usage of dynamic sampling in the "Notes" section?
- Can you trace the SQL execution or use DBMS_XPLAN.DISPLAY_CURSOR with STATISTICS_LEVEL = ALL or the GATHER_PLAN_STATISTICS hint to get a clearer understanding where estimate for the cheaper plans goes wrong, i.e. where the majority of the 6 minutes is spent?
- You might want to run Alberto Dell'Era's
XPLAN tool on your statement which offers some comprehensive output regarding the most important information used by the optimizer, although I'm not sure how it is going to deal with domain indexes.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/
Edited by: Randolf Geist on Jul 1, 2009 10:34 PM
Some suggestions added