Optimize union in ase query

we have a "select" query using 3 union operators (4 selects in total). In ASE 12.5.4 ESD# 10 executes in 2 sec, in ASE 15.7 SP103 it needs 88sec. If I run only 2 "select" (one union) it runs fast
I enable "compatibility mode" but it has no effect at all. The main difference in the plans is that in 12.5 the query is parallelized, however even when I added "parallel clauses" the performance was not improved. None of the tables is partitioned, all the tables have clear dbcc, the tables are not very big (700000 rows max),sysmon seems ok.
The "statistics io" output shows considerable higher io for version 15.7 and this is probably the explanation. I have tested several options of the optimizer which do not work. Also I have increased the histogram steps which improved the performance up to 88sec (before this the query had not finished in 20min)
I tried to  use the abstract plan used in 12.5.4 but I have several messages like
Server 'TVSONL', Line 1:
The children of the 'nl_join ' operator don't have the required properties, as ordering, partitioning. The logical relational operation is valid at this point but it can not be implemented by this physical operator.
Server Message:  Number  1035, Severity  10
Server 'TVSONL', Line 1:
The AP property enforcer operators 'sort', 'xchg' or 'enforce' can be used to create the needed physical properties.
Server Message:  Number  1037, Severity  10
Server 'TVSONL', Line 1:
When an ordering is missing, the nl_join or h_join peer physical operators that don't need an ordering can be used.
Server Message:  Number  1027, Severity  10
Server 'TVSONL', Line 1:
I have no experience on abstract plans, but I shall try to read the manual and work on this.
I open this thread mostly for any ideas on what to do, I was surprised that compatibility mode has no effect and I really don't know what to do. Maybe there is a hint somewhere on optimizing "unions"
Thank you in advance

Hi,
You should persist down the missing_stats route, it may well help to create a few histograms.
Are you absolutely sure that compatibility mode (maybe at server level) was not on?
The fact it is not only priming the search engine with the legacy AP, but actually using it in full usually would mean that basic_optimization was set (which isn't the case here) or it is using partial compatibilty mode ( same thing as basic).
If it is on then any changes to the 15x Optimizer criteria will have no effect unless specified in an abstract plan themselves.
The 'show long' will contain all that is in a 'show on' output but will also contain the logical properties stage ( which is actually where ASE forms the basis of the row counts you see in the plancost output), the codegen phase (no use to anyone unless you are trying to debug something more than plan choice), some extra pushdown info, more info in eqc competition (can be key), more info post 'best plan' stage - and gumpf. It is a requirement to really try to piece together what is going on in a lot of circumstances however with more than 4 or 5 tables and anything other than a few simple entries in the predicate, as is likely here, it becomes unmanageable.
Disable all parallel and make sure you have no forces in the query (no parallel hints etc), then
Run this:-
set compatibilty_mode off
set statement_cache off
set plan optlevel ase_current
set option show on
set option show_log_props on
set statistics time,io,plancost,resource on
set option show_missing_stats on
set showplan on
set show_sqltext on
dbcc traceon (526, 3604)
go
<query>
Then do the same again i.e. (all the commands )but add in:
set store_index off
Then the same as the first set again adding in:
set alternative_greedy_search off
Then the same as the first set again with:
set store_index off
set alternative_greedy_search off
Then the same as the first set again but add in:
set plan optlevel ase_default
And post the outputs. As Jeff said, ddl is really needed to help out here and maybe optdiag outputs as well. Can you run it on 125x with showplan and set statistics time, io on as well?
Be prepared that modifying/splitting out this query might be your only option.
Cheers,
Simon

Similar Messages

  • Optimization of a SAP Query

    Hi ,
    One of the SAP query (developed by user , not standard query) is giving short dump with time out error.Requirement is to optimize this query. This query is using logical database QMS, which is standard.
    Is it possible to optimize the query ?

    Not possible , as it is generated by SAP and you will require access key for this.
    You can increase some selection screen fields and reduce the number of records.
    You can do runtime analysis and trace check SE30 and ST05 and can check exact cause of this issue.
    you need to make a Z program to overcome that.

  • How to optimize the mentioned SQL Query

    Hi,
    I have a query like this:
    SELECT XYZ.B1, XYZ.B2 FROM
    SELECT * from A where ( A.C1 IN ( 0,1,2,3,4 ) ) AND ( A.C2 IN ( 1,2 ) )
    AND (( A.C3 =15 ) and (A.C4 = 0 or A.C5 = 0)) AND A.C6 >= TO_DATE('2002-01-01
    06:30:00', 'YYYY-MM-DD HH24:MI:SS') AND A.CP < 376137 ORDER BY A.CP DESC) XYZ
    WHERE ROWNUM < 602
    WHERE A.CP is the primary key and also the primary indexing is on that A.CP.
    I have around 4 lakhs record in the Table A. The query is taking more than
    2 minutes to execute on my m/c.
    My basic requirement is to read last 602 records from A with CP less than
    376137 plus matching other criteria mentioned in the query. It will be highly
    grateful if someone provides with a much optimal query to perform the task.
    TIA,
    Tuhin

    Hi John,
    Thanks for the Response.
    Below is explain plan you have asked for.
    select AlmEvtTbl.AlmEvtId, AlmEvtTbl.AlmType, AlmEvtTbl.ComponentId,
              AlmEvtTbl.TimeStamp, AlmEvtTbl.Severity, AlmEvtTbl.State,
    AlmEvtTbl.Category,          AlmEvtTbl.CauseType, AlmEvtTbl.CauseCode,
    AlmEvtTbl.UnitType, AlmEvtTbl.UnitId,          AlmEvtTbl.UnitName,
    AlmEvtTbl.ServerName, AlmEvtTbl.StrParam, AlmEvtTbl.ParentCustId,
              AlmEvtTbl.ExtraParam1, AlmEvtTbl.ExtraParam2, AlmEvtTbl.ExtraParam3,
    AlmEvtTbl.ExtraStrParam, AlmEvtTbl.SrcIPAddress,          AlmEvtTbl.DestIPAddress,
    AlmEvtTbl.DestPort, AlmEvtTbl.SessionDir,           AlmEvtTbl.CustomerId,
    AlmEvtTbl.ProfileId, AlmEvtTbl.ParentProfileId, AlmEvtTbl.CustomerName
    from
    (select AlmEvtSysPeView.* from AlmEvtSysPeView where (
    AlmEvtSysPeView.Severity IN ( 0,1,2,3,4 ) ) and ( AlmEvtSysPeView.State
    IN ( 1,2 ) ) and (( AlmEvtSysPeView.Category =3 or
    AlmEvtSysPeView.Category =14 ) and (AlmEvtSysPeView.Customerid = 0 or
    AlmEvtSysPeView.ParentCustId = 0)) and AlmEvtSysPeView.TimeStamp >=
    TO_DATE('2002-01-01 06:30:00', 'YYYY-MM-DD HH24:MI:SS') and
    AlmEvtSysPeView.AlmEvtId < 376137 order by AlmEvtSysPeView.almevtid desc)
    almevttbl where rownum < 202
    call count cpu elapsed disk query current rows
    Parse 1 0.02 0.02 0 0 0 0
    Execute 2 0.01 0.01 0 0 0 0
    Fetch 2 7.61 85.03 19469 1848476 2153 201
    total 5 7.64 85.06 19469 1848476 2153 201
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 77 (SKAGARWAL)
    Rows Row Source Operation
    201 COUNT STOPKEY
    201 VIEW
    201 SORT ORDER BY STOPKEY
    306899 NESTED LOOPS OUTER
    306900 NESTED LOOPS OUTER
    306900 TABLE ACCESS BY INDEX ROWID ALMEVTTBL
    374210 INDEX RANGE SCAN (object id 205151)
    306899 INDEX UNIQUE SCAN (object id 205144)
    306899 TABLE ACCESS BY INDEX ROWID ALMEVTPETBL
    613798 INDEX UNIQUE SCAN (object id 205146)
    Rows Execution Plan
    0 SELECT STATEMENT GOAL: CHOOSE
    201 COUNT (STOPKEY)
    201 VIEW
    201 SORT (ORDER BY STOPKEY)
    306899 NESTED LOOPS (OUTER)
    306900 NESTED LOOPS (OUTER)
    306900 TABLE ACCESS (BY INDEX ROWID) OF 'ALMEVTTBL'
    374210 INDEX (RANGE SCAN) OF 'ALMEVTTBL_PK' (UNIQUE)
    306899 INDEX (UNIQUE SCAN) OF 'ALMEVTIDSURLTBL_PK' (UNIQUE)
    306899 TABLE ACCESS (BY INDEX ROWID) OF 'ALMEVTPETBL'
    613798 INDEX (UNIQUE SCAN) OF 'ALMEVTPETBL_PK' (UNIQUE)
    Thanks,
    Tuhin
    Hi Tuhin,
    You haven't posted the EXPLAIN PLAN for the query -
    that would be useful.
    400,000 records isn't a lot and 2 minuets seems a
    long time.
    The first thing I'd try is creating (and analysing)
    an index on C6 - see if that helps.
    d.

  • CFC query union with database query

    I'm trying to invoke a webservice to return a query, and then
    run a parallel query in another database, and UNION the two with a
    query of query. Both the webservice server and the local server are
    CF7, both running MySQL, both accessing tables with parallel
    structures. The webservice returns what appears to be a normal
    query from CFDUMP, but then when I UNION it with the second query,
    I get either "Incorrect Select List" or "Columns with index number
    equal "1" have diffent types (SMALLINT, JAVA_OBJECT)" errors. So
    apparently there's something different about the query from the
    webservice that's causing problems?

    Thanks, this fixed it. I had not realized CF had it's own Q
    of Q CAST function. Here's the documentation on it, in case it has
    eluded others.
    http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=ColdFusion_Documentation&file=00001271.htm
    Adobe: It would be nice if the LiveDoc page for a main tag
    like CFQUERY would link to all related pages, like this one above.
    Then when looking for information on using a particular tag, it
    would be much more likely to find the related page.

  • Optimization of ViewObject's query updates

    Hello,
    I'd like to know wether calling the setWhereClause() / setWhereClauseParams() / setOrderByClause and other similar methods automatically mark a viewObject's query as "changed" (and cause the query to be re-executed on the next navigation event) or
    if they first check that the new clause / params are actually different from the current ones?
    This would allow me to know wether it's worth checking the parameters actual modification to avoid the query from being re-executed, or if I can just trust the underlying mechanisms to do the job.
    Thanks for any answer,
    Remi DEH

    Hello again,
    Actually, while debugging , I noticed there was a "queryChanged" flag in the view object (or was it in the underlying RowSet object?), although its behaviour is not as clear as its name would let think.
    There is also a isQueryChanged() method in ViewObjectImpl but in the doc it is described as "Internal: Applications shouldn't use this method" :).
    Therefore, I guess that I should perform the checks in my code rather than relying on the BC4J framework to do this kind of optimization, which is suitable for me. (I just wanted to be sure I wasn't going to re-implement something that's already done).
    Thanks for your answer.
    Remi DEH
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDev Team (Laura):
    Remi,
    I don't believe there is any type of 'change flag' set on the View Object. You can use the getWhereClause, getWhereClauseParams or getOrderByClause methods to retrieve and investigate the 'current' settings for the VO query.
    See the javadocs for the ViewObject Interface and ViewObjectImpl class for more information on those methods.
    <HR></BLOCKQUOTE>
    null

  • Better to write this query -- the UNION kills the query

    Is there a better way to write this qery to avoid the union?
    CREATE TABLE EMP
    EMP_ID           NUMBER,
    LAST_NAME     VARCHAR2(20),
    FIRST_NAME     VARCHAR2(20),
    MID_NAME     VARCHAR2(20)
    CREATE TABLE EMP_NM
    EMP_ID          NUMBER,
    LAST_NAME     VARCHAR2(20),
    FIRST_NAME     VARCHAR2(20),
    MID_NAME     VARCHAR2(20)
    INSERT INTO EMP
    VALUES(
    1, 'ANDERSON', 'SCOTT', NULL)
    INSERT INTO EMP
    VALUES
    (2, 'KEVINSKY', 'KEVIN', NULL
    INSERT INTO EMP_NM
    VALUES(
    1, 'ANDERSON', 'SCOTT', NULL)
    INSERT INTO EMP_NM
    VALUES(
    1, 'LEE', 'SCOTT', 'K')
    INSERT INTO EMP_NM
    VALUES
    (2, 'KEVINSKY', 'KEVIN', NULL )
    INSERT INTO EMP_NM
    VALUES
    (2, 'ANDERSON', 'KEVIN', NULL )
    SELECT
    E.EMP_ID          ,
    E.LAST_NAME     ,
    E.FIRST_NAME     ,
    E.MID_NAME                              FROM          
    EMP          E          
    WHERE          
    E.LAST_NAME          =:LAST_NAME     
    UNION
    SELECT
    E.EMP_ID          ,
    E.LAST_NAME     ,
    E.FIRST_NAME     ,
    E.MID_NAME     
    FROM
    SELECT     EN.EMP_ID     
    FROM          
         EMP_NM     EN
    WHERE          
    EN.LAST_NAME     =:LAST_NAME                              )          EN1 ,
    EMP     E
    WHERE
    E.EMP_ID     =     EN1.EMP_ID

    EXPLAIN PLAN without sort
    SELECT STATEMENT Optimizer Mode=CHOOSE          171 K          6717                     
    FILTER                                        
    TABLE ACCESS FULL     EMP     171 K     5 M     6717                     
    TABLE ACCESS BY INDEX ROWID     EMP_NM     1      14      1                     
    INDEX RANGE SCAN     IDXEMP_ID     1           3
    EXPLIAN PLAN WITH SORT
         Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE          171 K          7658                     
    SORT ORDER BY          171 K     5 M     7658                     
    FILTER                                        
    TABLE ACCESS FULL     EMP     171 K     5 M     6717                     
    TABLE ACCESS BY INDEX ROWID     EMP_NM     1      14      1                     
    INDEX RANGE SCAN     IDXEMP_ID     1           3

  • Trying to optimize the following update query

    I am trying to update a table based on the values of another table in the following manner. I have two tables A and B. Say A has 300,000 records and B has 100,000 which is basically a set of the 300,000 in A. Therefore, B has the exact same records as A. There are two columns in both tables (status and my_status). Currently for all the records in A these two values are 0 and null respectively. In B, the same records have different values for the two columns. Table A needs to updated with these values currently in B. I have the following the query that I am hesitant to use since the explain shows a very high cost and a full table scan of B.
    update A a
    set (status,my_status) = (select b.status, b.my_status from B b, A a where a.id = b.id)
    where a.date >= '01-JAN-2003' and a.cd = 'FD'.
    As the above query shows, the where condition in the outer part(where a.date >= '01-JAN-2003' and a.cd = 'FD'.) ensures that only those records present in B are updated in A. Is there any way to join at the outer part where I can just specify A.id = B.id rather than having two conditions? Or is there any other route that would optimize this sort of a query?

    Hi,
    Be sure to put unique constraints on A.ID and B.ID like so before running the UPDATE view statement, like this:
    ALTER TABLE a ADD CONSTRAINT a_uk1 UNIQUE (id);
    ALTER TABLE b ADD CONSTRAINT b_uk1 UNIQUE (id);Then, remember to gather stats like so:
    BEGIN
       FOR x IN (SELECT table_name
                 FROM user_tables
                 WHERE table_name IN ('A', 'B')) LOOP
         DBMS_STATS.gather_table_stats (ownname               => USER
                                      , tabname               => x.table_name
                                      , partname              => NULL
                                      , estimate_percent      => DBMS_STATS.auto_sample_size
                                      , block_sample          => FALSE
                                      , method_opt            => 'FOR ALL INDEXED COLUMNS SIZE 254'
                                      , degree                => NULL
                                      , granularity           => 'ALL'
                                      , cascade               => TRUE
                                      , no_invalidate         => FALSE
       END LOOP;
    END;
    /Good luck!

  • PLEASE SUGGEST SOME OPTIMIZER HINTS TO TUNE QUERY

    Below is explain plan for query
    SELECT STATEMENT  ALL_ROWSCost: 607,111  Bytes: 169  Cardinality: 1                                                         
         18 HASH GROUP BY  Cost: 607,111  Bytes: 169  Cardinality: 1                                                    
              17 FILTER                                               
                   14 TABLE ACCESS BY LOCAL INDEX ROWID TABLE GL.GL_JE_LINES Cost: 88  Bytes: 72  Cardinality: 2                                          
                        13 NESTED LOOPS  Cost: 408,270  Bytes: 11,384,009  Cardinality: 67,361                                     
                             10 HASH JOIN RIGHT OUTER  Cost: 11,954  Bytes: 5,578,020  Cardinality: 41,940                                
                                  1 TABLE ACCESS FULL TABLE GL.GL_JE_CATEGORIES_TL Cost: 9  Bytes: 7,530  Cardinality: 251                           
                                  9 HASH JOIN  Cost: 11,942  Bytes: 4,319,820  Cardinality: 41,940                           
                                       7 MERGE JOIN CARTESIAN  Cost: 4,171  Bytes: 4,233  Cardinality: 51                      
                                            2 TABLE ACCESS FULL TABLE XXFC.XXFC_COMPARATIVO_SD_GL_MAPEO Cost: 27  Bytes: 59,740  Cardinality: 1,030                 
                                            6 BUFFER SORT  Cost: 1.84467440737096E19  Bytes: 1,275  Cardinality: 51                 
                                                 5 SORT UNIQUE  Cost: 4  Bytes: 1,275  Cardinality: 51            
                                                      4 TABLE ACCESS BY INDEX ROWID TABLE GL.GL_PERIODS Cost: 4  Bytes: 1,275  Cardinality: 51       
                                                           3 INDEX RANGE SCAN INDEX XXFC.IDX_GL_PERIODS_PORTAL Cost: 1  Cardinality: 51 
                                       8 TABLE ACCESS FULL TABLE GL.GL_CODE_COMBINATIONS Cost: 7,684  Bytes: 45,138,000  Cardinality: 2,256,900                      
                             12 PARTITION RANGE ITERATOR  Cost: 3  Cardinality: 108  Partition #: 15                                
                                  11 INDEX RANGE SCAN INDEX GL.GL_JE_LINES_N1 Cost: 3  Cardinality: 108  Partition #: 15                           
                   16 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE GL.GL_JE_HEADERS Cost: 3  Bytes: 23  Cardinality: 1  Partition #: 17                                          
                        15 INDEX UNIQUE SCAN INDEX (UNIQUE) GL.GL_JE_HEADERS_U1 Cost: 2  Cardinality: 1                                     

    You must provide sufficient information for us to answer your question. Please read Rob Van Wijk's helpful guide on the sort of things we need to know (and incidentally how you can start to solve your problem yourself): [When your query takes too long|http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]. Randolf Geist has knocked up a [HOW TO: Post a SQL statement tuning request  |http://forums.oracle.com/forums/thread.jspa?threadID=863295] which is a template of the helpful way to layout a tuning question. Also, read [his blog on the topic|http://oracle-randolf.blogspot.com/2009/02/basic-sql-statement-performance.html]
    You might also benefit from reading [Tom Kyte&#146;s advice on how to ask questions|http://tkyte.blogspot.com/2005/06/how-to-ask-questions.html].
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Query with union

    Hi,
    I have three table:
    Candidates: (candidate_id primary key)
    Purhcase_orders: (Po_number primary key)
    Bids: (bid_number primary key)
    Just wanted to retrieve candidate information like candidate_id, first_name etc, along with count of purchase orders issued against this candidate and count of bid_number.
    For that I have written below query:
    query - 1:
    SELECT CANDIDATE_ID,
    INITCAP (first_name) FIRST_NAME,
    +(SELECT COUNT (DISTINCT bid_number)+
    FROM bids
    WHERE BIDS.CANDIDATE_ID = cand.candidate_id)
    BID_COUNT,
    +(SELECT COUNT (DISTINCT po_number)+
    FROM purchase_orders po
    WHERE PO.CONTRACTEE_ID = cand.candidate_id)
    PO_COUNT,
    +'Y' match_flag,+
    DECODE ( (SELECT candidate_id
    FROM v_ineligible_candidates vic
    WHERE VIC.CANDIDATE_ID = cand.candidate_id),
    NULL, 'N',
    +'Y')+
    INELIGIBLE_FLAG
    FROM candidates cand
    Based on business requirement, need to create another set of query (query -2) same like above. In that we have some decode statements to calculate match_flag, then need to perform UNION operation between query -1 and query -2.
    have around 130563 number of rows in candidates table.
    Individually both queries are taking 500 msec.
    But when I have used union, it didnt give result for atleast 60 sec. Then I cancelled execution.
    Execution plan for the final query with UNION: (final cost)
    Cost: 2,873  Bytes: 9,130,170  Cardinality: 260,862                
    Please help me in this issue.
    Why its taking that much time in union.
    Please correct my mistake and suggest me in this query.
    UNION ALL is running but not UNION.
    Thanks in advance

    Please post complete Explain Plans.
    To get detailed information of Explain Plan use
    explain plan for
    your_query;
    select *
      from table(dbms_xplan.display(null, null, 'ALL'));Post it alongwith below details between {noformat}{noformat} (exactly as specified) tags to preserve formatting and ease of understanding.
    On your requirement,
    Using UNIONALL you will get two set of rows, with UNION you might get a single row if your MATCH_FLAG are same for both queries. Use of either, has to meet your requirements than to meet your performance. If it is Business Acceptable, then look for performance and tuning.
    If you could do the folllowing, it might be helpful for you.
    1. Post the Sample table structure (Table information of Candidates should suffice) in a Create Table/With Sub-Query clause.
    2. Sample Data in Insert Into/With Sub-Query format.
    3. Expected Outcome based on Sample data
    4. The Explain Plan of your Queries as requested above.
    Reason of asking these details are, there might be a way to avoid Hitting the table Twice and avoid use of UNION/UNIONALL clauses.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Optimize SQL  query

    Hi All,
    Please help me to optimize my below SQL  query :
    delete from BATCH_REQUEST_RESPONSE where (SOState='ResponseReceived' or SOState='Header’ or SOState='InvalidSO’) and ACKREC='Y' and SourceAgentId=? and BATCH_REQUEST_RESPONSE.TransactionId NOT EXISTS (select transactionid from SORECORD)
    Note: Result of (select transactionid from SORECORD ) could be till 100 K
    Regards,
    Dheeraj

    Maybe - I'm not sure what you're after
    delete from batch_request_response brr
    where sostate in ('ResponseReceived','Header','InvalidSO')
       and ackrec = 'Y'
       and sourceagentid = :agent_id
       and not exists(select null
                        from sorecord
                       where transactionid = brr.transactionid
    delete from batch_request_response brr
    where sostate in ('ResponseReceived','Header','InvalidSO')
       and ackrec = 'Y'
       and sourceagentid = :agent_id
       and 0 = (select count(*)
                  from sorecord
               ) /* if sorecord must be empty */
    Regards
    Etbin

  • Optimization of select query

    How to optimize the below select query
      SELECT mvke~matnr                     "Material Number
             mbew~bwkey                     "Plant
             mvke~mvgr1                     "Line of Business
             mara~meins                     "Unit of measure
             mara~ntgew                     "Net weight
             mara~mhdrz                     "Remaining shelf life
             mara~zzmax_exp_days            "Max expiry days
             makt~maktx                     "Material Description
             tvm1t~bezei                    "Line of Business description
             mbew~stprs                     "Standard price
             mbew~vprsv                     "Price control (S/V)
             mbew~verpr                     "Variable Price
        FROM mvke INNER JOIN mara
          ON maramatnr EQ mvkematnr
        INNER JOIN makt
          ON maktmatnr EQ mvkematnr
        INNER JOIN tvm1t
          ON tvm1tmvgr1 EQ mvkemvgr1
        INNER JOIN mbew
          ON mbewmatnr EQ maramatnr
         AND
            mbewbwkey EQ mvkevkorg
        INTO TABLE gt_matdata
        WHERE mbew~matnr IN s_matnr  AND
              mbew~bwkey IN s_werks  AND
              mvke~mvgr1 IN s_mvgr1  AND
              makt~spras EQ sy-langu AND
              tvm1t~spras EQ sy-langu.
    Please advice.
    Thanks and Regards
    Syed Samdani

    Hi,
    You are taking different fields of data from five different tables it seems.
    Well you can take separate internal tables and fire five separate select queries using the 'For All Entries' condition after the first select stmnt, so that u get all the related data. Then take your final internal table and merge all data from all these five internal tables into you final table.
    Regards,
    Jayadeep

  • (V7.3)NEW FEATURES ABOUT OPTIMIZATION IN RELEASE 7.2 & 7.3

    제품 : ORACLE SERVER
    작성날짜 : 2003-02-24
    (V7.3)NEW FEATURES ABOUT OPTIMIZATION IN RELEASE 7.2 & 7.3
    ==========================================================
    PURPOSE
    Oracle RDBMS V7.2와 V7.3에서 Optimization에 관한 new feature를
    알아보기로 한다.
    Explanation
    다음과 같은 대표적인 기능 9가지가 있습니다.
    1> Direct Database Reads
    Parallel query 프로세스들은 필터링이나, 소팅, 조인과 같은 작업을
    수행하기 위해서는 아주 큰 테이블을 scanning해야 합니다. Direct Database
    Reads는 read efficiency와 성능의 향상을 위해 contiguous memory read를
    가능하게 해줍니다.
    또한, concurrent OLTP와 같은 작업을 수행시 따르는 경합을 없애기
    위해 버퍼 캐쉬를 bypass합니다.
    2> Direct Database Writes
    Parallel query 프로세스들은 intermediate sort runs, summarization
    (CREATE TABLE AS SELECT), index creation(CREATE INDEX)과 같은 작업의
    수행 결과를 디스크에 종종 기록해야 합니다.
    Direct Database Writes는 write efficiency와 성능의 향상을 위해
    direct contiguous memory로 하여금 contiguous disk writes를 가능하게
    해줍니다.
    또한, concurrent OLTP 작업과 DBWR 프로세스에 의한 경합을 없애기 위해
    버퍼 캐쉬를 bypass합니다.
    결론적으로, Direct Database Reads와 Writes는 concurrent OLTP와 DSS
    작업에 따르는 복잡한 부하를 조절하면서 Oracle 7 서버를 분리된 형태로,
    또한 최적의 튜닝을 가능하게 해줍니다.
    3> Asynchronous I/O
    Oracle 7은 이미 sorts, summarization, index creation, direct-path
    loading 에 대한 asynchronous write 기능을 제공하고 있습니다.
    Release 7.3부터는 보다 나은 성능의 향상을 위해 asynchronous
    read-ahead 기능을 제공하여 최대한 processing과 I/O의 병행성을 증가
    시켜 줍니다.
    4> Parallel Table Creation
    CREATE TABLE ... AS SELECT ...와 같은 구문을 제공하여 상세한 데이타를
    갖는 큰 테이블의 조회된 결과를 저장하기 위해 임시 테이블을 생성합니다.
    이 기능은 보통 intermediate operation의 결과를 저장하기 위해
    drill-down 분석을 할 때 사용됩니다.
    5> Support for the Star Query Optimization
    Oracle 7은 수행 속도의 향상을 위해 star 스키마가 존재하고, star query
    optimization을 invoke 합니다. Star query는 먼저 여러 개의 작은 테이블을
    join하고, 그런 후에, 그 결과를 하나의 큰 테이블로 join합니다.
    6> Intelligent Function Shipping
    Release 7.3부터 parallel query를 처리하는 coordinator 프로세스는
    non-shared memory machine(cluster 또는 MPP) 내의 노드들을 처리하기
    위해 디스크나 데이타들 간의 유사성에 대해 인식하게 될 것입니다.
    이 사실에 근거하여, coordinator는 data들이 machine의 shared
    interconnect를 통해 전달될 필요가 없다는 점에서, 특정 node-disk pair로
    수행되고 있는 프로세스들에게 parallel query operation을 지정할 수
    있습니다.
    이 기능은 연관된 cost나 overhead없이 'shared nothing' 소프트웨어
    아키텍쳐의 잇점을 제공하면서 효율성과 성능, 확장성을 개선할 수 있습니다.
    7> Histograms
    Release 7.3부터 Oracle optimizer는 테이블의 컬럼 내에 있는 데이타 값의
    분포에 관한 더 많은 정보를 이용할 수 있습니다. Value와 상대적 빈도수를
    나타내는 histogram은 optimizer에게 index의 상대적'selectivity'에 관한
    정보와 어떤 index를 사용해야할 지에 관한 더 좋은 아이디어를 제공해
    줄 것입니다.
    적절한 선택을 한다면, query의 수행시간을 몇 분, 심지어 몇 시간씩이나
    단축시킬 수가 있습니다.
    8> Parallel Hash Joins
    Release 7.3부터 Oracle 7은 join 처리시간의 단축을 위하여 hash join을
    제공합니다. 해슁 테크닉을 사용하면 join을 하기 위해 데이타를 소트하지
    않아도 되며, 기존에 존재하는 인덱스를 사용하지 않으면서 'on-the-fly'
    라는 개념을 제공합니다. 따라서, star schema 데이타베이스에 전형적으로
    적용되는 small-to-large 테이블 join의 수행 속도를 향상시킬 것입니다.
    9> Parallel UNION and UNION ALL
    Release 7.3부터 Oracle 7은 UNION과 UNION ALL과 같은 set operator를
    사용하여 완전히 parallel하게 query를 수행할 수 있습니다. 이러한
    operator를 사용하면, 큰 테이블들을 여러 개의 작은 테이블의 집합으로
    나누어 처리하기가 훨씬 쉬워질 것입니다.
    Example
    none
    Reference Documents
    none

    Sorry for the confusion!
    I'll clear it up right now - I'm currently running 10.7.2 - please disregard SL 10.6.8, that was from the past. I updated to 10.7.3, the new checkmark appeared. I noticed a few other stability issues in 10.7.3, so returned to 10.7.2. As for Mountain Lion - I saw a friend's Mac running ML (I assume he had a Dev account), and noticed the new checkmark as well.
    Here's the pictures to show the comparison:
    10.7.2 Checkmark
    10.7.3/ML Checkmark:
    See the difference? My question is, I don't want the new checkmark in 10.7.3. I think, personally, it's hideous and very iOS-like. Is there a way I can "hack" a resource file, or copy over a file from 10.7.2 into 10.7.3 to bring back the original checkmark used in 10.7.2 and all prior versions of OSX? I'm not sure, but it seems like some kind of font is used for the checkmark, but I'm not sure. I'm still a bit new to OSX.
    If anyone knows, or has any idea, that would be much appreciated! Again, I know it's a bit nitpicky

  • Optimizing this query....

    I have a query for the following
    select x.date_required, sum(x.t_score) as t-score from
    (select tv.business_date as date_required, sum(tv.score) as t_score from table1 tv
    where tv.type like 'blue'
    union all
    select ta.business_date as date_required, sum(ta.score) as t_score from table1 ta
    where ta.type like 'White'
    union all
    select tg.business_date as date_required, sum(tg.score) as t_score from table1 tg
    where tg.type like 'green') x
    group by x.date_required;
    I would like to optimize it to make it simplier. Thank you.

    Hi,
    There are errors in the query you posted, so it's hard to know what you're trying to do.
    For starters, find a way to avoid the UNION. For example:
    SELECT        business_date          AS date_required
    ,       SUM (score)          AS t_score
    FROM       table1
    WHERE       type     IN ('blue', 'white', 'green')
    GROUP BY  business_date
    ;If you're not using wild-cards, don't use LIKE; it's slower than = or IN.
    Do you have an index on type?
    The following thread show what you need to do for optimization questions:
    When your query takes too long ...

  • Heavy CPU Utilization of Dictionary Query - After 9i to 10g Upgrade

    Hi Friends,
    We have migrated our production DB from Oracle 9i(Windows) to Oracle 10g(AIX) and after that a heavy cpu utilization query is coming frequently and hence many timeouts are happening in the application.
    Application is connecting to the database through Java Application (JDBC).
    Once the application service is started, below query is invoked and CPU takes around 20% continuously.
    The interesting thing is this query is not owned by the application schema but by SYS and it's invoked from Application Schema.
    We have raised an SR but still no luck.
    Any help will be very much appreciated.
    SELECT -- Packaged procedures with no arguments package_name AS procedu
    re_cat, owner AS procedure_schem, object_name AS procedure_name, NULL
    , NULL, NULL, 'Packaged procedure' AS remarks, 1 AS procedure_type
    FROM all_arguments WHERE argument_name IS NULL AND data_type IS NULL AN
    D package_name LIKE :3 ESCAPE '/' AND owner LIKE :4 ESCAPE '/' AND obje
    ct_name LIKE :5 ESCAPE '/' UNION ALL SELECT -- Packaged procedures with a
    rguments package_name AS procedure_cat, owner AS procedure_schem, obj
    ect_name AS procedure_name, NULL, NULL, NULL, 'Packaged procedure'
    AS remarks, 1 AS procedure_type FROM all_arguments WHERE argument_name IS
    NOT NULL AND position = 1 AND position = sequence AND package_name L
    IKE :3 ESCAPE '/' AND owner LIKE :4 ESCAPE '/' AND object_name LIKE :5
    ESCAPE '/' UNION ALL SELECT -- Packaged functions package_name AS proce
    dure_cat, owner AS procedure_schem, object_name AS procedure_name, NU
    LL, NULL, NULL, 'Pa
    Regards,
    Savad
    Edited by: user9292816 on May 9, 2011 4:35 AM

    Hi,
    We couldn't find anything in the alert log related to this.
    But we have taken the explain plan from both DBs as shown below.
    PLan of the Query in Oracle 9.2.0.8(Windows - Old DB )
    SQL> select * from table(dbms_xplan.display());
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | | | |
    | 1 | SORT ORDER BY | | | | |
    |* 2 | FILTER | | | | |
    |* 3 | TABLE ACCESS BY INDEX ROWID | ARGUMENT$ | | | |
    | 4 | NESTED LOOPS | | | | |
    | 5 | NESTED LOOPS | | | | |
    | 6 | TABLE ACCESS BY INDEX ROWID| USER$ | | | |
    |* 7 | INDEX RANGE SCAN | I_USER1 | | | |
    | 8 | TABLE ACCESS BY INDEX ROWID| OBJ$ | | | |
    |* 9 | INDEX RANGE SCAN | I_OBJ2 | | | |
    |* 10 | INDEX RANGE SCAN | I_ARGUMENT2 | | | |
    |* 11 | FIXED TABLE FULL | X$KZSPR | | | |
    |* 12 | TABLE ACCESS BY INDEX ROWID | OBJAUTH$ | | | |
    | 13 | NESTED LOOPS | | | | |
    | 14 | FIXED TABLE FULL | X$KZSRO | | | |
    |* 15 | INDEX RANGE SCAN | I_OBJAUTH2 | | | |
    Predicate Information (identified by operation id):
    2 - filter("SYS_ALIAS_1"."OWNER#"=:B1 OR EXISTS (SELECT /*+ */ 0 FROM
    "X$KZSPR" "X$KZSPR" WHERE "X$KZSPR"."INST_ID"=:B2 AND
    ((-"X$KZSPR"."KZSPRPRV")=(-144) OR (-"X$KZSPR"."KZSPRPRV")=(-141))) OR EXISTS
    (SELECT 0 FROM "SYS"."OBJAUTH$" "OBJAUTH$","X$KZSRO" "X$KZSRO" WHERE
    "OBJAUTH$"."OBJ#"=:B3 AND "OBJAUTH$"."GRANTEE#"="X$KZSRO"."KZSROROL" AND
    "OBJAUTH$"."PRIVILEGE#"=12))
    3 - filter(("A"."ARGUMENT" LIKE :Z ESCAPE '/' OR "A"."ARGUMENT" IS NULL AND
    DECODE("A"."TYPE#",0,NULL,1,DECODE("A"."CHARSETFORM",2,'NVARCHAR2','VARCHAR2'),2,
    DECODE("A"."SCALE",(-127),'FLOAT','NUMBER'),3,'NATIVE
    INTEGER',8,'LONG',9,DECODE("A"."CHARSETFORM",2,'NCHAR
    VARYING','VARCHAR'),11,'ROWID',12,'DATE',23,'RAW',24,'LONG
    RAW',29,'BINARY_INTEGER',69,'ROWID',96,DECODE("A"."CHARSETFORM",2,'NCHAR','CHAR')
    ,102,'REF CURSOR',104,'UROWID',105,'MLSLABEL',106,'MLSLABEL',110,'REF',111,'REF',
    112,DECODE("A"."CHARSETFORM",2,'NCLOB','CLOB'),113,'BLOB',114,'BFILE',115,'CFILE'
    ,121,'OBJECT',122,'TABLE',123,'VARRAY',178,'TIME',179,'TIME WITH TIME
    ZONE',180,'TIMESTAMP',181,'TIMESTAMP WITH TIME ZONE',231,'TIMESTAMP WITH LOCAL
    TIME ZONE',182,'INTERVAL YEAR TO MONTH',183,'INTERVAL DAY TO SECOND',250,'PL/SQL
    RECORD',251,'PL/SQL TABLE',252,'PL/SQL BOOLEAN','UNDEFINED') IS NOT NULL) AND
    DECODE("A"."PROCEDURE$",NULL,NULL,"SYS_ALIAS_1"."NAME") LIKE :Z ESCAPE '/' AND
    NVL("A"."PROCEDURE$","SYS_ALIAS_1"."NAME") LIKE :Z ESCAPE '/')
    7 - access("U"."NAME" LIKE :Z ESCAPE '/')
    filter("U"."NAME" LIKE :Z ESCAPE '/')
    9 - access("SYS_ALIAS_1"."OWNER#"="U"."USER#")
    10 - access("SYS_ALIAS_1"."OBJ#"="A"."OBJ#")
    11 - filter("X$KZSPR"."INST_ID"=:B1 AND ((-"X$KZSPR"."KZSPRPRV")=(-144) OR
    (-"X$KZSPR"."KZSPRPRV")=(-141)))
    12 - filter("OBJAUTH$"."PRIVILEGE#"=12)
    15 - access("OBJAUTH$"."GRANTEE#"="X$KZSRO"."KZSROROL" AND
    "OBJAUTH$"."OBJ#"=:B1)
    Note: rule based optimization
    PLan of the Query in Oracle 10.2.0.5.3(AIX - New DB )
    ?PLAN_TABLE_OUTPUT
    Plan hash value: 2991281545
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 109 | 451 (3)| 00:00:06 |
    | 1 | SORT ORDER BY | | 1 | 109 | 451 (3)| 00:00:06 |
    |* 2 | FILTER | | | | | |
    |* 3 | HASH JOIN | | 3 | 327 | 450 (3)| 00:00:06 |
    |* 4 | HASH JOIN | | 12 | 1128 | 448 (3)| 00:00:06 |
    |* 5 | TABLE ACCESS FULL | ARGUMENT$ | 4821 | 291K| 259 (3)| 00:00:04 |
    | 6 | TABLE ACCESS FULL | OBJ$ | 56329 | 1760K| 187 (2)| 00:00:03 |
    | 7 | TABLE ACCESS BY INDEX ROWID| USER$ | 6 | 90 | 2 (0)| 00:00:01 |
    |* 8 | INDEX RANGE SCAN | I_USER1 | 2 | | 1 (0)| 00:00:01 |
    |* 9 | FIXED TABLE FULL | X$KZSPR | 1 | 26 | 0 (0)| 00:00:01 |
    | 10 | NESTED LOOPS | | 2 | 50 | 2 (0)| 00:00:01 |
    |* 11 | INDEX RANGE SCAN | I_OBJAUTH1 | 1 | 12 | 2 (0)| 00:00:01 |
    |* 12 | FIXED TABLE FULL | X$KZSRO | 2 | 26 | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter("OWNER#"=USERENV('SCHEMAID') OR EXISTS (SELECT 0 FROM SYS."X$KZSPR"
    "X$KZSPR" WHERE ((-"KZSPRPRV")=(-144) OR (-"KZSPRPRV")=(-141)) AND
    "INST_ID"=USERENV('INSTANCE')) OR EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$"
    "OBJAUTH$",SYS."X$KZSRO" "X$KZSRO" WHERE "GRANTEE#"="KZSROROL" AND "OBJ#"=:B1 AND
    "PRIVILEGE#"=12))
    3 - access("O"."OWNER#"="U"."USER#")
    4 - access("O"."OBJ#"="A"."OBJ#")
    filter(NVL("A"."PROCEDURE$","O"."NAME") LIKE :2 ESCAPE '/' AND
    DECODE("A"."PROCEDURE$",NULL,NULL,"O"."NAME") LIKE :3 ESCAPE '/')
    5 - filter("A"."ARGUMENT" LIKE :5 ESCAPE '/' OR "A"."ARGUMENT" IS NULL AND
    DECODE("A"."TYPE#",0,NULL,1,DECODE("A"."CHARSETFORM",2,'NVARCHAR2','VARCHAR2'),2,DECO
    DE("A"."SCALE",(-127),'FLOAT','NUMBER'),3,'NATIVE
    INTEGER',8,'LONG',9,DECODE("A"."CHARSETFORM",2,'NCHAR
    VARYING','VARCHAR'),11,'ROWID',12,'DATE',23,'RAW',24,'LONG
    RAW',29,'BINARY_INTEGER',69,'ROWID',96,DECODE("A"."CHARSETFORM",2,'NCHAR','CHAR'),100
    ,'BINARY_FLOAT',101,'BINARY_DOUBLE',102,'REF
    CURSOR',104,'UROWID',105,'MLSLABEL',106,'MLSLABEL',110,'REF',111,'REF',112,DECODE("A"
    ."CHARSETFORM",2,'NCLOB','CLOB'),113,'BLOB',114,'BFILE',115,'CFILE',121,'OBJECT',122,
    'TABLE',123,'VARRAY',178,'TIME',179,'TIME WITH TIME
    ZONE',180,'TIMESTAMP',181,'TIMESTAMP WITH TIME ZONE',231,'TIMESTAMP WITH LOCAL TIME
    ZONE',182,'INTERVAL YEAR TO MONTH',183,'INTERVAL DAY TO SECOND',250,'PL/SQL
    RECORD',251,'PL/SQL TABLE',252,'PL/SQL BOOLEAN','UNDEFINED') IS NOT NULL)
    8 - access("U"."NAME" LIKE :1 ESCAPE '/')
    filter("U"."NAME" LIKE :1 ESCAPE '/')
    9 - filter(((-"KZSPRPRV")=(-144) OR (-"KZSPRPRV")=(-141)) AND
    "INST_ID"=USERENV('INSTANCE'))
    11 - access("OBJ#"=:B1 AND "PRIVILEGE#"=12)
    filter("PRIVILEGE#"=12)
    12 - filter("GRANTEE#"="KZSROROL")
    52 rows selected.
    Regards,
    Savad

  • Issue in executing contains Query(Oracle 11g Enterprise E on Linux RHEL 4

    Oracle Version: 11.1.0.6.0
    We are facing problem in executing contains Query :
    1.When length of string inside contains clause goes beyond 4000 it gives error ORA-01704: string literal too long
    2.We try to modify query by breaking it into multiple contains clause but it was not giving good performance (performance degrades as number of contains clauses increases.)It seems accessing same index multiple times becoming costly and taking more time. (We can see same domain Index has been accessed 3 times for 3 contains clause ()
    3.We used multiple varchar(4000) type bind variable in single contains clause but giving error
         ORA-29902: error in executing ODCIIndexStart() routine
         ORA-01489: result of string concatenation is too long
    4.We used bind variable of type clob but giving error
    Error:
    ORA-29902: error in executing ODCIIndexStart() routine
         ORA-20000: Oracle Text error:
         DRG-50857: oracle error in drexrstart_clob
    I read from article
    http://www.oracle.com/technology/products/text/pdf/ot11g_new_features.pdf
    That we don’t need to modified query as we had to do with SDATA(as we are doing in above examples) and optimizer will realize that query can be satisfied by the text index and will “push down” the filtering of rows into the text index processor rather than doing table access for filtering on sdata column but when I tried to write that query it was doing table access to filter for filter by column.
    My Questions:
    a.     Is it possible as mentioned in above point(point number 5) that we don’t need to write SDATA query in contains clause and optimizer will use composite index automatically.
    b.     Is there any workaround for using string literal > 4000 char in contains clause.
    c.     Why performance degrades lineally when using multiple contains clause.
    d.     Can we use in clause in SDATA and write query like this:
    i.     SDATA(queryid in ( 'q1',’q2’))
    /* Table */
    create table ContentStore (ResourceID raw(16), QueryID VARCHAR2(38),IFID VARCHAR2(38),ISTimeStamp number,ISProtocolName VARCHAR2(100),ismimecontenttype varchar2(100),ISToBeDisplayed number(1),IndexedMetaText CLOB)
    /* Index */
    create index idxMeta on ContentStore (IndexedMetaText) indextype is ctxsys.context filter by queryid,IFID,istimestamp,isprotocolname,ismimecontenttype,resourceid,istobedisplayed order by istimestamp desc parameters('filter ctxsys.null_filter section group GRP_system2 sync(every "sysdate+1/(24*4)" MEMORY 209715200 PARALLEL 2) storage my_text_storage memory 209715200')parallel 2
    /* GRP_system2*/
    begin
    ctx_ddl.create_section_group('GRP_system2', 'BASIC_SECTION_GROUP');
    ctx_ddl.add_field_section('GRP_system2', 'FILENAME', 'FILENAME');
    ctx_ddl.add_field_section('GRP_system2', 'ISIPSrcIP', 'ISIPSrcIP');
    ctx_ddl.add_field_section('GRP_system2', 'ISProxyUserIP', 'ISProxyUserIP');
    ctx_ddl.add_field_section('GRP_system2', 'isipdestip', 'isipdestip');
    end;
    /* 1.When length of string inside contains clause goes beyond 4000 it gives
         error ORA-01704: string literal too long */
    select indexedmetatext from ContentStore where rowid in ( select oraclerowid from ( select rowid as oraclerowid from ContentStore where contains(indexedmetatext,'((68.142.91.152 within isipsrcip) or (68.142.91.152 within isproxyuserip) or (68.142.91.152 within isipdestip)) and ((sdata(queryid = ''a51f216a-b211-4b59-89d4-6fcce58a8517'')) or (sdata(queryid = ''c7d7fdb3-e532-42f1-a8b4-450771fc763f'')) or (sdata(queryid = ''7746f95a-01ba-4318-991a-35c2a8a0c73d'')) or (sdata(queryid = ''b0d339d2-ada9-485b-b752-79920a589340'')) or (sdata(queryid = ''33083cc8-7ed0-4a67-81f0-de1f3d673db2'')) or (sdata(queryid = ''0475dea9-288b-4be6-815e-751c98c25f2b'')) or (sdata(queryid = ''8cfb62f4-2bac-4da6-a2c2-84e409f5a810'')) or (sdata(queryid = ''afbf17a7-4170-45f4-9b66-de3860de93d7'')) or (sdata(queryid = ''750a7b1c-db61-4f87-b78f-505bc73aa5df'')) or (sdata(queryid = ''debc06f3-51a8-4278-9d38-f316dfb6340c'')) or (sdata(queryid = ''d2d8d8a8-b691-439f-b6de-618825aad152'')) or (sdata(queryid = ''f6a3515a-4c7b-48d0-8d46-f62541525cd0'')) or (sdata(queryid = ''bef5c527-5e78-494f-832c-12b3967f22cc'')) or (sdata(queryid = ''638a4029-c4bf-42ef-87bc-2cd4a3977dd1'')) or (sdata(queryid = ''1ce38c22-fd80-4d0f-b9ab-1a09941c5809'')) or (sdata(queryid = ''7bbbcc66-f19d-4758-bdd8-2796da1e26fe'')) or (sdata(queryid = ''d3e96050-ab5e-48b7-9445-d884167c8ae9'')) or (sdata(queryid = ''eaf93ce1-fbd8-4bb6-9fb1-12c337878c72'')) or (sdata(queryid = ''ef1ce7ce-9b4a-4f10-9c91-7256f513c709'')) or (sdata(queryid = ''46bf5cda-ada3-41f2-92b0-174ac29c5808'')) or (sdata(queryid = ''59136e92-147f-41c4-ac75-79d921268714'')) or (sdata(queryid = ''fb2382b2-6496-4c9f-a427-2f6db3b9fd16'')) or (sdata(queryid = ''531b3790-ed50-4b83-a0d0-eabfed2b6701'')) or (sdata(queryid = ''4908b148-2432-4041-947c-31ff8e10646c'')) or (sdata(queryid = ''82007d26-d526-42c9-a8d0-5b75e7f08b90'')) or (sdata(queryid = ''002735e8-6886-4bb4-a732-8a9d04165837'')) or (sdata(queryid = ''43f25cba-1d90-4cc2-84d1-a8719c5b1c9f'')) or (sdata(queryid = ''99d9027f-948b-4bc7-9a44-3092d6b29580'')) or (sdata(queryid = ''24221285-ea64-4e14-8c08-a173ec1b7fd9'')) or (sdata(queryid = ''47ad81d7-75cb-4787-91ab-c2bc5c5e1aaa'')) or (sdata(queryid = ''4ff2846f-6d70-4f9b-a5bf-317263c0ccc5'')) or (sdata(queryid = ''c1f5fbe7-72d1-499d-8d72-4aa21a79c97e'')) or (sdata(queryid = ''356f12c5-a769-478d-b57b-8a063be8ee8e'')) or (sdata(queryid = ''f6181853-2e16-4bce-88c0-6602bc853935'')) or (sdata(queryid = ''890f80e9-f3dd-4862-a55c-4f76569df360'')) or (sdata(queryid = ''5e9df138-8377-4841-92de-49bf6ed378a5'')) or (sdata(queryid = ''600b4dfd-e379-4754-8d06-873b593dbd14'')) or (sdata(queryid = ''af1476ac-3742-4272-bc97-584b1bbe3e2b'')) or (sdata(queryid = ''c2eb4e4c-2d09-4be8-b6ba-f1440349ed5a'')) or (sdata(queryid = ''2b819cdb-0941-48fd-8b93-dd1f661933b3'')) or (sdata(queryid = ''dfa094c9-c48c-4ca1-ad06-ead4f1a9d146'')) or (sdata(queryid = ''b1222061-acaf-4e85-80e1-00af07df962c'')) or (sdata(queryid = ''219b0c7b-266e-455b-b7ca-4f760976253c'')) or (sdata(queryid = ''2396f1e3-28f8-451b-a114-29390cec0cf3'')) or (sdata(queryid = ''c7d7fdb3-e532-42f1-a8b4-450771fc763f'')) or (sdata(queryid = ''7746f95a-01ba-4318-991a-35c2a8a0c73d'')) or (sdata(queryid = ''b0d339d2-ada9-485b-b752-79920a589340'')) or (sdata(queryid = ''33083cc8-7ed0-4a67-81f0-de1f3d673db2'')) or (sdata(queryid = ''0475dea9-288b-4be6-815e-751c98c25f2b'')) or (sdata(queryid = ''8cfb62f4-2bac-4da6-a2c2-84e409f5a810'')) or (sdata(queryid = ''afbf17a7-4170-45f4-9b66-de3860de93d7'')) or (sdata(queryid = ''750a7b1c-db61-4f87-b78f-505bc73aa5df'')) or (sdata(queryid = ''debc06f3-51a8-4278-9d38-f316dfb6340c'')) or (sdata(queryid = ''d2d8d8a8-b691-439f-b6de-618825aad152'')) or (sdata(queryid = ''f6a3515a-4c7b-48d0-8d46-f62541525cd0'')) or (sdata(queryid = ''bef5c527-5e78-494f-832c-12b3967f22cc'')) or (sdata(queryid = ''638a4029-c4bf-42ef-87bc-2cd4a3977dd1'')) or (sdata(queryid = ''1ce38c22-fd80-4d0f-b9ab-1a09941c5809'')) or (sdata(queryid = ''7bbbcc66-f19d-4758-bdd8-2796da1e26fe'')) or (sdata(queryid = ''d3e96050-ab5e-48b7-9445-d884167c8ae9'')) or (sdata(queryid = ''eaf93ce1-fbd8-4bb6-9fb1-12c337878c72'')) or (sdata(queryid = ''ef1ce7ce-9b4a-4f10-9c91-7256f513c709'')) or (sdata(queryid = ''46bf5cda-ada3-41f2-92b0-174ac29c5808'')) or (sdata(queryid = ''59136e92-147f-41c4-ac75-79d921268714'')) or (sdata(queryid = ''fb2382b2-6496-4c9f-a427-2f6db3b9fd16'')) or (sdata(queryid = ''531b3790-ed50-4b83-a0d0-eabfed2b6701'')) or (sdata(queryid = ''2396f1e3-28f8-451b-a114-29390cec0cf3''))) and (sdata(istobedisplayed = 1)) and (sdata(istimestamp >= 1245283200)) and (sdata(istimestamp < 1245369600)) and ((sdata(IFID = ''1eeb7036-cd84-4e4d-be90-e720c7db4470'')))') > 0
    order by istimestamp desc ) where rownum <= 250)
    /* 2.We try to modify query by breaking it into multiple contains clause but it was not giving good performance (performance degrades as number of contains clauses increases.)
    Problem: - Performance of below query degrades linearly as number of contains clause for same column increases.
    Execution plan :
    It seems accessing same index multiple times becoming costly and taking more time. (We can see same domain Index has been accessed 3 times for 3 contains clause ()
    select indexedmetatext from ContentStore where rowid in ( select oraclerowid from ( select rowid as oraclerowid from ContentStore where
    contains(indexedmetatext,'((68.142.91.152 within isipsrcip) or (68.142.91.152 within isproxyuserip) or (68.142.91.152 within isipdestip)) and ((sdata(queryid = ''a51f216a-b211-4b59-89d4-6fcce58a8517'')) or (sdata(queryid = ''c7d7fdb3-e532-42f1-a8b4-450771fc763f'')) or (sdata(queryid = ''7746f95a-01ba-4318-991a-35c2a8a0c73d'')) or (sdata(queryid = ''b0d339d2-ada9-485b-b752-79920a589340'')) or (sdata(queryid = ''33083cc8-7ed0-4a67-81f0-de1f3d673db2'')) or (sdata(queryid = ''0475dea9-288b-4be6-815e-751c98c25f2b'')) or (sdata(queryid = ''8cfb62f4-2bac-4da6-a2c2-84e409f5a810'')) or (sdata(queryid = ''afbf17a7-4170-45f4-9b66-de3860de93d7'')) or (sdata(queryid = ''750a7b1c-db61-4f87-b78f-505bc73aa5df'')) or (sdata(queryid = ''debc06f3-51a8-4278-9d38-f316dfb6340c'')) or (sdata(queryid = ''d2d8d8a8-b691-439f-b6de-618825aad152'')) or (sdata(queryid = ''f6a3515a-4c7b-48d0-8d46-f62541525cd0'')) or (sdata(queryid = ''bef5c527-5e78-494f-832c-12b3967f22cc'')) or (sdata(queryid = ''638a4029-c4bf-42ef-87bc-2cd4a3977dd1'')) or (sdata(queryid = ''1ce38c22-fd80-4d0f-b9ab-1a09941c5809'')) or (sdata(queryid = ''7bbbcc66-f19d-4758-bdd8-2796da1e26fe'')) or (sdata(queryid = ''d3e96050-ab5e-48b7-9445-d884167c8ae9'')) or (sdata(queryid = ''eaf93ce1-fbd8-4bb6-9fb1-12c337878c72'')) or (sdata(queryid = ''ef1ce7ce-9b4a-4f10-9c91-7256f513c709'')) or (sdata(queryid = ''46bf5cda-ada3-41f2-92b0-174ac29c5808'')) or (sdata(queryid = ''59136e92-147f-41c4-ac75-79d921268714'')) or (sdata(queryid = ''fb2382b2-6496-4c9f-a427-2f6db3b9fd16'')) or (sdata(queryid = ''531b3790-ed50-4b83-a0d0-eabfed2b6701'')) or (sdata(queryid = ''4908b148-2432-4041-947c-31ff8e10646c'')) or (sdata(queryid = ''82007d26-d526-42c9-a8d0-5b75e7f08b90'')) or (sdata(queryid = ''002735e8-6886-4bb4-a732-8a9d04165837'')) or (sdata(queryid = ''43f25cba-1d90-4cc2-84d1-a8719c5b1c9f'')) or (sdata(queryid = ''99d9027f-948b-4bc7-9a44-3092d6b29580'')) or (sdata(queryid = ''24221285-ea64-4e14-8c08-a173ec1b7fd9'')) or (sdata(queryid = ''47ad81d7-75cb-4787-91ab-c2bc5c5e1aaa'')) or (sdata(queryid = ''4ff2846f-6d70-4f9b-a5bf-317263c0ccc5'')) or (sdata(queryid = ''c1f5fbe7-72d1-499d-8d72-4aa21a79c97e'')) or (sdata(queryid = ''356f12c5-a769-478d-b57b-8a063be8ee8e'')) or (sdata(queryid = ''f6181853-2e16-4bce-88c0-6602bc853935'')) or (sdata(queryid = ''890f80e9-f3dd-4862-a55c-4f76569df360'')) or (sdata(queryid = ''5e9df138-8377-4841-92de-49bf6ed378a5'')) or (sdata(queryid = ''600b4dfd-e379-4754-8d06-873b593dbd14'')) or (sdata(queryid = ''af1476ac-3742-4272-bc97-584b1bbe3e2b'')) or (sdata(queryid = ''c2eb4e4c-2d09-4be8-b6ba-f1440349ed5a'')) or (sdata(queryid = ''2b819cdb-0941-48fd-8b93-dd1f661933b3'')) or (sdata(queryid = ''dfa094c9-c48c-4ca1-ad06-ead4f1a9d146'')) or (sdata(queryid = ''b1222061-acaf-4e85-80e1-00af07df962c'')) or (sdata(queryid = ''219b0c7b-266e-455b-b7ca-4f760976253c'')) or (sdata(queryid = ''2396f1e3-28f8-451b-a114-29390cec0cf3''))) and (sdata(istobedisplayed = 1)) and (sdata(istimestamp >= 1245283200)) and (sdata(istimestamp < 1245369600)) and ((sdata(IFID = ''1eeb7036-cd84-4e4d-be90-e720c7db4470'')))') > 0
    or
    contains(indexedmetatext,'((68.142.91.152 within isipsrcip) or (68.142.91.152 within isproxyuserip) or (68.142.91.152 within isipdestip)) and ((sdata(queryid = ''f22c0b85-2e72-4450-92b7-8f9864c2517a'')) or (sdata(queryid = ''dbc6111b-5fef-4925-93f0-ecf94aa2305b'')) or (sdata(queryid = ''5d737150-3c55-4582-8b2e-8039615b8e69'')) or (sdata(queryid = ''fc8bf42c-2c7a-4506-aa3a-89266ef09ceb'')) or (sdata(queryid = ''7d3f7561-ba99-49fd-9492-214d9f571831'')) or (sdata(queryid = ''73110ce8-6930-4044-90f7-9c5d27bc0b10'')) or (sdata(queryid = ''d1c975a6-607d-4334-a84c-cc63f68bda3a'')) or (sdata(queryid = ''11fd0d2a-540d-4de0-852a-75f1b841b262'')) or (sdata(queryid = ''0dbfd826-497e-4283-8fc6-210c631c4a3e'')) or (sdata(queryid = ''eb2fd3d3-3b14-4092-a373-edd5448802c2'')) or (sdata(queryid = ''a3b69f62-560b-4883-8bd8-d8225af075b4'')) or (sdata(queryid = ''8596dc3e-c062-4527-9df6-e2c6aa10187d'')) or (sdata(queryid = ''5ce0dea4-b005-4185-9a05-7e91f14c7a8a'')) or (sdata(queryid = ''27eb925f-6f0c-4e27-9b57-91d78de703df'')) or (sdata(queryid = ''53b63124-caf4-4e71-ac5b-0e323d2805cb'')) or (sdata(queryid = ''f3dea938-a547-4510-8c24-25e04fa11ec4'')) or (sdata(queryid = ''5d8ebe7d-224b-4731-a1f2-ef1e3b409579'')) or (sdata(queryid = ''69c8dc53-031a-4069-a9e5-89f28cb7a7e0'')) or (sdata(queryid = ''2f65dc5e-63f6-4904-95f8-94c8983931a9'')) or (sdata(queryid = ''9ce16005-5b3b-4691-a624-5a7835e9e982'')) or (sdata(queryid = ''e5f133c5-f8d3-4905-b4db-ceba89476e7d'')) or (sdata(queryid = ''27dd1a53-a158-46ea-b38d-31a57bd7154e'')) or (sdata(queryid = ''cc335826-5e5e-4d4c-9406-2050717bea5d'')) or (sdata(queryid = ''e1ca6d4d-0005-43ec-a121-5574b37231ec'')) or (sdata(queryid = ''4be550f1-8e0a-4748-8186-50228531751d'')) or (sdata(queryid = ''8637ff63-3d0d-4451-9e40-b890d197f6cd'')) or (sdata(queryid = ''5f664e9e-b72f-4ae7-b69d-081ab7873146'')) or (sdata(queryid = ''baecc6fb-e9cf-41df-9fa4-1793b510d474'')) or (sdata(queryid = ''fa27ba4c-4ab8-4bd0-8725-a03c4666dcde'')) or (sdata(queryid = ''918bfb52-7323-4046-b96a-4ef905687dbb'')) or (sdata(queryid = ''3faad930-81c6-421b-84aa-81a9cfdc2c8b'')) or (sdata(queryid = ''7dc5033d-3a27-4058-885a-d103e73328f2'')) or (sdata(queryid = ''8eb4a0ce-654b-42f0-a868-7f7fdb483a13'')) or (sdata(queryid = ''1b44713f-6cbf-4b49-b851-5a500b221c27'')) or (sdata(queryid = ''11febb09-9106-4b92-a43d-cb71696adc90'')) or (sdata(queryid = ''1d84ca10-375e-4e17-a1c0-03515e1cfe5b'')) or (sdata(queryid = ''9cf1f3fd-136c-4abb-8319-6f6c6ddc514c'')) or (sdata(queryid = ''24f5347a-ff20-4245-a4dc-eb2f8c918c91'')) or (sdata(queryid = ''2640ef3c-8a20-4f28-92df-0bc19b058d91'')) or (sdata(queryid = ''af3d0817-0d40-4adb-9655-a5460805a7eb'')) or (sdata(queryid = ''77b86c41-3afc-4c9c-9432-d7a1ee979af2'')) or (sdata(queryid = ''2a26f0d8-1162-4f34-be48-65b409abef28'')) or (sdata(queryid = ''649810b8-0d7b-47ab-8433-8e9bba88583d'')) or (sdata(queryid = ''c4f853ef-cd7c-436d-a16d-03d49681bee6'')) or (sdata(queryid = ''5c1896ce-06af-406c-bfbd-40d2349171bd'')) or (sdata(queryid = ''8d9fe822-f720-4ee5-a80d-552edd778f82'')) or (sdata(queryid = ''f30220c6-5638-47ec-ad98-4768ee299232'')) or (sdata(queryid = ''3faf5d0b-e3c0-4b68-8244-e07334c17326''))) and (sdata(istobedisplayed = 1)) and (sdata(istimestamp >= 1245283200)) and (sdata(istimestamp < 1245369600)) and ((sdata(IFID = ''1eeb7036-cd84-4e4d-be90-e720c7db4470'')))') > 0
    or
    contains(indexedmetatext,'((68.142.91.152 within isipsrcip) or (68.142.91.152 within isproxyuserip) or (68.142.91.152 within isipdestip)) and ((sdata(queryid = ''c3662b10-98fc-453d-86e1-0c81fe3bb038'')) or (sdata(queryid = ''2b4e7f6e-7871-45eb-b046-bfd4f5d2d84c'')) or (sdata(queryid = ''5af44897-0bc9-4307-bcb1-7f07750e1e25'')) or (sdata(queryid = ''2b57feb3-1681-48db-9856-5d23d69de605'')) or (sdata(queryid = ''47c3939e-d46d-4c7f-9a42-305634642a72'')) or (sdata(queryid = ''476a04ad-6be3-459b-8ab1-6e270416add6'')) or (sdata(queryid = ''61be42b4-11d6-4ff9-a06d-e896690d7fd4'')) or (sdata(queryid = ''97a00e72-2e7d-4c02-b41b-d9d1601bc08c'')) or (sdata(queryid = ''8739fefa-c015-4912-999e-cd9524dffedb'')) or (sdata(queryid = ''61054068-5892-4aaf-ab31-9e6301de9808'')) or (sdata(queryid = ''741a5302-aadc-4bf2-bdcf-b41e95b49d05'')) or (sdata(queryid = ''c13d9ec0-2b18-4838-9bdb-ddb0686fd1d5'')) or (sdata(queryid = ''b02a2176-0ba5-47f4-843d-3d54e3faad77'')) or (sdata(queryid = ''451b906e-3a5c-4ed2-9d94-0a603e6ad94d'')) or (sdata(queryid = ''d1c767d7-cd0a-44c5-a8ff-ce5fa4522ece'')) or (sdata(queryid = ''ca71a03e-26c6-43f3-9755-a248ebaf35b5'')) or (sdata(queryid = ''d93777b8-f03b-49b0-94fc-8019b52c0637'')) or (sdata(queryid = ''e05ebc73-51cb-4112-b685-5104c4884020'')) or (sdata(queryid = ''a1b342c7-9ce0-4aa1-96e8-74621b34d411'')) or (sdata(queryid = ''bde5de4a-b1d4-4edd-9033-6bcba45fcfc2'')) or (sdata(queryid = ''1e345627-c639-4349-95d0-fdfe348935df'')) or (sdata(queryid = ''bd33b778-83c1-4610-a767-f8ce2ade5339'')) or (sdata(queryid = ''54eaa539-e50a-4e95-8d94-f7e95cf0f57b'')) or (sdata(queryid = ''3181ef7a-77cd-405f-9dfa-1c13444efb82'')) or (sdata(queryid = ''0a72bf53-c8ca-405f-9098-9383ed02815a'')) or (sdata(queryid = ''2fb2fff2-b240-46a6-99b8-00521b4325e4'')) or (sdata(queryid = ''5321fa18-a88d-45cb-b8d6-383180cb308b'')) or (sdata(queryid = ''f13bcfdf-d61f-4871-9c74-23ea58204cbb'')) or (sdata(queryid = ''eb5188da-3659-4e7a-b9e4-6985624c3867'')) or (sdata(queryid = ''1679a0ee-6fa7-4c5b-9e0f-09512bc6a74b'')) or (sdata(queryid = ''fd05f61b-5c63-4f99-975e-573ca0f68e8e'')) or (sdata(queryid = ''10802bc7-28bd-43d4-aa24-cf5f9cf6d19f'')) or (sdata(queryid = ''302dbebf-4edd-43a8-93e9-dd6faec8ff14'')) or (sdata(queryid = ''573020da-b5c1-489a-a7d9-eae363e535ef'')) or (sdata(queryid = ''ca514f9e-f4b9-42eb-a8b3-57a384e65540''))) and (sdata(istobedisplayed = 1)) and (sdata(istimestamp >= 1245283200)) and (sdata(istimestamp < 1245369600)) and ((sdata(IFID = ''1eeb7036-cd84-4e4d-be90-e720c7db4470'')))') > 0
    order by istimestamp desc ) where rownum <= 250)
    /* 3.We used multiple varchar(4000) type bind variable in single contains clause but giving error
         ORA-29902: error in executing ODCIIndexStart() routine
         ORA-01489: result of string concatenation is too long
         variable querystring1 varchar2(4000);
    exec :querystring1 := '((sdata(queryid = ''a51f216a-b211-4b59-89d4-6fcce58a8517'')) or (sdata(queryid = ''d1c975a6-607d-4334-a84c-cc63f68bda3a'')) or(sdata(queryid = ''11fd0d2a-540d-4de0-852a-75f1b841b262'')) or(sdata(queryid = ''0dbfd826-497e-4283-8fc6-210c631c4a3e'')) or(sdata(queryid = ''eb2fd3d3-3b14-4092-a373-edd5448802c2'')) or(sdata(queryid = ''a3b69f62-560b-4883-8bd8-d8225af075b4'')) or(sdata(queryid = ''8596dc3e-c062-4527-9df6-e2c6aa10187d'')) or(sdata(queryid = ''5ce0dea4-b005-4185-9a05-7e91f14c7a8a'')) or(sdata(queryid = ''27eb925f-6f0c-4e27-9b57-91d78de703df'')) or(sdata(queryid = ''53b63124-caf4-4e71-ac5b-0e323d2805cb'')) or(sdata(queryid = ''f3dea938-a547-4510-8c24-25e04fa11ec4'')) or(sdata(queryid = ''5d8ebe7d-224b-4731-a1f2-ef1e3b409579'')) or(sdata(queryid = ''69c8dc53-031a-4069-a9e5-89f28cb7a7e0'')) or(sdata(queryid = ''2f65dc5e-63f6-4904-95f8-94c8983931a9'')) or(sdata(queryid = ''9ce16005-5b3b-4691-a624-5a7835e9e982''))) ';
    variable querystring2 varchar2(4000);
    exec :querystring2 := '((sdata(queryid = ''a51f216a-b211-4b59-89d4-6fcce58a8517'')) or (sdata(queryid = ''d1c975a6-607d-4334-a84c-cc63f68bda3a'')) or(sdata(queryid = ''11fd0d2a-540d-4de0-852a-75f1b841b262'')) or(sdata(queryid = ''0dbfd826-497e-4283-8fc6-210c631c4a3e'')) or(sdata(queryid = ''eb2fd3d3-3b14-4092-a373-edd5448802c2'')) or(sdata(queryid = ''a3b69f62-560b-4883-8bd8-d8225af075b4'')) or(sdata(queryid = ''8596dc3e-c062-4527-9df6-e2c6aa10187d'')) or(sdata(queryid = ''5ce0dea4-b005-4185-9a05-7e91f14c7a8a'')) or(sdata(queryid = ''27eb925f-6f0c-4e27-9b57-91d78de703df'')) or(sdata(queryid = ''53b63124-caf4-4e71-ac5b-0e323d2805cb'')) or(sdata(queryid = ''f3dea938-a547-4510-8c24-25e04fa11ec4'')) or(sdata(queryid = ''5d8ebe7d-224b-4731-a1f2-ef1e3b409579'')) or(sdata(queryid = ''69c8dc53-031a-4069-a9e5-89f28cb7a7e0'')) or(sdata(queryid = ''2f65dc5e-63f6-4904-95f8-94c8983931a9'')) or(sdata(queryid = ''9ce16005-5b3b-4691-a624-5a7835e9e982''))) ';
    variable querystring3 varchar2(4000);
    exec :querystring3 := '((sdata(queryid = ''a51f216a-b211-4b59-89d4-6fcce58a8517'')) or (sdata(queryid = ''d1c975a6-607d-4334-a84c-cc63f68bda3a'')) or(sdata(queryid = ''11fd0d2a-540d-4de0-852a-75f1b841b262'')) or(sdata(queryid = ''0dbfd826-497e-4283-8fc6-210c631c4a3e'')) or(sdata(queryid = ''eb2fd3d3-3b14-4092-a373-edd5448802c2'')) or(sdata(queryid = ''a3b69f62-560b-4883-8bd8-d8225af075b4'')) or(sdata(queryid = ''8596dc3e-c062-4527-9df6-e2c6aa10187d'')) or(sdata(queryid = ''5ce0dea4-b005-4185-9a05-7e91f14c7a8a'')) or(sdata(queryid = ''27eb925f-6f0c-4e27-9b57-91d78de703df'')) or(sdata(queryid = ''53b63124-caf4-4e71-ac5b-0e323d2805cb'')) or(sdata(queryid = ''f3dea938-a547-4510-8c24-25e04fa11ec4'')) or(sdata(queryid = ''5d8ebe7d-224b-4731-a1f2-ef1e3b409579'')) or(sdata(queryid = ''69c8dc53-031a-4069-a9e5-89f28cb7a7e0'')) or(sdata(queryid = ''2f65dc5e-63f6-4904-95f8-94c8983931a9'')) or(sdata(queryid = ''9ce16005-5b3b-4691-a624-5a7835e9e982''))) ';
         select indexedmetatext from ContentStore where rowid in ( select oraclerowid from ( select rowid as oraclerowid from ContentStore where contains(indexedmetatext,:querystring1|| ' or ' ||:querystring2|| ' or ' ||:querystring3) > 0 order by istimestamp desc ) where rownum <= 250);
    /* 4.We used bind variable of type clob but giving error
    Error:
    ORA-29902: error in executing ODCIIndexStart() routine
         ORA-20000: Oracle Text error:
         DRG-50857: oracle error in drexrstart_clob
    variable querystring CLOB;
    exec :querystring := '((sdata(queryid = ''a51f216a-b211-4b59-89d4-6fcce58a8517'')) or (sdata(queryid = ''d1c975a6-607d-4334-a84c-cc63f68bda3a'')) or(sdata(queryid = ''11fd0d2a-540d-4de0-852a-75f1b841b262'')) or(sdata(queryid = ''0dbfd826-497e-4283-8fc6-210c631c4a3e'')) or(sdata(queryid = ''eb2fd3d3-3b14-4092-a373-edd5448802c2'')) or(sdata(queryid = ''a3b69f62-560b-4883-8bd8-d8225af075b4'')) or(sdata(queryid = ''8596dc3e-c062-4527-9df6-e2c6aa10187d'')) or(sdata(queryid = ''5ce0dea4-b005-4185-9a05-7e91f14c7a8a'')) or(sdata(queryid = ''27eb925f-6f0c-4e27-9b57-91d78de703df'')) or(sdata(queryid = ''53b63124-caf4-4e71-ac5b-0e323d2805cb'')) or(sdata(queryid = ''f3dea938-a547-4510-8c24-25e04fa11ec4'')) or(sdata(queryid = ''5d8ebe7d-224b-4731-a1f2-ef1e3b409579'')) or(sdata(queryid = ''69c8dc53-031a-4069-a9e5-89f28cb7a7e0'')) or(sdata(queryid = ''2f65dc5e-63f6-4904-95f8-94c8983931a9'')) or(sdata(queryid = ''9ce16005-5b3b-4691-a624-5a7835e9e982''))) ';
    select indexedmetatext from ContentStore where rowid in ( select oraclerowid from ( select rowid as oraclerowid from ContentStore where contains(indexedmetatext,:querystring) > 0 order by istimestamp desc ) where rownum <= 250);
    /* 5.I read from article
    http://www.oracle.com/technology/products/text/pdf/ot11g_new_features.pdf
    That we don’t need to modified query as we had to do with SDATA(as we are doing in above examples) and optimizer will realize that query can be satisfied by the text index and will “push down” the filtering of rows into the text index processor rather than doing table access for filtering on sdata column but when I tried to write that query it was doing table access to filter for filter by column.
    /* 6.My Questions:
    a.     Is it possible as mentioned in above point(point number 5) that we don’t need to write SDATA query in contains clause and optimizer will use composite index automatically.
    b.     Is there any workaround for using string literal > 4000 char in contains clause.
    c.     Why performance degrades lineally when using multiple contains clause.
    d.     Can we use in clause in SDATA and write query like this:
    i.     SDATA(queryid in ( 'q1',’q2’))
    */

    SQE is really breakthrough for me but I dont know why it is not working in my case.I tried it onOracle 11g installaion with window and Linux both but did not get success.
    Please suggest me what I need to check when Installing if it is installation problem?
    My attempt:
    [oracle@oracle2 ~]$ sqlplus / as sysdba
    SQL*Plus: Release 11.1.0.6.0 - Production on Mon Jul 6 12:21:32 2009
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> create user test identified by test;
    User created.
    SQL> grant connect,dba,resource,ctxapp to test;
    Grant succeeded.
    SQL> connect test/test@content;
    Connected.
    SQL> create table test (text varchar2(2000));
    Table created.
    SQL> insert into test values ('hello world');
    1 row created.
    SQL> create index testindex on test(text) indextype is ctxsys.context;
    Index created.
    SQL> exec ctx_query.store_sqe('testsqe', 'hello')
    PL/SQL procedure successfully completed.
    SQL> select * from test where contains (text, 'sqe(testsqe)') > 0;
    select * from test where contains (text, 'sqe(testsqe)') > 0
    ERROR at line 1:
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle Text error:
    DRG-00100: internal error, arguments : [50935],[drpn.c],[1051],[],[]
    ORA-01403: no data found
    SQL> select * from test where contains (text, 'ctx_query.sqe(testsqe)') > 0;
    no rows selected
    SQL>

Maybe you are looking for