Domain index query takes 12 hours to execute

Hi Friends,
My query which uses domain index takes 12 hours to execute. Can you please help me tuning this query?
select /*+ NO_UNNEST ORDERED index_ffs(Term idx_recanon_term_ysm1) parallel_index(Term, idx_recanon_term_ysm1, 8) */ term.rowid
from cmpgn.recanon_search_terms,cmpgn.recanon_term_ysm Term
where cmpgn.recanon_search_terms.search_type=3 and
contains(Term.RAW_TERM_TEXT,cmpgn.recanon_search_terms.search_text) > 0 and
Term.pod_id=11
Thanks in advance.
Regards
Bala

First your driving table is recanon_search_terms to get the required search terms, then use them to query Oracle Text. What you are trying to do is to get a subset of table term first and than run every individual row of table term against the search terms. This approach will take a very long time.
Not sure what you want to do, but it looks something I have been working on previously. As far I can see there is a table with controlled terms which are matched against other raw terms in a text document using Oracle Text. The issue is that you do a join in the contains clause without knowing the number of query expressions formed. It can be that 7 thousand individual queries run at once, than use indexes of the other predicates, do some sorting, etc. which would explain the long time needed. It will probably run out of memory causing all sorts of issues.
As a quick fix try first following statement without hints.
Tell us how many rows you get, the distinct counts for pod_id and search_type and how long it takes.
CREATE TABLE test_table AS
select term.pod_id pod_id, cmpgn.recanon_search_terms.search_type search_type, term_primary_key, ....
from cmpgn.recanon_search_terms,cmpgn.recanon_term_ysm Term
where contains(Term.RAW_TERM_TEXT,cmpgn.recanon_search_terms.search_text) > 0
Create index test_idx on test_table(pod_id, search_type) and use test_table instead to get the results, just by providing pod_id and search_type without the join in the contains clause.
SELECT ..
FROM test_table
WHERE pod_id = X
AND search_type = Y
Maybe this approach is sufficient for your purpose. For sure, it will give you instant results. In that case a materialized view instead of the table could work for maintenance reasons; I had some issues with materialized views for above scenario.
However check very carefully the results. I would have some doubts that all rows in search_text form a valid query expression for Oracle Text. If search_text has just single tokens or phrases wrapping curly brackets around will probably resolve the issue.
Think about to form one query expression through a function call instead of a table join inside the contains clause. Sometimes to run a set of individual queries are faster than one big query.
select term.rowid --, form_query_exrpession(3) query_exrpession
from cmpgn.recanon_term_ysm Term
where contains(Term.RAW_TERM_TEXT, form_query_exrpession(3)) > 0
The above function will form one valid Oracle Text query expression by using the table recanon_search_terms inside the function. This approach normally helps, at least in debugging and fine-tuning. Avoid using bind variables first in order to identify highly skewed distribution of search_type.
The other performance issue is the additional predicate of pod_id = X, here the suggestion from radord works very well. If you want to get your hands dirty have a look at user_datastore in the Oracle Text documentation, this will give you all the freedom you want.

Similar Messages

  • Local Domain Index  query fails with ora-01410: invalid rowid

    Hello!
    I have a task to implement partitioned domain index for range partitioned table.
    As I understood from reference http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28425/dom_idx.htm
    the main difference is to provide support for partitioning operations by
    implementing corresponding ODCI interface functions.
    For the first I decided to create something simple to not spend time on system partitioned
    index storage table. My problem is that domain index works correctly when it's created without
    support for partitioning and produces "*ORA-01410: INVALID ROWID*" when it's created
    with LOCAL option.
    Test query:
    SELECT /* +index(from_sample_index) */ * FROM index_in_partitioned_tbl WHERE position_between(card_no)  < 50 ORDER BY card_no DESC;
    Index creared in this way returns 3 rows:
    CREATE INDEX from_sample_index ON index_in_partitioned_tbl (card_no) INDEXTYPE IS position_indextype;
    When index has been creared with LOCAL option I got "ORA-01410: INVALID ROWID" :
    CREATE INDEX from_sample_index ON index_in_partitioned_tbl (card_no) INDEXTYPE IS position_indextype LOCAL;
    I don't post implementation's source code to reduce amount of text in post. It works for global index.
    If I copy rowid from index storage table and then put it into something like
    SELECT card_no FROM index_in_partitioned_tbl WHERE rowid = 'AAAXHGAAEAAAFERAAh';
    then it will be executed successfully without any errors.
    I suppose the error could be somehow linked with "alter index" calls that Oracle makes when local domain index is created.
    The calls are made with option "AlterIndexRebuild" - possibly they mark index as invalid (though it's shown as valid in SQL Developer)

    Solved :)
    when index is LOCAL calls for ODCIINDEXSTART - ODCIINDEXFETCH - ODCIINDEXCLOSE are executed for each partition of base table.
    In my case ODCIINDEXFETCH returns row_id's regardless of partition that are currently scanned for values. So first call returned rowid values for all partitions not only for the first partition and validation failed with "ora-01410: invalid rowid"

  • Query takes time to execute

    I am creating a jsp application . . . .I am retreiving some values from my database oracle 10g..my query taking time to execute even in isql plus..am uisng tomcat5 and oracle 10gR2..can anyone pls tell me why it happens...my query fetches data from four tables...i dont know exactly why its taking so muc time say 50seconds...when i run the application in my local host it retrievs fast when i do that in server it creates a problem..
    Actually it works fine when i deployed in my client server it takes time sometimes it takes atmost one minute
    1.pls tell me how can i test my query about the performance
    2.is der any command in oracle to test
    3.how much bytes it takes

    Look at this thread...
    When your query takes too long ...

  • Query takes time to execute. Review this query and give me a possible quere

    SELECT DISTINCT A.REFERENCE_NUMBER
    FROM A,B,C
    WHERE DF_N_GET_CONTRACT_STATUS (A.REFERENCE_NUMBER, TRUNC (SYSDATE)) = 1
    AND ( B.CHQ_RTN_INDICATOR IS NULL AND B.CHALLAN_NUMBER IS NULL
    AND C.INSTRUMENT_TYPE IN (1, 2) AND C.MODULE_CODE = 5 )
    AND ( A.HEADER_KEY = B.HEADER_KEY AND C.HEADER_KEY = B.HEADER_KEY);
    This query takes 3 minutes to execute. I want to improve the performance so that it can execute with in seconds.
    Table A has 10 lakhs record.
    Table B has 3.7 lakhs record.
    Table C has 5.3 lakhs record. Consider DF_N_GET_CONTRACT_STATUS as function. REFERENCE_NUMBER is the type of Varchar2(20).
    Plz give me a correct logical and fastest execution query for the same.
    Thanks in advance.

    I would agree with the post from Santosh above that you should review the guidelines for posting a tuning request. This is VERY important. It is impossile to come up with any useful suggestions without the proper information.
    In the case of your query, I would probably focus my attention on the function that you have defined. What happens if the condition using the DF_N_GET_CONTRACT_STATUS function is removed? Does it still take 3 minutes?
    SELECT reference_number
    from (
      SELECT DISTINCT A.REFERENCE_NUMBER
      FROM A,B,C
      WHERE ( B.CHQ_RTN_INDICATOR IS NULL AND B.CHALLAN_NUMBER IS NULL
      AND C.INSTRUMENT_TYPE IN (1, 2) AND C.MODULE_CODE = 5 )
      AND ( A.HEADER_KEY = B.HEADER_KEY AND C.HEADER_KEY = B.HEADER_KEY)
    where DF_N_GET_CONTRACT_STATUS(reference_number, trunc(sysdate)) = 1;Of course, the query above really depends on the cardinality of the returned data..... which is impossible to know without following the posting guidelines. This query could return anywhere between 0 rows and 2x10^17 rows. And in the latter case evaluating the function at the end wouldn't make any difference.
    Also, do you really need the distinct? Does it make any difference? Most of the time that I see distinct, to me it either means the query is wrong or the data model is wrong.

  • Query takes forever to execute

    This query executes forever:
    select count(*)
    from VIEW_DOCUMENT
    where exists
    select VIEW_DOCUMENT_ITEM.documentID
    from VIEW_DOCUMENT_ITEM
    where VIEW_DOCUMENT_ITEM.documentID=VIEW_DOCUMENT.documentID
    Here's what's inside VIEW_DOCUMENT_ITEM:
    select *
    from DOCUMENT_ITEM
    join VIEW_USER
    If I replace "join VIEW_USER" with "join USER" the query executes normally in few seconds!
    This makes no sense because here's what's in VIEW_USER:
    select * from USER
    Does anybody know what are possible causes for this strange behaviour?

    Actually my query is much more complex, this is simplified version.
    In original query it's 100% not cartesian join.
    Result of my query is 2710 and result of Sven's query is 2711.
    My question is only why does joining a table work normally and why does joining a view "select * from table" take forever.
    I can't see execution plan because my query never ends. I have to kill the Linux process.
    Here is TKPROF output, I don't know what this stuff means:
    TKPROF: Release 10.2.0.1.0 - Production on Tue Mar 4 14:21:57 2008
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Trace file: orcl_ora_29715.trc
    Sort options: prsela  exeela  fchela 
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    alter session set sql_trace true
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        1      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 64 
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        1      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse       58      0.00       0.01          0          0          0           0
    Execute    308      0.05       0.06          0          0          0           0
    Fetch      758      0.03       0.16         38       1188          0        2086
    total     1124      0.10       0.24         38       1188          0        2086
    Misses in library cache during parse: 13
    Misses in library cache during execute: 13
        1  user  SQL statements in session.
      308  internal SQL statements in session.
      309  SQL statements in session.
    Trace file: orcl_ora_29715.trc
    Trace file compatibility: 10.01.00
    Sort options: prsela  exeela  fchela 
           1  session in tracefile.
           1  user  SQL statements in trace file.
         308  internal SQL statements in trace file.
         309  SQL statements in trace file.
          14  unique SQL statements in trace file.
        3007  lines in trace file.
           0  elapsed seconds in trace file.

  • ? about domain index build

    My db version is 9.0.1.4
    I have production issue that I need to resolve. My issue is i have to rebuild domain index on table. This table contains over 10000 rows of clob data which contains column that im trying to build domain index. This domain index build takes over 20 hours to run though. In addition, no dml insert can take place against table where domain index build does occur....
    My question is: If I run domain index build statement with nopopulate clase then do a sync against domain index will users be allowed to do dml inserts against table ?

    Intermedia text is now Oracle text. Oracle text has it's own forum. The text people do not monitor this forum. Please ask your question in the Oracle Text Forum. You will get a quicker, more expert answer there.
    Thanks,
    Larry

  • Query takes large time to execute

    Hi,
    These are interview questions:
    1. If the query takes lot of time to execute, what should be the preliminary analysis done by a DBA
    2. If we have system, users, rollback and temporary tablespaces, 2 disks disk1 and disk2, how should the tablespaces be distributed on the disks
    I am interested to know the answers. Kindly respond
    Thanks and Regards
    Sumit Sharma

    2. If we have system, users, rollback and temporary tablespaces, 2 disks disk1 and disk2, how should the tablespaces be distributed on the disks
    2 disk are not enough for a good distribution but however you could the best possible with that.
    Really the optimal distribution of disk must be so:
    DISK1: Tablespaces of data, One Controlfile, Redo Logs ( 1 member per group )
    DISK2: Redo Logs ( 1 member per group ), One Controlfile
    DISK3: Tablespaces for Indexes, Redo Logs ( 1 member per group ), One Controlfile
    DISK4: Archives, Rollback Segments
    Joel Pérez
    http://otn.oracle.com/experts

  • What is the reason for query take more time to execute

    Hi,
    What is the reason for the query take more time inside procedure.
    but if i execute that query alone then it excute within a minutes.
    query includes update and insert.

    I have a insert and update query when I execute
    without Procedure then that query execute faster but
    If I execute inside procedure then It takes 2 hours
    to execute.Put you watch 2 hours back and the problem will disappear.
    do you understand what I want to say?I understood what you wanted to say and I understood you didn't understood what I said.
    What does the procedure, what does the query, how can you say the query does the same as the procedure that takes longer. You didn't say anything useful to have an idea of what you're talking about.
    Everyone knows what means that something is slower than something else, but it means nothing if you don't say what you're talking about.
    To begin with something take a look at this
    When your query takes too long ...
    especially the part regarding the trace.
    Bye Alessandro

  • Urgen!! Query takes lots of time to execute and the production is in effect

    Hi,
    We have some data loading script. This scripts takes lots of time to execute. As Iam new to tunning please do let me know what is the wrong with the query !!
    Thanks In advance
    Query:
    =========
    INSERT /*+ PARALLEL */ INTO ris.ris_pi_profile
    (ID,COUNTRY_OF_CITIZENSHIP,IMMIGRATION_STATUS,SSN,DOB,GENDER,
    ETHNICITY,RACE,DEPARTMENT,DIVISION,INSTITUTION_ID,INST_EMAIL,EFFECT_DATE,ACADEMIC_TITLE,ACADEMIC_POSITION,
    OTH_PER_DATA,PCT_RESEARCH,PCT_TEACHING,PCT_CLINICAL,PCT_ADMIN,PCT_OTHER,PCT_TRAINING)
    SELECT
    ap.id,
    p.citizen_cd,
    decode(p.visa_cd,'CV',0,'F1',1,'H1',2,'H1B',3,'H2',4,'J1',5,'J2',6,'O1',7,'PR',8,'PRP',9,'TC',10,'TN',11,'TNN',12),
    (select n.soc_sec_num from sa.name n where n.name_id = p.name_id),
    (select n.birth_date from sa.name n where n.name_id = p.name_id),
    (select decode(n.gender_cd,'F',1,'M',2,0) from sa.name n where n.name_id = p.name_id),
    (select decode(n.ethnic_cd,'H',1) from sa.name n where n.name_id = p.name_id),
    (select decode(n.ethnic_cd,'A',2,'B',3,'I',1,'P',4,'W',5) from sa.name n where n.name_id = p.name_id),
    a.dept_name,
    a.div_name,
    a.inst_id,
    (select n.email from sa.name n where n.name_id = p.name_id),
    a.eff_date,
    ac.acad_pos_desc,
    p.acad_pos_cd,
    0,
    p.research_pct,
    p.teach_pct,
    p.patient_pct,
    p.admin_pct,
    p.other_pct,
    p.course_pct
    FROM
    appl1 ap,
    sa.personal_data p,
    sa.address a,
    sa.academic_pos_cd ac,
    profile_pi f
    WHERE
    p.project_role_cd='PI'
    and ap.appl_id=f.appl_id
    and p.appl_id=f.appl_id
    and p.name_id=f.name_id
    and a.addr_id=f.addr_id
    and p.acad_pos_cd=ac.acad_pos_cd
    AND EXISTS (select 1 from ris.ris_institution i WHERE i.id = a.inst_id)
    AND EXISTS (select 1 from sa.academic_pos_cd acp WHERE acp.acad_pos_cd = p.acad_pos_cd);
    In the execution PLan I see lots of Nested loop, Hash Join
    Index( Unique scan)
    Table Access by ( Index rowid)
    This query is fast in Test DB but ver very slow in prod DB. Need your help Urgent.
    Minaz

    When your query takes too long...
    When your query takes too long ...

  • Exchange Server Information Store has encountered an error while executing a full-text index query

    Hi Team need help
    Exchange 2013 EAC doesnt show the databases and it gives message
    "Your request couldn't be completed. Please try again in a few minutes."
    Its a 9 Node DAG and I stopped and diabled Search and Search Host controller on all of them
    in the event viewer see a lot of Event id 1012
    Log Name:      Application
    Source:        MSExchangeIS
    Date:          4/1/2013 9:23:48 AM
    Event ID:      1012
    Task Category: General
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      ex1301.dagdc.com
    Description:
    Exchange Server Information Store has encountered an error while executing a full-text index query ("and(or(itemclass:string("IPM.Note*", mode="and"), itemclass:string("IPM.Schedule.Meeting*", mode="and"), itemclass:string("IPM.OCTEL.VOICE*",
    mode="and"), itemclass:string("IPM.VOICENOTES*", mode="and")), subject:string("SearchQueryStxProbe*", mode="and"), folderid:string("48A300C7FBA4DA408B80EB019A1CE94900000000000E0000"))"). Error
    information: System.TimeoutException: Failed to open a channel.
       at Microsoft.Exchange.Search.OperatorSchema.PagingImsFlowExecutor.ExecuteServiceCall(IProcessingEngineChannel& serviceProxy, Action`1 call, Int32 retryCount)
       at Microsoft.Exchange.Search.OperatorSchema.PagingImsFlowExecutor.ExecuteSearchFlow(String flowName, Dictionary`2 inputData)
       at Microsoft.Exchange.Search.OperatorSchema.PagingImsFlowExecutor.<ExecuteInternal>d__18.MoveNext()
       at Microsoft.Exchange.Search.OperatorSchema.PagingImsFlowExecutor.<ExecuteSimple>d__a.MoveNext()
       at Microsoft.Exchange.Server.Storage.FullTextIndex.FullTextIndexQuery.ExecutePagedFullTextIndexQuery(Guid databaseGuid, Guid mailboxGuid, Int32 mailboxNumber, String query, CultureInfo culture, Guid correlationId, QueryLoggingContext loggingContext,
    PagedQueryResults pagedQueryResults)
       at Microsoft.Exchange.Server.Storage.StoreCommonServices.StoreFullTextIndexHelper.ExecuteFullTextIndexQuery(Context context, MailboxState mailboxState, QueryParameters queryParameters, PagedQueryResults pagedQueryResults, ExchangeId searchFolderId,
    SearchExecutionDiagnostics diagnostics)
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="MSExchangeIS" />
        <EventID Qualifiers="49156">1012</EventID>
        <Level>2</Level>
        <Task>1</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2013-04-01T16:23:48.000000000Z" />
        <EventRecordID>192599</EventRecordID>
        <Channel>Application</Channel>
        <Computer>ex1301.dagdc.com</Computer>
        <Security />
      </System>
      <EventData>
        <Data>and(or(itemclass:string("IPM.Note*", mode="and"), itemclass:string("IPM.Schedule.Meeting*", mode="and"), itemclass:string("IPM.OCTEL.VOICE*", mode="and"), itemclass:string("IPM.VOICENOTES*",
    mode="and")), subject:string("SearchQueryStxProbe*", mode="and"), folderid:string("48A300C7FBA4DA408B80EB019A1CE94900000000000E0000"))</Data>
        <Data>System.TimeoutException: Failed to open a channel.
       at Microsoft.Exchange.Search.OperatorSchema.PagingImsFlowExecutor.ExecuteServiceCall(IProcessingEngineChannel&amp; serviceProxy, Action`1 call, Int32 retryCount)
       at Microsoft.Exchange.Search.OperatorSchema.PagingImsFlowExecutor.ExecuteSearchFlow(String flowName, Dictionary`2 inputData)
       at Microsoft.Exchange.Search.OperatorSchema.PagingImsFlowExecutor.&lt;ExecuteInternal&gt;d__18.MoveNext()
       at Microsoft.Exchange.Search.OperatorSchema.PagingImsFlowExecutor.&lt;ExecuteSimple&gt;d__a.MoveNext()
       at Microsoft.Exchange.Server.Storage.FullTextIndex.FullTextIndexQuery.ExecutePagedFullTextIndexQuery(Guid databaseGuid, Guid mailboxGuid, Int32 mailboxNumber, String query, CultureInfo culture, Guid correlationId, QueryLoggingContext loggingContext,
    PagedQueryResults pagedQueryResults)
       at Microsoft.Exchange.Server.Storage.StoreCommonServices.StoreFullTextIndexHelper.ExecuteFullTextIndexQuery(Context context, MailboxState mailboxState, QueryParameters queryParameters, PagedQueryResults pagedQueryResults, ExchangeId searchFolderId,
    SearchExecutionDiagnostics diagnostics)</Data>
        <Binary>5B444941475F4354585D000084000000FF09000000000000000268000000808A00100000000080CA00100000000080B200100000000080D200100000000030FF001000000000309F00100000000030DF001000000000B09D001000000000B0DD001000000000B0ED001000000000B08D001000000000B095001000000000B0A5001000000000</Binary>
      </EventData>
    </Event>

    Hi,
    Please reenable and start the search engine service and try again.
    The simillar case for your reference:
    http://social.technet.microsoft.com/Forums/en-US/exchangesvrgeneral/thread/4f43ef50-b71f-4ab3-8ced-70f1c36c5509
    Hope it is hlepful.
    Fiona Liao
    TechNet Community Support

  • How can i know which index will be used when executing the query ?

    1 ) I have query in which i have 3-4 tables but there multiple index on one column .
    so how can i know which index will be used when executing the query ?
    2) I have a query which ia taking too much time . how can i know which table is taking too much time ?
    3) Please Provide me some document of EXplain plan ?

    Hi Jimmy,
    Consider the below example
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    CREATE TABLE FIRST AS
    SELECT * FROM all_objects;
    UPDATE FIRST
    SET object_name = 'TEST'
    WHERE owner != 'SCOTT';
    CREATE INDEX idx_first ON FIRST(object_name);
    SELECT *
    FROM FIRST
    WHERE object_name = 'TEST';
    It has not used index
    Execution Plan
    Plan hash value: 2265626682
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 58678 | 7334K| 163 (4)| 00:00:02 |
    |* 1 | TABLE ACCESS FULL| FIRST | 58678 | 7334K| 163 (4)| 00:00:02 |
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    SELECT *
    FROM FIRST
    WHERE object_name = 'emp';
    This has used the index
    Execution Plan
    Plan hash value: 1184810458
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 128 | 1 (0)| 00:00:01 |
    | 1 | TABLE ACCESS BY INDEX ROWID| FIRST | 1 | 128 | 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | IDX_FIRST | 1 | | 1 (0)| 00:00:01 |
    From this we can come to the conclusion that, whether to use one index or not by oracle
    would also depend on the data which is present in the table. This has to be this way as
    we see in the bind peeking, if oracle sticks to only one plan, say only use the full table
    scan, it would be a performance hit when it searches for the second query ie where object_name
    ='emp';
    2.
    If we have a query like below.
    select * from emp
    where upper(ename) = upper(:p_ename);
    Evenif we have the index on ename column, oracle wouldn't be able to use the index, as there is a function in the predicate column. If you need oracle to use the index, we need to create a function based index as below.
    Create index idx_ename on emp(upper(ename));
    Regards,
    Cool

  • A query takes 7 hours to complete (0 rows rturned)

    Hi all,
    This query takes 7hours to complete since I migrated from 10g to 11g.
    SELECT /*+ gather_plan_statistics */ T.OWNER, T.TABLE_NAME
        FROM (  SELECT DISTINCT COFIR FROM DBAUSR_TT) U, VDBSTA S, DBA_TABLES T
       WHERE     S.COFIR = U.COFIR
             AND S.CTTAB = 'T'
             AND T.OWNER = S.COFIR
             AND T.TABLE_NAME = S.COTAB
             AND T.TEMPORARY = 'N'
             AND (T.LAST_ANALYZED IS NOT NULL
                  OR EXISTS
                        (SELECT 1
                           FROM DBA_TAB_STATISTICS A
                          WHERE     A.OWNER = T.OWNER
                                AND A.TABLE_NAME = T.TABLE_NAME
                                AND NVL (A.STATTYPE_LOCKED, '*') != 'ALL')
                  OR EXISTS
                        (SELECT 1
                           FROM DBA_INDEXES I
                          WHERE     I.TABLE_OWNER = T.OWNER
                                AND I.TABLE_NAME = T.TABLE_NAME
                                AND I.LAST_ANALYZED IS NOT NULL))
    ORDER BY 1, 2;
    SQL> select * from table(dbms_xplan.display_cursor(NULL,NULL,'last iostats'));
    PLAN_TABLE_OUTPUT
    SQL_ID  f3bzgtgudc0cd, child number 0
    SELECT /*+ gather_plan_statistics */ T.OWNER, T.TABLE_NAME     FROM (
    SELECT DISTINCT COFIR FROM DBAUSR_TT) U, VDBSTA S, DBA_TABLES T
    WHERE     S.COFIR = U.COFIR          AND S.CTTAB = 'T'          AND
    T.OWNER = S.COFIR          AND T.TABLE_NAME = S.COTAB          AND
    T.TEMPORARY = 'N'          AND (T.LAST_ANALYZED IS NOT NULL
      OR EXISTS                     (SELECT 1                        FROM
    DBA_TAB_STATISTICS A                       WHERE     A.OWNER = T.OWNER
                               AND A.TABLE_NAME = T.TABLE_NAME
                   AND NVL (A.STATTYPE_LOCKED, '*') != 'ALL')
    OR EXISTS                     (SELECT 1                        FROM
    DBA_INDEXES I                       WHERE     I.TABLE_OWNER = T.OWNER
                              AND I.TABLE_NAME = T.TABLE_NAME
                  AND I.LAST_ANALYZED IS NOT NULL)) ORDER BY 1, 2
    Plan hash value: 291652704
    | Id  | Operation                               | Name                      | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
    |   0 | SELECT STATEMENT                        |                           |      1 |        |      0 |00:07:55.28 |      73M|     54M|
    |   1 |  SORT ORDER BY                          |                           |      1 |      1 |      0 |00:07:55.28 |      73M|     54M|
    |*  2 |   FILTER                                |                           |      1 |        |      0 |00:07:55.28 |      73M|     54M|
    |   3 |    NESTED LOOPS OUTER                   |                           |      1 |      1 |   2726 |00:00:05.37 |   17301 |    766 |
    |   4 |     NESTED LOOPS OUTER                  |                           |      1 |      1 |   2726 |00:00:05.37 |   17298 |    766 |
    |   5 |      NESTED LOOPS OUTER                 |                           |      1 |      1 |   2726 |00:00:05.37 |   16604 |    756 |
    |   6 |       NESTED LOOPS OUTER                |                           |      1 |      1 |   2726 |00:00:05.37 |   16604 |    756 |
    |   7 |        NESTED LOOPS                     |                           |      1 |      1 |   2726 |00:00:05.37 |   12998 |    619 |
    |   8 |         NESTED LOOPS                    |                           |      1 |      1 |   2726 |00:00:05.37 |   10268 |    619 |
    |*  9 |          HASH JOIN                      |                           |      1 |      1 |   2726 |00:00:00.27 |    5329 |     11 |
    |* 10 |           HASH JOIN                     |                           |      1 |      4 |   5909 |00:00:00.18 |    5323 |      9 |
    |* 11 |            HASH JOIN                    |                           |      1 |    207 |   3296 |00:00:00.02 |    4152 |      0 |
    |  12 |             MERGE JOIN CARTESIAN        |                           |      1 |     10 |      4 |00:00:00.02 |       3 |      0 |
    |* 13 |              HASH JOIN                  |                           |      1 |      1 |      1 |00:00:00.02 |       0 |      0 |
    |* 14 |               FIXED TABLE FULL          | X$KSPPI                   |      1 |      1 |      1 |00:00:00.01 |       0 |      0 |
    |  15 |               FIXED TABLE FULL          | X$KSPPCV                  |      1 |    100 |   2044 |00:00:00.01 |       0 |      0 |
    |  16 |              BUFFER SORT                |                           |      1 |     10 |      4 |00:00:00.01 |       3 |      0 |
    |  17 |               VIEW                      |                           |      1 |     10 |      4 |00:00:00.01 |       3 |      0 |
    |  18 |                HASH UNIQUE              |                           |      1 |     10 |      4 |00:00:00.01 |       3 |      0 |
    |  19 |                 TABLE ACCESS FULL       | DBAUSR_TT                 |      1 |     10 |     10 |00:00:00.01 |       3 |      0 |
    |  20 |             VIEW                        | VDBSTA                    |      1 |   2065 |   3296 |00:00:00.01 |    4149 |      0 |
    |  21 |              UNION-ALL                  |                           |      1 |        |   3296 |00:00:00.01 |    4149 |      0 |
    |  22 |               NESTED LOOPS              |                           |      1 |   1433 |    187 |00:00:00.01 |    1617 |      0 |
    |  23 |                MERGE JOIN CARTESIAN     |                           |      1 |   1717 |   1740 |00:00:00.01 |      18 |      0 |
    |* 24 |                 TABLE ACCESS FULL       | USEUBX                    |      1 |      1 |      1 |00:00:00.01 |       3 |      0 |
    |  25 |                 BUFFER SORT             |                           |      1 |   1717 |   1740 |00:00:00.01 |      15 |      0 |
    |* 26 |                  TABLE ACCESS FULL      | STATAB                    |      1 |   1717 |   1740 |00:00:00.01 |      15 |      0 |
    |* 27 |                INDEX UNIQUE SCAN        | TABCOM1                   |   1740 |      1 |    187 |00:00:00.01 |    1599 |      0 |
    |  28 |               HASH UNIQUE               |                           |      1 |    610 |   3106 |00:00:00.02 |    2499 |      0 |
    |  29 |                NESTED LOOPS ANTI        |                           |      1 |   3294 |   3106 |00:00:00.01 |    2499 |      0 |
    |  30 |                 MERGE JOIN CARTESIAN    |                           |      1 |   3434 |   3480 |00:00:00.01 |      18 |      0 |
    |* 31 |                  TABLE ACCESS FULL      | USEUBX                    |      1 |      2 |      2 |00:00:00.01 |       3 |      0 |
    |  32 |                  BUFFER SORT            |                           |      2 |   1717 |   3480 |00:00:00.01 |      15 |      0 |
    |* 33 |                   TABLE ACCESS FULL     | STATAB                    |      1 |   1717 |   1740 |00:00:00.01 |      15 |      0 |
    |* 34 |                 INDEX UNIQUE SCAN       | TABCOM1                   |   2634 |     58 |    301 |00:00:00.01 |    2481 |      0 |
    |  35 |               HASH UNIQUE               |                           |      1 |     14 |      0 |00:00:00.01 |      15 |      0 |
    |  36 |                MERGE JOIN CARTESIAN     |                           |      1 |     14 |      0 |00:00:00.01 |      15 |      0 |
    |* 37 |                 TABLE ACCESS FULL       | STATAB                    |      1 |      5 |      0 |00:00:00.01 |      15 |      0 |
    |  38 |                 BUFFER SORT             |                           |      0 |      3 |      0 |00:00:00.01 |       0 |      0 |
    |* 39 |                  TABLE ACCESS FULL      | USEUBX                    |      0 |      3 |      0 |00:00:00.01 |       0 |      0 |
    |  40 |               HASH UNIQUE               |                           |      1 |      8 |      3 |00:00:00.01 |      18 |      0 |
    |  41 |                MERGE JOIN CARTESIAN     |                           |      1 |      8 |      3 |00:00:00.01 |      18 |      0 |
    |* 42 |                 TABLE ACCESS FULL       | USEUBX                    |      1 |      1 |      1 |00:00:00.01 |       3 |      0 |
    |  43 |                 BUFFER SORT             |                           |      1 |      8 |      3 |00:00:00.01 |      15 |      0 |
    |* 44 |                  TABLE ACCESS FULL      | STATAB                    |      1 |      8 |      3 |00:00:00.01 |      15 |      0 |
    |* 45 |            TABLE ACCESS FULL            | OBJ$                      |      1 |   1000 |  99107 |00:00:00.01 |    1171 |      9 |
    |  46 |           TABLE ACCESS FULL             | USER$                     |      1 |     76 |     76 |00:00:00.02 |       6 |      2 |
    |* 47 |          TABLE ACCESS CLUSTER           | TAB$                      |   2726 |      1 |   2726 |00:00:05.85 |    4939 |    608 |
    |* 48 |           INDEX UNIQUE SCAN             | I_OBJ#                    |   2726 |      1 |   2726 |00:00:00.23 |     577 |     19 |
    |  49 |         TABLE ACCESS CLUSTER            | TS$                       |   2726 |      1 |   2726 |00:00:00.01 |    2730 |      0 |
    |* 50 |          INDEX UNIQUE SCAN              | I_TS#                     |   2726 |      1 |   2726 |00:00:00.01 |       4 |      0 |
    |  51 |        TABLE ACCESS CLUSTER             | SEG$                      |   2726 |      1 |   2726 |00:00:01.37 |    3606 |    137 |
    |* 52 |         INDEX UNIQUE SCAN               | I_FILE#_BLOCK#            |   2726 |      1 |   2726 |00:00:00.51 |     880 |     52 |
    |* 53 |       INDEX RANGE SCAN                  | I_OBJ1                    |   2726 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 54 |      INDEX RANGE SCAN                   | I_OBJ1                    |   2726 |      1 |   2719 |00:00:00.18 |     694 |     10 |
    |* 55 |     INDEX RANGE SCAN                    | I_USER2                   |   2726 |      1 |   2719 |00:00:00.01 |       3 |      0 |
    |  56 |    VIEW                                 | DBA_TAB_STATISTICS        |   2726 |     13 |      0 |07:24:59.23 |      73M|     54M|
    |  57 |     UNION-ALL                           |                           |   2726 |        |      0 |07:24:59.23 |      73M|     54M|
    |  58 |      NESTED LOOPS OUTER                 |                           |   2726 |      1 |      0 |00:00:00.18 |   19122 |      1 |
    |  59 |       NESTED LOOPS                      |                           |   2726 |      1 |      0 |00:00:00.18 |   19122 |      1 |
    |  60 |        NESTED LOOPS OUTER               |                           |   2726 |      1 |   2726 |00:00:00.04 |   11535 |      0 |
    |  61 |         NESTED LOOPS                    |                           |   2726 |      1 |   2726 |00:00:00.04 |   11534 |      0 |
    |  62 |          TABLE ACCESS BY INDEX ROWID    | USER$                     |   2726 |      1 |   2726 |00:00:00.04 |    5452 |      0 |
    |* 63 |           INDEX UNIQUE SCAN             | I_USER1                   |   2726 |      1 |   2726 |00:00:00.02 |    2726 |      0 |
    |* 64 |          INDEX RANGE SCAN               | I_OBJ2                    |   2726 |      1 |   2726 |00:00:00.01 |    6082 |      0 |
    |* 65 |         INDEX UNIQUE SCAN               | I_TAB_STATS$_OBJ#         |   2726 |      1 |      0 |00:00:00.01 |       1 |      0 |
    |* 66 |        TABLE ACCESS CLUSTER             | TAB$                      |   2726 |      1 |      0 |00:00:00.12 |    7587 |      1 |
    |* 67 |         INDEX UNIQUE SCAN               | I_OBJ#                    |   2726 |      1 |   2726 |00:00:00.02 |    3225 |      0 |
    |* 68 |       INDEX UNIQUE SCAN                 | I_MON_MODS_ALL$_OBJ       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  69 |      NESTED LOOPS OUTER                 |                           |   2726 |      1 |      0 |01:52:08.09 |      23M|     13M|
    |  70 |       NESTED LOOPS                      |                           |   2726 |      1 |      0 |01:52:08.09 |      23M|     13M|
    |  71 |        MERGE JOIN CARTESIAN             |                           |   2726 |   9067 |     32M|01:50:22.71 |      13M|     13M|
    |  72 |         NESTED LOOPS OUTER              |                           |   2726 |      1 |   2726 |00:00:00.02 |   11535 |      0 |
    |  73 |          NESTED LOOPS                   |                           |   2726 |      1 |   2726 |00:00:00.02 |   11534 |      0 |
    |  74 |           TABLE ACCESS BY INDEX ROWID   | USER$                     |   2726 |      1 |   2726 |00:00:00.01 |    5452 |      0 |
    |* 75 |            INDEX UNIQUE SCAN            | I_USER1                   |   2726 |      1 |   2726 |00:00:00.01 |    2726 |      0 |
    |* 76 |           INDEX RANGE SCAN              | I_OBJ2                    |   2726 |      1 |   2726 |00:00:00.02 |    6082 |      0 |
    |* 77 |          INDEX UNIQUE SCAN              | I_TAB_STATS$_OBJ#         |   2726 |      1 |      0 |00:00:00.01 |       1 |      0 |
    |  78 |         BUFFER SORT                     |                           |   2726 |  11909 |     32M|01:50:22.71 |      13M|     13M|
    |  79 |          TABLE ACCESS FULL              | TAB$                      |   2726 |  11909 |     32M|01:48:31.82 |      13M|     13M|
    |* 80 |        VIEW PUSHED PREDICATE            | TABPARTV$                 |     32M|      1 |      0 |00:01:23.69 |    9566K|      0 |
    |* 81 |         TABLE ACCESS BY INDEX ROWID     | TABPART$                  |     32M|      4 |    703K|00:01:10.17 |    9566K|      0 |
    |* 82 |          INDEX RANGE SCAN               | I_TABPART_BOPART$         |     32M|      4 |    703K|00:00:51.77 |    9210K|      0 |
    |* 83 |       INDEX UNIQUE SCAN                 | I_MON_MODS_ALL$_OBJ       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  84 |      NESTED LOOPS OUTER                 |                           |   2726 |      1 |      0 |01:53:02.61 |      23M|     13M|
    |  85 |       NESTED LOOPS                      |                           |   2726 |      1 |      0 |01:53:02.61 |      23M|     13M|
    |  86 |        MERGE JOIN CARTESIAN             |                           |   2726 |   9067 |     32M|01:51:19.21 |      13M|     13M|
    |  87 |         NESTED LOOPS                    |                           |   2726 |      1 |   2726 |00:00:00.21 |   11534 |      0 |
    |  88 |          TABLE ACCESS BY INDEX ROWID    | USER$                     |   2726 |      1 |   2726 |00:00:00.12 |    5452 |      0 |
    |* 89 |           INDEX UNIQUE SCAN             | I_USER1                   |   2726 |      1 |   2726 |00:00:00.02 |    2726 |      0 |
    |* 90 |          INDEX RANGE SCAN               | I_OBJ2                    |   2726 |      1 |   2726 |00:00:00.06 |    6082 |      0 |
    |  91 |         BUFFER SORT                     |                           |   2726 |  11909 |     32M|01:51:19.03 |      13M|     13M|
    |  92 |          TABLE ACCESS FULL              | TAB$                      |   2726 |  11909 |     32M|01:49:51.13 |      13M|     13M|
    |* 93 |        VIEW PUSHED PREDICATE            | TABPARTV$                 |     32M|      1 |      0 |00:01:23.47 |    9566K|      0 |
    |* 94 |         TABLE ACCESS BY INDEX ROWID     | TABPART$                  |     32M|      1 |      0 |00:01:10.51 |    9566K|      0 |
    |* 95 |          INDEX RANGE SCAN               | I_TABPART_BOPART$         |     32M|      4 |    703K|00:00:53.01 |    9210K|      0 |
    |* 96 |       INDEX UNIQUE SCAN                 | I_MON_MODS_ALL$_OBJ       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  97 |      NESTED LOOPS OUTER                 |                           |   2726 |      1 |      0 |01:49:37.09 |      13M|     13M|
    |  98 |       NESTED LOOPS                      |                           |   2726 |      1 |      0 |01:49:37.09 |      13M|     13M|
    |  99 |        NESTED LOOPS OUTER               |                           |   2726 |      1 |      0 |01:49:37.09 |      13M|     13M|
    | 100 |         NESTED LOOPS                    |                           |   2726 |      1 |      0 |01:49:37.09 |      13M|     13M|
    | 101 |          NESTED LOOPS                   |                           |   2726 |  11909 |     32M|01:47:05.13 |      13M|     13M|
    | 102 |           TABLE ACCESS BY INDEX ROWID   | USER$                     |   2726 |      1 |   2726 |00:00:00.08 |    5452 |      0 |
    |*103 |            INDEX UNIQUE SCAN            | I_USER1                   |   2726 |      1 |   2726 |00:00:00.04 |    2726 |      0 |
    | 104 |           TABLE ACCESS FULL             | TAB$                      |   2726 |  11909 |     32M|01:46:32.59 |      13M|     13M|
    |*105 |          VIEW PUSHED PREDICATE          | TABCOMPARTV$              |     32M|      1 |      0 |00:00:37.20 |       1 |      1 |
    | 106 |           TABLE ACCESS BY INDEX ROWID   | TABCOMPART$               |     32M|      1 |      0 |00:00:23.85 |       1 |      1 |
    |*107 |            INDEX RANGE SCAN             | I_TABCOMPART_BOPART$      |     32M|      1 |      0 |00:00:09.37 |       1 |      1 |
    |*108 |         INDEX UNIQUE SCAN               | I_MON_MODS_ALL$_OBJ       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*109 |        TABLE ACCESS BY INDEX ROWID      | OBJ$                      |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*110 |         INDEX RANGE SCAN                | I_OBJ1                    |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*111 |       INDEX UNIQUE SCAN                 | I_TAB_STATS$_OBJ#         |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    | 112 |      NESTED LOOPS                       |                           |   2726 |        |      0 |01:50:32.64 |      13M|     13M|
    | 113 |       NESTED LOOPS                      |                           |   2726 |      1 |      0 |01:50:32.62 |      13M|     13M|
    | 114 |        NESTED LOOPS OUTER               |                           |   2726 |      1 |      0 |01:50:32.60 |      13M|     13M|
    | 115 |         NESTED LOOPS OUTER              |                           |   2726 |      1 |      0 |01:50:32.60 |      13M|     13M|
    | 116 |          NESTED LOOPS                   |                           |   2726 |      1 |      0 |01:50:32.58 |      13M|     13M|
    | 117 |           NESTED LOOPS                  |                           |   2726 |      1 |      0 |01:50:32.58 |      13M|     13M|
    | 118 |            NESTED LOOPS                 |                           |   2726 |      1 |      0 |01:50:32.58 |      13M|     13M|
    | 119 |             NESTED LOOPS                |                           |   2726 |  11909 |     32M|01:48:00.62 |      13M|     13M|
    | 120 |              TABLE ACCESS BY INDEX ROWID| USER$                     |   2726 |      1 |   2726 |00:00:00.04 |    5452 |      0 |
    |*121 |               INDEX UNIQUE SCAN         | I_USER1                   |   2726 |      1 |   2726 |00:00:00.02 |    2726 |      0 |
    | 122 |              TABLE ACCESS FULL          | TAB$                      |   2726 |  11909 |     32M|01:48:00.58 |      13M|     13M|
    |*123 |             VIEW PUSHED PREDICATE       | TABCOMPARTV$              |     32M|      1 |      0 |00:00:39.60 |       1 |      0 |
    | 124 |              TABLE ACCESS BY INDEX ROWID| TABCOMPART$               |     32M|      1 |      0 |00:00:26.27 |       1 |      0 |
    |*125 |               INDEX RANGE SCAN          | I_TABCOMPART_BOPART$      |     32M|      1 |      0 |00:00:09.80 |       1 |      0 |
    | 126 |            VIEW PUSHED PREDICATE        | TABSUBPARTV$              |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*127 |             TABLE ACCESS BY INDEX ROWID | TABSUBPART$               |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*128 |              INDEX RANGE SCAN           | I_TABSUBPART_POBJSUBPART$ |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*129 |           INDEX RANGE SCAN              | I_OBJ1                    |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*130 |          INDEX UNIQUE SCAN              | I_TAB_STATS$_OBJ#         |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*131 |         INDEX UNIQUE SCAN               | I_MON_MODS_ALL$_OBJ       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*132 |        INDEX RANGE SCAN                 | I_OBJ1                    |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*133 |       TABLE ACCESS BY INDEX ROWID       | OBJ$                      |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*134 |      FILTER                             |                           |   2726 |        |      0 |00:00:00.02 |       0 |      0 |
    |*135 |       FILTER                            |                           |      0 |        |      0 |00:00:00.01 |       0 |      0 |
    |*136 |        HASH JOIN OUTER                  |                           |      0 |      8 |      0 |00:00:00.01 |       0 |      0 |
    | 137 |         NESTED LOOPS OUTER              |                           |      0 |      8 |      0 |00:00:00.01 |       0 |      0 |
    |*138 |          FIXED TABLE FULL               | X$KQFTA                   |      0 |      8 |      0 |00:00:00.01 |       0 |      0 |
    |*139 |          INDEX UNIQUE SCAN              | I_TAB_STATS$_OBJ#         |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    | 140 |         TABLE ACCESS FULL               | FIXED_OBJ$                |      0 |    783 |      0 |00:00:00.01 |       0 |      0 |
    | 141 |    NESTED LOOPS                         |                           |   2726 |      1 |      0 |00:00:00.70 |   19121 |      4 |
    | 142 |     NESTED LOOPS                        |                           |   2726 |      1 |      0 |00:00:00.68 |   19121 |      4 |
    | 143 |      NESTED LOOPS OUTER                 |                           |   2726 |      1 |      0 |00:00:00.68 |   19121 |      4 |
    | 144 |       NESTED LOOPS OUTER                |                           |   2726 |      1 |      0 |00:00:00.68 |   19121 |      4 |
    | 145 |        NESTED LOOPS OUTER               |                           |   2726 |      1 |      0 |00:00:00.64 |   19121 |      4 |
    | 146 |         NESTED LOOPS OUTER              |                           |   2726 |      1 |      0 |00:00:00.64 |   19121 |      4 |
    | 147 |          NESTED LOOPS                   |                           |   2726 |      1 |      0 |00:00:00.64 |   19121 |      4 |
    | 148 |           NESTED LOOPS                  |                           |   2726 |      1 |   2726 |00:00:00.25 |   11534 |      0 |
    | 149 |            TABLE ACCESS BY INDEX ROWID  | USER$                     |   2726 |      1 |   2726 |00:00:00.16 |    5452 |      0 |
    |*150 |             INDEX UNIQUE SCAN           | I_USER1                   |   2726 |      1 |   2726 |00:00:00.04 |    2726 |      0 |
    |*151 |            INDEX RANGE SCAN             | I_OBJ2                    |   2726 |      1 |   2726 |00:00:00.08 |    6082 |      0 |
    |*152 |           TABLE ACCESS CLUSTER          | IND$                      |   2726 |      1 |      0 |00:00:00.39 |    7587 |      4 |
    |*153 |            INDEX UNIQUE SCAN            | I_OBJ#                    |   2726 |      1 |   2726 |00:00:00.02 |    3225 |      0 |
    | 154 |          TABLE ACCESS CLUSTER           | TS$                       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*155 |           INDEX UNIQUE SCAN             | I_TS#                     |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    | 156 |         TABLE ACCESS CLUSTER            | SEG$                      |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*157 |          INDEX UNIQUE SCAN              | I_FILE#_BLOCK#            |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*158 |        INDEX RANGE SCAN                 | I_OBJ1                    |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*159 |       INDEX RANGE SCAN                  | I_USER2                   |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*160 |      TABLE ACCESS BY INDEX ROWID        | OBJ$                      |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*161 |       INDEX RANGE SCAN                  | I_OBJ1                    |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*162 |     INDEX RANGE SCAN                    | I_USER2                   |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    Predicate Information (identified by operation id):
       2 - filter(("T"."ANALYZETIME" IS NOT NULL OR  IS NOT NULL OR  IS NOT NULL))
       9 - access("U"."NAME"="S"."COFIR" AND "O"."OWNER#"="U"."USER#")
      10 - access("O"."NAME"="S"."COTAB")
      11 - access("S"."COFIR"="U"."COFIR")
      13 - access("KSPPI"."INDX"="KSPPCV"."INDX")
      14 - filter("KSPPI"."KSPPINM"='_dml_monitoring_enabled')
      24 - filter("U"."TYUSR"='C')
      26 - filter(("S"."CTTAB"='T' AND "S"."TYUSR" IS NULL))
      27 - access("T"."COOBJ"="S"."COTAB")
      31 - filter("U"."TYUSR"='U')
      33 - filter(("S"."CTTAB"='T' AND "S"."TYUSR" IS NULL))
      34 - access("S"."COTAB"="T"."COOBJ")
      37 - filter(("S"."TYUSR"='G' AND "S"."CTTAB"='T'))
      39 - filter(("U"."TYUSR"='U' OR "U"."TYUSR"='X'))
      42 - filter("U"."TYUSR"='X')
      44 - filter(("S"."CTTAB"='T' AND "S"."TYUSR"='X'))
      45 - filter((DECODE(BITAND("O"."FLAGS",2),0,'N',2,'Y','N')='N' AND BITAND("O"."FLAGS",128)=0))
      47 - filter(BITAND("T"."PROPERTY",1)=0)
      48 - access("O"."OBJ#"="T"."OBJ#")
      50 - access("T"."TS#"="TS"."TS#")
      52 - access("T"."TS#"="S"."TS#" AND "T"."FILE#"="S"."FILE#" AND "T"."BLOCK#"="S"."BLOCK#")
      53 - access("T"."BOBJ#"="CO"."OBJ#")
      54 - access("T"."DATAOBJ#"="CX"."OBJ#")
      55 - access("CX"."OWNER#"="CU"."USER#")
      63 - access("U"."NAME"=:B1)
      64 - access("O"."OWNER#"="U"."USER#" AND "O"."NAME"=:B1 AND "O"."NAMESPACE"=1 AND "O"."REMOTEOWNER" IS NULL AND
                  "O"."LINKNAME" IS NULL AND "O"."SUBNAME" IS NULL)
           filter(("O"."SUBNAME" IS NULL AND "O"."REMOTEOWNER" IS NULL AND "O"."LINKNAME" IS NULL))
      65 - access("O"."OBJ#"="TS"."OBJ#")
      66 - filter((NVL(DECODE(BITAND("T"."TRIGFLAG",67108864)+BITAND("T"."TRIGFLAG",134217728),0,NULL,67108864,'DATA',134217728,'CAC
                  HE','ALL'),'*')<>'ALL' AND BITAND("T"."PROPERTY",1)=0))
      67 - access("O"."OBJ#"="T"."OBJ#")
      68 - access("T"."OBJ#"="M"."OBJ#")
      75 - access("U"."NAME"=:B1)
      76 - access("O"."OWNER#"="U"."USER#" AND "O"."NAME"=:B1 AND "O"."NAMESPACE"=1 AND "O"."REMOTEOWNER" IS NULL ANDsome information about the database:
      2  ;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    SQL> sho parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_capture_sql_plan_baselines boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      11.1.0.7
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    optimizer_use_invisible_indexes      boolean     FALSE
    optimizer_use_pending_statistics     boolean     FALSE
    optimizer_use_sql_plan_baselines     boolean     TRUEthe issue seems to be on the view DBA_TAB_STATISTICS and in particular on this operation:
    | 122 |              TABLE ACCESS FULL          | TAB$                      |   2726 |  11909 |     32M|01:48:00.58 |      13M|     13M|How can I tune this query ?
    Thanks for helping

    Well, if you've ever looked at the source for DBA_TAB_STATISTICS you will understand why it's not a great candidate to query frequently, like in an exists look up :)
    This takes up a little more code, but i'd wager it finishes a bit sooner.
    SELECT
      /*+ gather_plan_statistics */
      T.OWNER,
      T.TABLE_NAME
    FROM
      ( SELECT DISTINCT COFIR
      FROM DBAUSR_TT
      ) U,
      VDBSTA S,
      DBA_TABLES T
    WHERE S.COFIR         = U.COFIR
    AND S.CTTAB           = 'T'
    AND T.OWNER           = S.COFIR
    AND T.TABLE_NAME      = S.COTAB
    AND T.TEMPORARY       = 'N'
    AND
        T.LAST_ANALYZED IS NOT NULL
    OR EXISTS
        SELECT 1
        FROM DBA_INDEXES I
        WHERE I.TABLE_OWNER  = T.OWNER
        AND I.TABLE_NAME     = T.TABLE_NAME
        AND I.LAST_ANALYZED IS NOT NULL
    UNION
    SELECT
      T.OWNER,
      T.TABLE_NAME
    FROM
      ( SELECT DISTINCT COFIR FROM DBAUSR_TT
      ) U,
      VDBSTA S,
      DBA_TABLES T,
      DBA_TAB_STATISTICS A
    WHERE S.COFIR                     = U.COFIR
    AND S.CTTAB                       = 'T'
    AND T.OWNER                       = S.COFIR
    AND T.TABLE_NAME                  = S.COTAB
    AND T.TEMPORARY                   = 'N'
    --added predicate
    AND T.LAST_ANALYZED IS NULL
    AND A.OWNER                       = T.OWNER
    AND A.TABLE_NAME                  = T.TABLE_NAME
    AND NVL (A.STATTYPE_LOCKED, '*') != 'ALL')
    ORDER BY 1, 2;

  • Query takes 5 min when using Indexes and 1 Second without Indexes !!

    Hi,
    We have been using indexes on all tables until recently when we faced problems with queries like the one below:
    SELECT a.std_id FROM students a, student_degree b, student_course c, course d
    WHERE b.std_id = a.std_id
    AND c.std_id = a.std_id
    AND d.crn = c.crn
    AND b.in_progress = 'Y'
    AND b.major_code = 'ABTC'
    AND a.program_code = 'DP'
    AND a.level_code = 'S2'
    AND a.campus_code = '05'
    AND a.termcode = '200702';
    This query takes more than 5 minutes to return a result, but as soon as we remove indexes on the columns termcode and campus_code,it shows result in 1 second.
    What could be the problem ?, Is there an attribute that need to be set when creating these indexes ?
    Thanks in advance
    Madani

    Thank you Karthik for your reply.Here are the explain plan report (as shown on Oracle 9i Enterprise Manager)
    *1-Explain plan without Indexes:*
    Execution Steps:
    Step # Step Name
    11 SELECT STATEMENT
    10 MERGE JOIN
    7 SORT [JOIN]
    6 NESTED LOOPS
    4 NESTED LOOPS
    1 ERMS.STUDENT_DEGREE TABLE ACCESS [FULL]
    3 ERMS.STUDENTS TABLE ACCESS [BY INDEX ROWID]
    2 ERMS.SYS_C006642 INDEX [UNIQUE SCAN]
    5 ERMS.SYS_C007065 INDEX [RANGE SCAN]
    9 SORT [JOIN]
    8 ERMS.COURSE TABLE ACCESS [FULL]
    Step # Description
    1 This plan step retrieves all rows from table STUDENT_DEGREE.
    2 This plan step retrieves a single ROWID from the B*-tree index SYS_C006642.
    3 This plan step retrieves rows from table STUDENTS through ROWID(s) returned by an index.
    4 This plan step joins two sets of rows by iterating over the driving, or outer, row set (the first child of the join) and, for each row, carrying out the steps of the inner row set (the second child). Corresponding pairs of rows are tested against the join condition specified in the query's WHERE clause.
    5 This plan step retrieves one or more ROWIDs in ascending order by scanning the B*-tree index SYS_C007065.
    6 This plan step joins two sets of rows by iterating over the driving, or outer, row set (the first child of the join) and, for each row, carrying out the steps of the inner row set (the second child). Corresponding pairs of rows are tested against the join condition specified in the query's WHERE clause.
    7 This plan step accepts a row set (its only child) and sorts it in preparation for a merge-join operation.
    8 This plan step retrieves all rows from table COURSE.
    9 This plan step accepts a row set (its only child) and sorts it in preparation for a merge-join operation.
    10 This plan step accepts two sets of rows sorted on the join key. By walking both sets of rows in the order of the join key, every distinct pair of rows satisfying the join condition in the WHERE clause is found through a single pass of the row sets.
    11 This plan step designates this statement as a SELECT statement.
    *2-Explain plan with Indexes:* (I added index on column campus_code which is a varchar2 column)
    Execution Steps:
    Step # Step Name
    11 SELECT STATEMENT
    10 MERGE JOIN
    7 SORT [JOIN]
    6 NESTED LOOPS
    4 NESTED LOOPS
    1 ERMS.COURSE TABLE ACCESS [FULL]
    3 ERMS.STUDENTS TABLE ACCESS [BY INDEX ROWID]
    2 ERMS.INDEX_STUDENTS_CAMPUS_CODE INDEX [RANGE SCAN]
    5 ERMS.SYS_C007065 INDEX [RANGE SCAN]
    9 SORT [JOIN]
    8 ERMS.STUDENT_DEGREE TABLE ACCESS [FULL]
    Step # Description
    1 This plan step retrieves all rows from table COURSE.
    2 This plan step retrieves one or more ROWIDs in ascending order by scanning the B*-tree index INDEX_STUDENTS_CAMPUS_CODE.
    3 This plan step retrieves rows from table STUDENTS through ROWID(s) returned by an index.
    4 This plan step joins two sets of rows by iterating over the driving, or outer, row set (the first child of the join) and, for each row, carrying out the steps of the inner row set (the second child). Corresponding pairs of rows are tested against the join condition specified in the query's WHERE clause.
    5 This plan step retrieves one or more ROWIDs in ascending order by scanning the B*-tree index SYS_C007065.
    6 This plan step joins two sets of rows by iterating over the driving, or outer, row set (the first child of the join) and, for each row, carrying out the steps of the inner row set (the second child). Corresponding pairs of rows are tested against the join condition specified in the query's WHERE clause.
    7 This plan step accepts a row set (its only child) and sorts it in preparation for a merge-join operation.
    8 This plan step retrieves all rows from table STUDENT_DEGREE.
    9 This plan step accepts a row set (its only child) and sorts it in preparation for a merge-join operation.
    10 This plan step accepts two sets of rows sorted on the join key. By walking both sets of rows in the order of the join key, every distinct pair of rows satisfying the join condition in the WHERE clause is found through a single pass of the row sets.
    11 This plan step designates this statement as a SELECT statement.

  • Sql statement takes long to execute even with index

    Hi
    I have the following sql statement.
    Its explain plan states its "TABLE ACCESS FULL".
    But upon creation of index for table PWRKF2MV, using
    IDX(pafidt,ppdept,prodno,ppname) and IDX2(pmfaci,prodno), it uses both indexes
    but time taken to execute is still the same as when there is no indexes.
    Why is that so? Appreciate any help. Thank you.
    Pls take note that the PWRKF2MV is a materialized view and MITBALC0 is a synonym.
    SQL statement: -
    select a.ppdept dept, rtrim(b.mbsttx) prod, to_char(to_date(a.pafidt,'YYYYMMDD'),'Y')||to_char(to_date(a.pafidt,'YYYYMMDD'),'WW') as yrweek, sum(pmoqty) moqty
    from pwrkf2mv a, mitbalc0 b
    where a.pafidt between :p_startdate and :p_enddate
    and a.ppdept = nvl(:p_dept,a.ppdept)
    and a.prodno = nvl(:p_prodno,a.prodno)
    and a.ppname like '%'||:p_proddesc||'%'
    and rtrim(a.prefno) is not null
    and rtrim(b.mbsttx) is not null
    and a.pmfaci = b.mbwhlo
    and a.prodno = b.mbitno
    group by a.ppdept, b.mbsttx, to_char(to_date(a.pafidt,'YYYYMMDD'),'Y')||to_char(to_date(a.pafidt,'YYYYMMDD'),'WW')
    order by a.ppdept, yrweek, b.mbsttx;
    Siti

    Hi Siti,
    Is your table goes through frequent update and delete statements? if YES=>
    Free blocks created during this operation may dgrade the performance during full
    Tbale scan.
    If you are using Oracle 10g, you can shrink the segments. But first enable the row movement
    sql> alter table emp enable row movement;
    http://www.oracle.com/technology/oramag/oracle/05-may/o35tuning.html
    JAI HIND
    Darshan

  • Query run: takes ages to execute!

    Hi,
    I had created a query ( on cube which has roughly 497000 records ).
    when i am trying to execute it, a pop up message will comes up after half an hour so saying that result has exceeded xxxxxx rows: and then after a while a affirmation of result is incomplete!
    even after these two messages it never has given any out put! it is still running!
    what could be done to see the results of the query?
    I had removed all the chars in rows area except one and placed in free char area!
    But the issue remains an issue
    Any suggestions?
    Thanks,
    Ravi

    1. Run your query in RSRT with execute and Debug option
    2. Check Display SQL Query in Database tab.
    3. View your result and you will know which aggregates / tables its using and their selection.
    4. Based on the SQL result you can fine tune your selection.
    5. Try to run your selection with small range.
    Hope this helps...

Maybe you are looking for

  • Why does my Photoshop CS5 keep freezing?

    Hi, I'm running Adobe Photoshop CS5 on a Lenovo ThinkPad S1 (8 GB ram) in Windows 8.1. I really hope that somebody can help me with regards to this freezing issue that I'm experiencing, I have been using Photoshop CS5 for nearly 12 months and it's be

  • Stroring data taken from database as a variable

    Hi there I;m having a problem and I was wondering if anyone can help me? I am trying to extract data from a MySQL database and store the variables so I can use them in another bean... so far I am getting a SQL exception error but I dont know what Im

  • OLAP parameters - optionally exclude members of a group

    I have a report that shows activity for members of one of more workgroups.  There's a parameter for that and it works correctly.  The business now wants to exclude a few members of a few workgroups. In the query designer, if I don't have the Not Equa

  • Exporting Metadata Templates from my old computer

    I am trying to Export my Metadata Templates form my old Mac (running on Bridge CS3) to my new Mac (running on Bridge CC). I have located the folder on my old Mac: Library/Appliation Support/Adobe/XMP/Metadata Templates I dropped the Metadata Template

  • Need to reset Imac running parallels to earlier time and date

    I have a 21.5 IMac running 10.5.8 OSX. I use this computer to run parallels and MagicInfo(WIndows program) for digital signage. Magic Info crashed and I need to see if I can reset the IMac to a day prior to the crash and restore the program? Or do I