Problem with different execution paths in hierarchical query

Hello,
I have problems with the following query:
SELECT DISTINCT P.ID FROM PRODUCTELEMENTIMPL P WHERE ( ( LABEL = 'SomeLabel' AND PRODUCTELEMENTTYPE = 'SomeText' AND ( STATE = 'created' OR STATE = 'stored' OR STATE = 'archived' OR STATE = 'archivedRestored' ) ) ) START WITH P.ID = 42 CONNECT BY PRIOR P.ID = P.PARENT
We have two databases (an Oracle 10g XE and Oracle10g Enterprise). In the XE Database the query is executed very fast, but in the main installation it takes minutes. If I "explain" the query I get two different execution paths:
The fast:
ID      PARENT_ID      LEVEL      SQL      Kosten      Anzahl Zeilen
0      -      1      SELECT STATEMENT      20      49
1      0      2      HASH UNIQUE      20      49
2      1      3      FILTER      -      -
3      2      4      CONNECT BY WITH FILTERING      -      -
4      3      5      TABLE ACCESS BY INDEX ROWID PRODUCTELEMENTIMPL (TABLE)      -      -
5      4      6      INDEX UNIQUE SCAN SYS_C0072201 (INDEX (UNIQUE))      2      1
6      3      5      NESTED LOOPS      -      -
7      6      6      BUFFER SORT      -      -
8      7      7      CONNECT BY PUMP      -      -
9      6      6      TABLE ACCESS BY INDEX ROWID PRODUCTELEMENTIMPL (TABLE)      19      49
10      9      7      INDEX RANGE SCAN PRODUCTELEMENTIMPL_IDX1 (INDEX)      3      49
11      3      5      TABLE ACCESS FULL PRODUCTELEMENTIMPL (TABLE)      19      49
Slow:
ID PARENT_ID LEVEL SQL Kosten Anzahl Zeilen
0 1 SELECT STATEMENT 1 1
1 0 2 HASH UNIQUE 1 1
2 1 3 FILTER
3 2 4 CONNECT BY WITHOUT FILTERING
4 3 5 TABLE ACCESS BY INDEX ROW 3 1
ID PRODUCTELEMENTIMPL (TABLE)
5 4 6 INDEX UNIQUE SCAN SYS_C0 2 1
020528 (INDEX (UNIQUE))
6 3 5 TABLE ACCESS FULL PRODUCT 6628 1100613
ELEMENTIMPL (TABLE)
Any ideas how to avoid this full table scan?
bye
Roland Spatzenegger

Hello,
thank you for your replies. The indices and table schemas are the "same", but only the content for the tables was mirrored.
We made some tests with dropping and/or analyzing the tables, but it didn't change anything.
The main problem is that the query takes 33s in the productive environment for searching in a couple of rows. At the moment it's faster to make
SELECT DISTINCT P.ID, P.STATE FROM PRODUCTELEMENTIMPL P WHERE ( ( LABEL = 'SomeLabel' AND PRODUCTELEMENTTYPE = 'SomeText' ) ) START WITH P.ID = 42 CONNECT BY PRIOR P.ID = P.PARENT
and to test in the application if the state-values match ;-)
If I add the hint /*+ no_filtering */ in the test environment, I get the same "slow" execution path as in the production environment. So the question is, what prevents the filtering in "connect by"?
(I think in the fast version it filters only the results of the hierarchical query, in the slow version it first filters the whole table and joins/merge it with the hierachical result).
bye
Roland Spatzenegger

Similar Messages

  • Problems with Views based on a Hierarchical Query

    Datamodeler 3.1.3.706 (SQL Dev 3.2.10.09):
    When creating a view that utilizes a Hierarchical Query, the Query Builder encounters various difficulties:
    When pasting in SQL code, if the view is saved without first clicking the update diagram button, the object in the view entity relationship diagram provides a faithful representation of the view without errors, but when reopening the view, the code is missing.
    Simple Example using the classic emp table:
    SELECT level lev
          , emp.*
       FROM emp
      CONNECT BY prior empno = mgr
      START WITH mgr        IS NULLIf the update diagram button is pushed to refresh the graphical view. It mangles the connect by clause and the view gets marked with a warning/error icon in the relationship diagram, but the now mangled code remains available on reopening the query builder.
    Same code as above after clicking the Update Diagram button:
    SELECT Level lev
    , emp.*
       FROM emp
      CONNECT BYFurther issues are encountered if the query contains any of the CONNECT_BY_% hierarchical pseudo columns:
    SELECT level
          , emp.*
          , connect_by_root emp.ename root_ename
       FROM emp
      CONNECT BY prior empno = mgr
      START WITH mgr        IS NULL;In this case pasting in the code and clicking either the Update Diagram button or the OK button results in an "Unexpected Token" parsing error.
    These issues are encountered with both the Logical and Relational models.
    Is this a known issue? I've searched this forum but haven't found any references to it.
    Thanks,
    Sentinel

    Hi Sentinel,
    I logged a bug for that.
    You can try DM 3.3 it deals better with first problem, parsing of connect_by_root operator will pass if you don't use alias.
    Philip

  • Problem with optimiser choosing different execution path to that expected!

    We have a sql statement that uses sub-query factoring, and a materialize hint in one of the sub-queries. The query runs fine for me when I do the query manually - it does the Temp Table Transformation as I expect it to (due to the materialize hint). The query runs in under 2 mins, and the explain plan says a cost of 154.
    Take away the materialize hint, and I get an execution path with a cost of 149, and the query runs in just under 2 hours (!). The explain plan then contains two filter steps, listing the predicates (not exists).
    The problem we're seeing is that when we run the overall process that runs the sql statement and outputs the results to file, instead of it using the materialized explain plan, it appears to be using the non-materialized explain plan, but the predicates bit just says "IS NULL". It has a cost of 149.
    I suspect that the optimiser has somehow worked out that the sub-query in question actually returns no rows, and has therefore worked out a "cheaper" method of getting the results. Thing is, I run the exact same (unfortunately, not bound) query manually and it uses the materialized explain plan!
    The process does run the sub-query in question on it's own, but without the materialized hint. I've done similar manually, just in case this affects things by having the results in memory, but it didn't alter the fact that I still got the materialized plan.
    I'm at a loss as to how it knows that the sub-query returns no rows, and as to why the same query is effectively giving two different execution paths under the same circumstances.
    Can anyone give me their thoughts as to what might be happening with the predicates bit, or any pointers as to where to look next, please?
    TIA

    Yes, it's the same database, so same data, same statistics, same user, etc.
    This is with the materialized hint:
    Time     IO Cost     CPU Cost     Cardinality     Bytes     Cost     Plan
    1     110     2,349,615     1     316     154     SELECT STATEMENT  ALL_ROWS                                                       
    24      24      24      24      24      24           24 TEMP TABLE TRANSFORMATION                                                    
    6      6      6      6      6      6                6 LOAD AS SELECT BROIL_FEED.DIM_CURVE_MAPPING                                              
    5      5      5      5      5      5                     5 FILTER  Filter Predicates: NOT EXISTS (SELECT /*+ */ 0 FROM "CREDIT_MRCDATA" "CM1" WHERE "CM1"."TRADE_NAME"=:B1 AND "CM1"."RISK_TYPE"='TVReport' AND "CM1"."RUN_ID"=:B2) OR  NOT EXISTS (SELECT /*+ */ 0 FROM "CREDIT_MRCDATA" "CM2" WHERE "CM2"."TRADE_NAME"=:B3 AND "CM2"."RISK_TYPE"='Delta' AND "CM2"."RUN_ID"=:B4) OR  NOT EXISTS (SELECT /*+ */ 0 FROM "CREDIT_MRCDATA" "CM3" WHERE "CM3"."TRADE_NAME"=:B5 AND "CM3"."RISK_TYPE"='Issuer' AND "CM3"."RUN_ID"=:B6)                                          
    1 1     1 4     1 28,686     1 1     1 19     1 5                         1 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "RUN_ID"=207270                                     
    2 1     2 4     2 28,686     2 1     2 29     2 5                         2 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM1"."RUN_ID"=:B1 AND "CM1"."RISK_TYPE"='TVReport' AND "CM1"."TRADE_NAME"=:B2                                     
    3 1     3 4     3 29,086     3 2     3 58     3 5                         3 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM2"."RUN_ID"=:B1 AND "CM2"."RISK_TYPE"='Delta' AND "CM2"."TRADE_NAME"=:B2                                     
    4 1     4 4     4 29,086     4 2     4 58     4 5                         4 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM3"."RUN_ID"=:B1 AND "CM3"."RISK_TYPE"='Issuer' AND "CM3"."TRADE_NAME"=:B2                                     
    23 1     23 106     23 2,320,930     23 1     23 316     23 149               23 WINDOW SORT                                               
    22      22      22      22      22      22                     22 FILTER  Filter Predicates: NOT EXISTS (SELECT /*+ */ 0 FROM  (SELECT /*+ CACHE_TEMP_TABLE ("T1") */ "C0" "TRADENAME" FROM "SYS"."SYS_TEMP_0FD9D6638_7866E0A0" "T1") "ERRORED_TRADES" WHERE LNNVL("TRADENAME"<>:B1))                                          
    19 1     19 101     19 2,313,658     19 2     19 632     19 144                         19 HASH JOIN OUTER  Access Predicates: "THEDATA"."BUCKET"="TENOR"(+)                                     
    17 1     17 12     17 252,229     17 2     17 598     17 17                              17 NESTED LOOPS OUTER                                
    14 1     14 10     14 233,806     14 2     14 442     14 14                                   14 VIEW BROIL_FEED.                          
    13 1     13 5     13 90,069     13 2     13 174     13 14                                        13 SORT UNIQUE                      
    12      12      12      12      12      12                                              12 UNION-ALL                 
    8 1     8 5     8 36,349     8 1     8 89     8 6                                                  8 TABLE ACCESS BY INDEX ROWID TABLE BROIL_FEED.CREDIT_MRCDATA Filter Predicates: "CM"."RISK_TYPE"='Delta' OR "CM"."RISK_TYPE"='TVReport' OR "CM"."RISK_TYPE"='Issuer' AND "CM"."SHOCK"=0            
    7 1     7 4     7 28,686     7 1     7      7 5                                                       7 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM"."RUN_ID"=207270       
    11 1     11 5     11 143,737     11 1     11 85     11 8                                                  11 HASH GROUP BY            
    10 1     10 5     10 36,297     10 1     10 85     10 6                                                       10 TABLE ACCESS BY INDEX ROWID TABLE BROIL_FEED.CREDIT_MRCDATA      
    9 1     9 4     9 28,686     9 1     9      9 5                                                            9 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "RUN_ID"=207270 AND "RISK_TYPE"='Delta' 
    16 1     16 1     16 9,211     16 1     16 78     16 1                                   16 TABLE ACCESS BY INDEX ROWID TABLE BROIL_FEED.DIM_CURVE_MAPPING                          
    15 1     15 0     15 1,900     15 1     15      15 0                                        15 INDEX UNIQUE SCAN INDEX (UNIQUE) BROIL_FEED.DIM_RISK_CURVENAME Access Predicates: "THEDATA"."RISK_CURVE_NAME"="DIM_CURVE_MAPPING"."RISK_CURVE_NAME"(+)                      
    18 1     18 89     18 1,450,669     18 5,836     18 99,212     18 116                              18 TABLE ACCESS FULL TABLE BROIL_FEED.DIM_TENOR                               
    21 1     21 5     21 7,271     21 1     21 77     21 5                         21 VIEW BROIL_FEED. Filter Predicates: LNNVL("TRADENAME"<>:B1)                                     
    20 1     20 5     20 7,271     20 1     20 14     20 5                              20 TABLE ACCESS FULL TABLE (TEMP) SYS.SYS_TEMP_0FD9D6638_7866E0A0                This is the explain plan for the query without the materialized hint:
    Time     IO Cost     CPU Cost     Cardinality     Bytes     Cost     Plan
    1     105     2,342,394     1     316     149     SELECT STATEMENT  ALL_ROWS                                                  
    20 1     20 105     20 2,342,394     20 1     20 316     20 149          20 WINDOW SORT                                               
    19      19      19      19      19      19                19 FILTER  Filter Predicates: NOT EXISTS (SELECT /*+ */ 0 FROM "CREDIT_MRCDATA" "SYS_ALIAS_6" WHERE ( NOT EXISTS (SELECT /*+ */ 0 FROM "CREDIT_MRCDATA" "CM1" WHERE "CM1"."TRADE_NAME"=:B1 AND "CM1"."RISK_TYPE"='TVReport' AND "CM1"."RUN_ID"=:B2) OR  NOT EXISTS (SELECT /*+ */ 0 FROM "CREDIT_MRCDATA" "CM2" WHERE "CM2"."TRADE_NAME"=:B3 AND "CM2"."RISK_TYPE"='Delta' AND "CM2"."RUN_ID"=:B4) OR  NOT EXISTS (SELECT /*+ */ 0 FROM "CREDIT_MRCDATA" "CM3" WHERE "CM3"."TRADE_NAME"=:B5 AND "CM3"."RISK_TYPE"='Issuer' AND "CM3"."RUN_ID"=:B6)) AND "RUN_ID"=207270 AND LNNVL("TRADE_NAME"<>:B7))                                          
    13 1     13 101     13 2,313,658     13 2     13 632     13 144                    13 HASH JOIN OUTER  Access Predicates: "THEDATA"."BUCKET"="TENOR"(+)                                     
    11 1     11 12     11 252,229     11 2     11 598     11 17                         11 NESTED LOOPS OUTER                                
    8 1     8 10     8 233,806     8 2     8 442     8 14                              8 VIEW BROIL_FEED.                          
    7 1     7 5     7 90,069     7 2     7 174     7 14                                   7 SORT UNIQUE                      
    6      6      6      6      6      6                                         6 UNION-ALL                 
    2 1     2 5     2 36,349     2 1     2 89     2 6                                             2 TABLE ACCESS BY INDEX ROWID TABLE BROIL_FEED.CREDIT_MRCDATA Filter Predicates: "CM"."RISK_TYPE"='Delta' OR "CM"."RISK_TYPE"='TVReport' OR "CM"."RISK_TYPE"='Issuer' AND "CM"."SHOCK"=0            
    1 1     1 4     1 28,686     1 1     1      1 5                                                  1 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM"."RUN_ID"=207270       
    5 1     5 5     5 143,737     5 1     5 85     5 8                                             5 HASH GROUP BY            
    4 1     4 5     4 36,297     4 1     4 85     4 6                                                  4 TABLE ACCESS BY INDEX ROWID TABLE BROIL_FEED.CREDIT_MRCDATA      
    3 1     3 4     3 28,686     3 1     3      3 5                                                       3 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "RUN_ID"=207270 AND "RISK_TYPE"='Delta' 
    10 1     10 1     10 9,211     10 1     10 78     10 1                              10 TABLE ACCESS BY INDEX ROWID TABLE BROIL_FEED.DIM_CURVE_MAPPING                          
    9 1     9 0     9 1,900     9 1     9      9 0                                   9 INDEX UNIQUE SCAN INDEX (UNIQUE) BROIL_FEED.DIM_RISK_CURVENAME Access Predicates: "THEDATA"."RISK_CURVE_NAME"="DIM_CURVE_MAPPING"."RISK_CURVE_NAME"(+)                      
    12 1     12 89     12 1,450,669     12 5,836     12 99,212     12 116                         12 TABLE ACCESS FULL TABLE BROIL_FEED.DIM_TENOR                               
    18      18      18      18      18      18                     18 FILTER  Filter Predicates: NOT EXISTS (SELECT /*+ */ 0 FROM "CREDIT_MRCDATA" "CM1" WHERE "CM1"."TRADE_NAME"=:B1 AND "CM1"."RISK_TYPE"='TVReport' AND "CM1"."RUN_ID"=:B2) OR  NOT EXISTS (SELECT /*+ */ 0 FROM "CREDIT_MRCDATA" "CM2" WHERE "CM2"."TRADE_NAME"=:B3 AND "CM2"."RISK_TYPE"='Delta' AND "CM2"."RUN_ID"=:B4) OR  NOT EXISTS (SELECT /*+ */ 0 FROM "CREDIT_MRCDATA" "CM3" WHERE "CM3"."TRADE_NAME"=:B5 AND "CM3"."RISK_TYPE"='Issuer' AND "CM3"."RUN_ID"=:B6)                                     
    14 1     14 4     14 28,736     14 1     14 19     14 5                         14 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "RUN_ID"=207270  Filter Predicates: LNNVL("TRADE_NAME"<>:B1)                                
    15 1     15 4     15 28,686     15 1     15 29     15 5                         15 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM1"."RUN_ID"=:B1 AND "CM1"."RISK_TYPE"='TVReport' AND "CM1"."TRADE_NAME"=:B2                                
    16 1     16 4     16 29,086     16 2     16 58     16 5                         16 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM2"."RUN_ID"=:B1 AND "CM2"."RISK_TYPE"='Delta' AND "CM2"."TRADE_NAME"=:B2                                
    17 1     17 4     17 29,086     17 2     17 58     17 5                         17 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM3"."RUN_ID"=:B1 AND "CM3"."RISK_TYPE"='Issuer' AND "CM3"."TRADE_NAME"=:B2       And this is what the process is running:
    Time     IO Cost     CPU Cost     Cardinality     Bytes     Cost     Plan
                             149     SELECT STATEMENT  ALL_ROWS                                                  
    20 1     20 105     20 2,342,394     20 1     20 316     20 149          20 WINDOW SORT                                               
    19      19      19      19      19      19                19 FILTER  Filter Predicates: IS NULL                                          
    13 1     13 101     13 2,313,658     13 2     13 632     13 144                    13 HASH JOIN OUTER  Access Predicates: "THEDATA"."BUCKET"="TENOR"                                     
    11 1     11 12     11 252,229     11 2     11 598     11 17                         11 NESTED LOOPS OUTER                                
    8 1     8 10     8 233,806     8 2     8 442     8 14                              8 VIEW                           
    7 1     7 5     7 90,069     7 2     7 174     7 14                                   7 SORT UNIQUE                      
    6      6      6      6      6      6                                         6 UNION-ALL                 
    2 1     2 5     2 36,349     2 1     2 89     2 6                                             2 TABLE ACCESS BY INDEX ROWID TABLE BROIL_FEED.CREDIT_MRCDATA Filter Predicates: (INTERNAL_FUNCTION("CM"."RISK_TYPE") OR ("CM"."RISK_TYPE"='Issuer' AND "CM"."SHOCK"=0))            
    1 1     1 4     1 28,686     1 1     1      1 5                                                  1 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM"."RUN_ID"=207268       
    5 1     5 5     5 143,737     5 1     5 85     5 8                                             5 HASH GROUP BY            
    4 1     4 5     4 36,297     4 1     4 85     4 6                                                  4 TABLE ACCESS BY INDEX ROWID TABLE BROIL_FEED.CREDIT_MRCDATA      
    3 1     3 4     3 28,686     3 1     3      3 5                                                       3 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "RUN_ID"=207268 AND "RISK_TYPE"='Delta' 
    10 1     10 1     10 9,211     10 1     10 78     10 1                              10 TABLE ACCESS BY INDEX ROWID TABLE BROIL_FEED.DIM_CURVE_MAPPING                          
    9      9 0     9 1,900     9 1     9      9 0                                   9 INDEX UNIQUE SCAN INDEX (UNIQUE) BROIL_FEED.DIM_RISK_CURVENAME Access Predicates: "THEDATA"."RISK_CURVE_NAME"="DIM_CURVE_MAPPING"."RISK_CURVE_NAME"                      
    12 1     12 89     12 1,450,669     12 5,836     12 99,212     12 116                         12 TABLE ACCESS FULL TABLE BROIL_FEED.DIM_TENOR                               
    18      18      18      18      18      18                     18 FILTER  Filter Predicates: ( IS NULL OR  IS NULL OR  IS NULL)                                     
    14 1     14 4     14 28,736     14 1     14 19     14 5                         14 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "RUN_ID"=207268  Filter Predicates: LNNVL("TRADE_NAME"<>:B1)                                
    15 1     15 4     15 28,686     15 1     15 29     15 5                         15 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM1"."RUN_ID"=:B1 AND "CM1"."RISK_TYPE"='TVReport' AND "CM1"."TRADE_NAME"=:B2                                
    16 1     16 4     16 29,086     16 2     16 58     16 5                         16 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM2"."RUN_ID"=:B1 AND "CM2"."RISK_TYPE"='Delta' AND "CM2"."TRADE_NAME"=:B2                                
    17 1     17 4     17 29,086     17 2     17 58     17 5                         17 INDEX RANGE SCAN INDEX BROIL_FEED.CREDIT_MRCDATA_IDX Access Predicates: "CM3"."RUN_ID"=:B1 AND "CM3"."RISK_TYPE"='Issuer' AND "CM3"."TRADE_NAME"=:B2       P.S., Forgot to mention - my database is 10.2.0.2.
    Message was edited by:
    Boneist

  • Apex 4 , problem with collection executions

    Hi ,
    I am having the following problem with the execution of one collection :
    Reference thread : Re: APEX 4 , executing a remote procedure and populating data using collection
    DBNAME ---> list item which I build from the DB links which I built ( as dynamic query in the shared components from a local table which holds entries of dblink names )
    USERLIST --> list item of users which should display dynamicaly the users of that db link I choose in DBNAME ( based on a collection )
    buttons CANCEL and SUBMIT
    4- Initial COLLECTION page process which is calculated before Header :
    DECLARE
    q varchar2(4000);
    BEGIN
    IF APEX_COLLECTION.COLLECTION_EXISTS(P_COLLECTION_NAME => 'QRY1') THEN
    APEX_COLLECTION.DELETE_COLLECTION(P_COLLECTION_NAME => 'QRY1');
    END IF;
    q := 'SELECT username , username FROM sys.dba_users@'||:P23_DBNAME ;
    APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
    P_COLLECTION_NAME => 'QRY1',
    P_QUERY => Q);
    END;
    For USERLIST list item I am using the following in LIST OF VALUES DEFINITION :
    SELECT C001, C002 FROM APEX_COLLECTIONS WHERE COLLECTION_NAME='QRY1'
    5 - to submit the values from the screen to the remote database procedure I am using the following submit process ON SUBMIT AFTER CALCULATIONS:
    DECLARE
    v_statement varchar2(255);
    BEGIN
    v_statement := 'begin
    Lock_User@&P24_DBNAME.(''&P24_USERLIST.'');
    insert into log values (1,''user locked'') ;
    commit ;
    end;';
    EXECUTE IMMEDIATE v_statement;
    END;
    The problem :
    The form runs sucessfully , where I the USERLIST changes dynamicaly when I change the DBNAME values , but as soon as I logout and login with another user1 , the collection does not execute and i get "ORA-01729: database link name expected".
    I login with user1 in edit mode and recreate the collection , run again , the collection executes successfuly .
    If I create a new user2 ( using the sample application pages ) and login with the new user2 , i have the same problem , thus I ho login with user2 in edit mode and try to run the collection .
    How can I control the collection to execute regardless of the application user logged in ??
    thanks in advance
    yousef

    Hi ,
    I am having the following problem with the execution of one collection :
    Reference thread : Re: APEX 4 , executing a remote procedure and populating data using collection
    DBNAME ---> list item which I build from the DB links which I built ( as dynamic query in the shared components from a local table which holds entries of dblink names )
    USERLIST --> list item of users which should display dynamicaly the users of that db link I choose in DBNAME ( based on a collection )
    buttons CANCEL and SUBMIT
    4- Initial COLLECTION page process which is calculated before Header :
    DECLARE
    q varchar2(4000);
    BEGIN
    IF APEX_COLLECTION.COLLECTION_EXISTS(P_COLLECTION_NAME => 'QRY1') THEN
    APEX_COLLECTION.DELETE_COLLECTION(P_COLLECTION_NAME => 'QRY1');
    END IF;
    q := 'SELECT username , username FROM sys.dba_users@'||:P23_DBNAME ;
    APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
    P_COLLECTION_NAME => 'QRY1',
    P_QUERY => Q);
    END;
    For USERLIST list item I am using the following in LIST OF VALUES DEFINITION :
    SELECT C001, C002 FROM APEX_COLLECTIONS WHERE COLLECTION_NAME='QRY1'
    5 - to submit the values from the screen to the remote database procedure I am using the following submit process ON SUBMIT AFTER CALCULATIONS:
    DECLARE
    v_statement varchar2(255);
    BEGIN
    v_statement := 'begin
    Lock_User@&P24_DBNAME.(''&P24_USERLIST.'');
    insert into log values (1,''user locked'') ;
    commit ;
    end;';
    EXECUTE IMMEDIATE v_statement;
    END;
    The problem :
    The form runs sucessfully , where I the USERLIST changes dynamicaly when I change the DBNAME values , but as soon as I logout and login with another user1 , the collection does not execute and i get "ORA-01729: database link name expected".
    I login with user1 in edit mode and recreate the collection , run again , the collection executes successfuly .
    If I create a new user2 ( using the sample application pages ) and login with the new user2 , i have the same problem , thus I ho login with user2 in edit mode and try to run the collection .
    How can I control the collection to execute regardless of the application user logged in ??
    thanks in advance
    yousef

  • Same sqlID with different  execution plan  and  Elapsed Time (s), Executions time

    Hello All,
    The AWR reports for two days  with same sqlID with different  execution plan  and  Elapsed Time (s), Executions time please help me to find out what is  reason for this change.
    Please find the below detail 17th  day my process are very slow as compare to 18th
    17th Oct                                                                                                          18th Oct
    221,808,602
    21
    2tc2d3u52rppt
    213,170,100
    72,495,618
    9c8wqzz7kyf37
    209,239,059
    71,477,888
    9c8wqzz7kyf37
    139,331,777
    1
    7b0kzmf0pfpzn
    144,813,295
    1
    0cqc3bxxd1yqy
    102,045,818
    1
    8vp1ap3af0ma5
    128,892,787
    16,673,829
    84cqfur5na6fg
    89,485,065
    1
    5kk8nd3uzkw13
    127,467,250
    16,642,939
    1uz87xssm312g
    67,520,695
    8,058,820
    a9n705a9gfb71
    104,490,582
    12,443,376
    a9n705a9gfb71
    62,627,205
    1
    ctwjy8cs6vng2
    101,677,382
    15,147,771
    3p8q3q0scmr2k
    57,965,892
    268,353
    akp7vwtyfmuas
    98,000,414
    1
    0ybdwg85v9v6m
    57,519,802
    53
    1kn9bv63xvjtc
    87,293,909
    1
    5kk8nd3uzkw13
    52,690,398
    0
    9btkg0axsk114
    77,786,274
    74
    1kn9bv63xvjtc
    34,767,882
    1,003
    bdgma0tn8ajz9
    Not only queries are different but also the number of blocks read by top 10 queries are much higher on 17th than 18th.
    The other big difference is the average read time on two days
    Tablespace IO Stats
    17th Oct
    Tablespace
    Reads
    Av Reads/s
    Av Rd(ms)
    Av Blks/Rd
    Writes
    Av Writes/s
    Buffer Waits
    Av Buf Wt(ms)
    INDUS_TRN_DATA01
    947,766
    59
    4.24
    4.86
    185,084
    11
    2,887
    6.42
    UNDOTBS2
    517,609
    32
    4.27
    1.00
    112,070
    7
    108
    11.85
    INDUS_MST_DATA01
    288,994
    18
    8.63
    8.38
    52,541
    3
    23,490
    7.45
    INDUS_TRN_INDX01
    223,581
    14
    11.50
    2.03
    59,882
    4
    533
    4.26
    TEMP
    198,936
    12
    2.77
    17.88
    11,179
    1
    732
    2.13
    INDUS_LOG_DATA01
    45,838
    3
    4.81
    14.36
    348
    0
    1
    0.00
    INDUS_TMP_DATA01
    44,020
    3
    4.41
    16.55
    244
    0
    1,587
    4.79
    SYSAUX
    19,373
    1
    19.81
    1.05
    14,489
    1
    0
    0.00
    INDUS_LOG_INDX01
    17,559
    1
    4.75
    1.96
    2,837
    0
    2
    0.00
    SYSTEM
    7,881
    0
    12.15
    1.04
    1,361
    0
    109
    7.71
    INDUS_TMP_INDX01
    1,873
    0
    11.48
    13.62
    231
    0
    0
    0.00
    INDUS_MST_INDX01
    256
    0
    13.09
    1.04
    194
    0
    2
    10.00
    UNDOTBS1
    70
    0
    1.86
    1.00
    60
    0
    0
    0.00
    STG_DATA01
    63
    0
    1.27
    1.00
    60
    0
    0
    0.00
    USERS
    63
    0
    0.32
    1.00
    60
    0
    0
    0.00
    INDUS_LOB_DATA01
    62
    0
    0.32
    1.00
    60
    0
    0
    0.00
    TS_AUDIT
    62
    0
    0.48
    1.00
    60
    0
    0
    0.00
    18th Oct
    Tablespace
    Reads
    Av Reads/s
    Av Rd(ms)
    Av Blks/Rd
    Writes
    Av Writes/s
    Buffer Waits
    Av Buf Wt(ms)
    INDUS_TRN_DATA01
    980,283
    91
    1.40
    4.74

    The AWR reports for two days  with same sqlID with different  execution plan  and  Elapsed Time (s), Executions time please help me to find out what is  reason for this change.
    Please find the below detail 17th  day my process are very slow as compare to 18th
    You wrote with different  execution plan, I  think, you saw plans. It is very difficult, you get old plan.
    I think Execution plans is not changed in  different days, if you not added index  or ...
    What say ADDM report about this script?
    As you know, It is normally, different Elapsed Time for same statement in different  day.
    It is depend your database workload.
    It think you must use SQL Access and SQl Tuning advisor for this script.
    You can get solution for slow running problem.
    Regards
    Mahir M. Quluzade

  • Problem with different resultset with same data and same query in Oracle 8.1.7 and 9i

    Hello,
    I have been using this query in oracle 8.1.7
    SELECT
    ID,
    AREA_NO
    FROM MANAGER_AREA MGR
    WHERE COMPANY_ID = :id AND
    (:value < (SELECT COUNT(ROWID)
    FROM MANAGER_WORK MW
    WHERE MW.AREA_ID = MGR.ID AND
    (MW.END_WORK IS NULL OR MW.END_WORK >= SYSDATE)))
    order by AREA_NO;
    In the above query I want to see rows from MANAGER_AREA table depending upon date criteria in the table MANAGER_WORK and also upon the parameter :value i.e if I pass a value as 0 I get to see records for which their is atleast 1 record in MANAGER_WORK with the date criteria and if I pass -1 then I get all the records because minimum value that count(*) would give is 0. The resultset was as expected in 8.1.7.
    A couple of days back I installed PERSONAL 9i to test for testing the basic functionality of our program with the same data. This query fails and irrespective whether I pass -1 or 0 it returns me same dataset which I would have got in case if I pass 0.
    I do not know whether this is a bug that has got introduced in 9i. Can anybody help me with this problem. It would be difficult for me to change the parameter send to this query as the Query is called from many different places.
    Thanks in advance
    Amol.

    I cannot use a Group by and a having statement over here. The problem with 'Group by' and 'having' clause is If I have to make a join between the two tables. When I use join then I get only rows that are linked to each other in the table.
    If I use outer join to solve that problem then I have to take in consideration the other date condition. My previous query use to virtually discard the corelated query result by using -1 as the value. This will not happen in the join query.
    Amol.

  • Same query with different execution plan

    Hello All,
    I wonder why does sql server create different execution plan for these below queries ?
    Thanks.

    You can look at the expected query plan. Either visually in SSMS, or alternatively, you can run the query after the instruction SET SHOWPLAN_TEXT ON.
    The Optimizer is the component of SQL Server that determines how the query is executed. It is cost based. It will assess different execution plans, estimate the cost of each of them and then select the cheapest. In this context, cheapest means the one with
    the shortest runtime.
    In your particular case, the estimation for the second query is, that scanning just a small part of the nonclustered index and then looking up the table data of the qualifying rows is the cheapest approach, because the estimated number of qualifying rows
    is low.
    In the first query, it estimated that looking up the many qualifying rows there would be too expensive, and that it would be cheaper to simply scan the entire clustered index, and simply filter out all unwanted rows. Note that the clustered index includes
    the actual table data.
    Gert-Jan

  • Problems with different versions of ColdFusio

    Hello There
    I installed CF8 using the multiserver option and also
    deployed CF7 on the same JRun without checking to create a service.
    I also downloaded the latest version of the Java SDK (1.4.2_15) and
    installed on my machine. I created a different jvm.config file
    (jvm_cfmx7.config) in my JRun bin directory pointing to this new
    JVM JRE's directory.
    I also created a new Windows Service using jrunsvc without a
    problem. My only issue here is that when i try to start this
    service (through Windows Services) it doesn't start and returns me
    an error saying only to contact the manufactured.
    Please, any help will be much appreciated.
    Thanks
    Alvaro Costa

    You could just install each one, copy the dir, uninstall, create a batch file with the appropriate paths to the copied directory and then run using the batch files.
    (Note of course that Java itself isn't responsible for correctly running itself. Rather it is up to the developer/company to create a product that recognizes that it is not the sole product in the universe and thus behaves correctly.)

  • Problem with different Labview platform

    Maybe this issue must be address to NI.
    I have this library calling a register DLL. The purpose of the library is to convert a type of movie file from hard drive(*.mcf type) to image stream then to show and eventualy to save it.
    The DLL is designed by NAC camera designer, which is a high speed camera. The code is based on properties, methodes and events from DLL.
    Code works well in Labview 8.6.1, in Labview 11.0.1, Labview 12.0f3. Unfortunately code does not work in Labview 11.0.1f2 which happens to be the one I am developing my applications.
    I will post the code developed by NI Japan (camera also is designed in Japan) and the mcf file as well as the DLL which must be registered.
    The code is compiled in 8.6.1.
    Register first the dll then open the NAC MCFF Control_E.vi.
    Brows the mcf file
    Press Open button
    Slide the frames one by one for showing the images content of the mcf.
    If you want to open under other labview then 8.6.1 then copy the folder and run a mass compile under that version then open the same top vi.
    Please, show me what is different for different versions of labview then in my version does not work.
    Than you,
    Virginia
    Solved!
    Go to Solution.

    Just because it doesn't crash does not mean automatically that everything is alright. You just might be unlucky that the memory corruption does not happen in a vital part of the LabVIEW memory.
    Now, when loading your LLB in LabVIEW on my machine, the first indication that something is wrong would be the error message that C:\Windows\System32\gdi32.dll could not be found. And indeed this is a system DLL that should never be referenced by the full path but simply by the DLL name alone. So change the Library Name or Path in the CLN inside the nac_NI_BitmapRead.vi to just "gdi32.dll" (without quotes). And when you are at it, change the first parameter to be a pointer sized integer too, since this IS a pointer.
    Now look in the configuration dialog in the Function tab a bit further down and notice that the Calling convention is set to C. 99% of all Windows userspace APIs are really stdcall under Win32 and fastcall under Win64. A "bug" in LabVIEW versions before 2009 attempted to automatically fix wrong calling conventions from C to stdcall, based on certain naming attributes of the actually exported function in the DLL (and no, LabVIEW does not show those decorated names but the human readable name). The problem with this fix was that it did not allow for calling (admittingly seldom but nevertheless possible configurations) of DLL functions that happen to follow this naming scheme but were explicitedly declared cdecl by the programmer.
    Try it and tell us if that will help.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Problem with slow execution on a cFP-2120

    I have an application that runs on a cFP-2120, using web interface for the user to interact with the program.
    I have noticed that in order to get the web interface to get updated I have to use property nodes and write to the value property, see this article:
    http://digital.ni.com/public.nsf/allkb/FC5024A5DD6344C886256C8C0054689B?OpenDocument
    However, this seems to give me a serious performance hit, as described here:
    http://forums.ni.com/ni/board/message?board.id=170&thread.id=153531&view=by_date_ascending&page=1
    I have tested with this code, and with my LV 8.2 a loop that uses 277ms to complete when writing directly to a indicator will use 203159ms when using a property node.
    So, I need to update several front panel objects using the value property, but can't afford the cpu time. Does anyone have a suggestion how to do this as efficiently as possible? The problem is apparantly that using the value property requires the front panel to be loaded - can I for instance avoid doing this once for each variable?

    I've changed the vi now so it only writes to value property when a value has changed. This has cut execution time in half, from 500ms to 250ms. I still think this is quite a lot...
    To give you an indication of "size", the executeable is 1210kb with 2 dll's of 872 and 168kb.
    I've not tried deploying a smaller (cut down?) version - what exactly do you mean?
    With regards to writing to value instead of locals or directly - I've had problems with the values not updating - but not always - and the first link does suggest a bugfix. I'd like to know why wiring to value property is sometimes needed and sometimes not.

  • Facing problem with a date column in select query

    Hi,
    I am facing problem with a date column. Below is my query and its fainling with " invalid number format model" .
    Query: SELECT *
    FROM EMP
    WHERE trunc(LAST_UPDATED) >= to_date(to_char(22-05-2009,'dd-mm-yyyy'),'dd-mm-yyyy')
    LAST_UPDATED column is "DATE" data type.
    Please help me Thanks

    Radhakrishna Sarma wrote:
    SeánMacGC wrote:
    WHERE LAST_UPDATED >= to_date('22-05-2009','dd-mm-yyyy');
    You do not need the TRUNC here in any case.
    I don't think so. What if the user wants only data for 22nd May and the table has records with date later than 22nd also? In that case your query willl not work. In order for the Index to work, I think the query can be written like this I think Sean is right though. Use of TRUNC Function is quiet useless based on the condition given here, since the to_date Function used by OP will always point to midnight of the specified date, in this case 22-05-2009 00:00:00.
    Regards,
    Jo
    Edit: I think Sean proved his point... ;)

  • Problem with logical database DDF in ABAP query

    Hi All,
          I have created an ABAP query via the transaction SQ01 using the logical database DDF to retrieve customer master data from tables KNA1 & KNB1. The selection screen used is the screen 903 of the logical database DDF. But now the problem is that when I execute the query, I am getting a blank value in the tax code4(KNA1-STCD4) field though there is value in the KNA1 table for this particular field. This field was added to the table by means of a customizing include. Can anyone suggest a way to get around this problem so that I can view the content of the field STCD4 in the query.
    Thanks and regards,
    Sarath.

    I think it's not used by DDF.
    so you must check it with:
    check kna1-bran1 in s_bran1.
    A.

  • Problem with virtual Key Figure in a query

    Hi Experts,
    I would like to share my problem with the virtual key figure in a query:
    I have a query with a virtual key figure and when I eject the query by analyzer, the result sometimes is displayed and sometimes is not displayed (is equal to 0), with the same initials values. And when I eject the query by RSRT always display the result for the virtual key figure.
    Why don't always display the result?
    Thanks a lot

    Hi,
    I think that the problem is the level of support package. We have BI AddOn 7.X (based on 7.20) support package 0.
    What do you think?
    Regards

  • Problem with different calendars under Mountain Lion

    I upgraded recently from Snow Leopard to Mountain Lion and experiencing an annoying problem with the calendars "On My Mac" (I am using a MacBook Pro from mid 2009). With iCal under Snow Leopard I had seven calendars - Meetings, Performances, Family, etc. with different colors. After the switch to Mountain Lion these categories aren't maintained properly. Four of them have been seemingly merged into two, so that for example an event can't be categorized as "Family" but gets shifted automatically to "Meetings" (both calendars stay checked in the editing panel, but only one "sticks"). So I have three  calendars I can use and a four I can't.
    If I try to add a new calendar it appears in the list, but no event can be assigned to it.
    Is there a limit to the number of calendars one can have?
    I don't use iCloud, so there is no issue there.
    I have one Google calendar (a work schedule I have subscribed to ) which also works with no problems.
    Any ideas?

    Same problem when reseted  the PRAM.
    I read some Chinese Web , Many people got the same problem after upgrade to mountain lion
    you can see the locked icon show in the bottom left conner even my card is unlock
    I can read but can not delete any Photos
    http://i83.photobucket.com/albums/j286/2cktang/OSX/ScreenShot2013-03-11at23227AM .png
    you can see the locked icon show in the bottom left conner
    But I can edit everything in my Harddisk
    http://i83.photobucket.com/albums/j286/2cktang/OSX/ScreenShot2013-03-11at23235AM .png
    External Hard Disk no locked icon show in the bottom left conner
    http://i83.photobucket.com/albums/j286/2cktang/OSX/ScreenShot2013-03-11at23220AM .png

  • Problem with different versions of Page Headers

    Gurus, I have a strange problem. I need to have different Page Header format for first page and another format for the rest of the pages. So as suggested in the forums, I did the page setup for Header and Footer with “different first page” option in MS Word. This is not working. I am still seeing the First Page Header format on all the pages. I checked the RTF, there is no section break or any other special breaks in there.
    Any idea why it is not working ?. I can send the Word doc and XML input files.
    Thanks
    Sub

    Is there some way to attach the RTF template and XML input here?.

Maybe you are looking for