CASE of Condition causing Plan difference

Version
SQL> SELECT * FROM v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE    11.2.0.2.0      Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production

5 rows selected.
Optimizer
SQL> show parameter optimizer

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
_optimizer_autostats_job             boolean     FALSE
_optimizer_join_elimination_enabled  boolean     FALSE
optimizer_capture_sql_plan_baselines boolean     FALSE
optimizer_dynamic_sampling           integer     2
optimizer_features_enable            string      11.2.0.2
optimizer_index_caching              integer     0
optimizer_index_cost_adj             integer     100
optimizer_mode                       string      ALL_ROWS
optimizer_secure_view_merging        boolean     FALSE
optimizer_use_invisible_indexes      boolean     FALSE
optimizer_use_pending_statistics     boolean     FALSE
optimizer_use_sql_plan_baselines     boolean     TRUE
Problem

We have a system of providers that built the SQL to be sent to the database. These queries have the following generic structure for a condition in WHERE clause:
CASE WHEN <condition> THEN <table>.<column> END = '<value>'
We have noticed different execution plans when the optimizer compares the numbers instead of varchar2. The examples below show that. In our case, this difference is an impact on the execution of a longer query plans effectively doubling buffer gets and leading to the execution times that are 2 to 4 times as worse.

Query 1
SQL> SELECT /*+gather_plan_statistics*/ * FROM DUAL WHERE CASE WHEN 1=1 THEN 'X' END = dummy;

D
-
X

1 row selected.

SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(null,null,'ALLSTATS LAST'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------
SQL_ID  6ghjubgpwpr61, child number 0
-------------------------------------
SELECT /*+gather_plan_statistics*/ * FROM DUAL WHERE CASE WHEN 1=1 THEN
'X' END = dummy

Plan hash value: 272002086

---------------------------------------------------------------------------------------------
| Id  | Operation         | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
---------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |      1 |        |      1 |00:00:00.02 |       2 |      2 |
|*  1 |  TABLE ACCESS FULL| DUAL |      1 |      1 |      1 |00:00:00.02 |       2 |      2 |
---------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("DUMMY"='X')
Query 2
SQL> SELECT /*+gather_plan_statistics*/ * FROM DUAL WHERE CASE WHEN 'A'='A' THEN 'X' END = dummy;

D
-
X

1 row selected.

SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(null,null,'ALLSTATS LAST'));

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------
SQL_ID  gcpwzksqr2w9n, child number 0
-------------------------------------
SELECT /*+gather_plan_statistics*/ * FROM DUAL WHERE CASE WHEN 'A'='A'
THEN 'X' END = dummy

Plan hash value: 272002086

------------------------------------------------------------------------------------
| Id  | Operation         | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |      1 |        |      1 |00:00:00.01 |       2 |
|*  1 |  TABLE ACCESS FULL| DUAL |      1 |      1 |      1 |00:00:00.01 |       2 |
------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("DUMMY"=CASE  WHEN ('A'='A') THEN 'X' END )
To my eyes the status 'A' = 'A' is equivalent to the condition 1 = 1. How did in the case of the comparison digital Oracle allows to eliminate the case expression, but compared to the character he can't?

Thank you!

Centinul wrote:
To my eyes the status 'A' = 'A' is equivalent to the condition 1 = 1.

Well, question is Oracle looks like 'A' = 'A' as the string comparison. And the result of a string comparison is NLS charging. This is why it can not evaluate CASES at compile time.

SY.

Tags: Database

Similar Questions

  • Case Based Condition of inner join in SQL query

    Hi Experts,
    CREATE TABLE PRODUCT_PRICE(PRODUCT_ID INTEGER,PRICE FLOAT);
    INSERT INTO PRODUCT_PRICE VALUES(1,1);
    INSERT INTO PRODUCT_PRICE VALUES(2,2);
    INSERT INTO PRODUCT_PRICE VALUES(3,1);
    INSERT INTO PRODUCT_PRICE VALUES(4,1);
    INSERT INTO PRODUCT_PRICE VALUES(5,3);
    INSERT INTO PRODUCT_PRICE VALUES(0,4);
    CREATE TABLE PRODUCT_TABLE (PRODUCTID INTEGER,OTHERID INTEGER);
    INSERT INTO PRODUCT_TABLE VALUES (1,0);
    INSERT INTO PRODUCT_TABLE VALUES (2,0);
    INSERT INTO PRODUCT_TABLE VALUES (3,1);
    INSERT INTO PRODUCT_TABLE VALUES (4,1);
    INSERT INTO PRODUCT_TABLE VALUES (5,2);
    I need to match the product_id = 0 to get the price of the product when there is othersid in the product table (otherid > 0). For this I created the query below.
    SELECT 
        PRODUCT_ID,
        PRICE 
    FROM 
        PRODUCT_TABLE
        INNER JOIN PRODUCT_PRICE ON PRODUCT_ID=PRODUCTID
    WHERE
        OTHERID=0
    UNION ALL
    SELECT 
        PRODUCT_ID,
        PRICE 
    FROM 
        PRODUCT_TABLE
        INNER JOIN PRODUCT_PRICE ON PRODUCT_ID=0
    WHERE
        OTHERID>0;
    My Question is, is that any way the SQLQuery above can be simplified in CASES and INTERNAL CONDITION JOIN in a single SQL QUERY?

    I can work around something like that,
    SELECT 
        PRODUCT_ID,
        PRICE 
    FROM 
        PRODUCT_TABLE
        INNER JOIN PRODUCT_PRICE ON * CASE WHEN OTHERID>0 THEN PRODUCT_ID=0 ELSE PRODUCT_ID=PRODUCTID END*
    Thank you
    SELECT CASE WHEN PT.OTHERID = 0 THEN PT.PRODUCTID ELSE 0 END AS PRODUCT_ID, PP.PRICE
      FROM PRODUCT_TABLE PT,  PRODUCT_PRICE PP
        WHERE CASE WHEN PT.OTHERID =0 THEN PT.PRODUCTID ELSE 0 END = PP.PRODUCT_ID
    

    Should it?

  • case of condition in where clause

    Hello

    I am a beginner in SQL, but according to my reading of the manual, this syntax should be acceptable. I'm using application express but tested also in Developer SQL and the conclusion that it fails with an error "invalid relational operator", with the line number pointing to the ELSE clause of the condition, but a number of column pointing to white space.

    This is a select statement nested, but that shouldn't matter. The fragment in question is:

    Select columns
    RES
    where res.villaid =: P605_VILLAID
    and INSTR (: P604_RES_STATES, res.states). = 0
    and (CASE: P604_EXCLUDE_ZERO)
    WHEN 'Y' THEN ' res.rate > 0'
    ELSE ' res.rate > = 0'
    END)
    and res. DEPARTDATE >: P605_STARTDATE
    and res. ARRIVEDATE < =: P605_ENDDATE.

    I hope that this puts ok shaped during the validation. The code is looking for bookings within a range of dates (which works very well when the other conditions are discussed), and should only output offset lines (nights) if the user asks for it in the variable of liaison P604_EXCLUDE_ZERO. There are probably other ways to go about this, but I'm too stubborn to renounce it. Well, not yet anyway.

    Thanks and greetings
    CS
    select some columns
      from res
     where res.villaid = :p605_villaid
           and instr (:p604_res_states, res.states) != 0
           and sign (res.rate) >= case when :p604_exclude_zero = 'Y' then 1 else 0 end
           and res.departdate > :p605_startdate
           and res.arrivedate <= :p605_enddate
    
  • Windows Driver crash condition caused by ntoskrnl.exe

    Hi guys,.

    I use a Lenovo y410p. I used it only for a few months. Recently, I experienced a few BSOD. The message is driver, out of State. The BSOD appears just randomly without warning. There is not yet any offset or suspended. It starts to become very frustrating. I used the BlueScreenViewer and it says that the problem is caused by ntoskrnl.exe + 153fa0. I don't know what to do. Pls help!

    This is a link to a copy of my minidump

    https://onedrive.live.com/redir?RESID=51E6A2A23FDD7097! 381 & authkey =! ANYAF_hGvxWZSak & ithint = the file % 2czip

    Thanks in advance

    JC

    These are associated with common USB class usbccgp.sys driver Generic Parent of Microsoft.  Since it is a driver of OS I want to run a file system check to start.  If that comes back clean I remove McAfee and use the built in Defender instead

    Please run a check of system files (SFC) 


    All instructions are in our Wiki article below...
    If you have any questions please ask us for .

  • Dequeue condition causes queue sort order to be ignored

    This question relates to the fact that when a dequeue condition is specified the sort order of the queue can be invoked on:
    Of the 11.2 document "Introduction to Oracle QA:

    "A dequeue condition is expressed in terms of message properties or the content of the message and is similar to the syntax for the WHERE clause of a SQL query." Messages in the queue are assessed based on the State and the messages that meet the given condition are returned. When using a dequeue, removed from the order of messages condition is indeterminate, and the sort order of the queue is not honored. »


    I have a problem - I'm interested in consumers of respondent data certain selection criteria, but want to get this qualification given in the order of the oldest first (ENQ_TIME). If specifying the dequeue condition means that the order is unpredictable so it is not acceptable.

    I recognize that I could solve the problem by using the queue MULTIPLE_CONSUMER in which subscriptions are added with the rules for each possible consumer. The problem is that the volatility of the pool of consumption is relatively high and a solution is sought requires no adjustment properties of the queue.

    Am I missing something? i.e. misinterpretting this restriction?
    Someone else took up this challenge and found a technique to solve this problem?

    Thank you in advance.

    Hello

    The note needs modified to indicate that the event changes how dequeue via a deq_condition or done by the works of correlation id by adding another order by clause. If the 'impact' performance is localized to these stops and nothing else.

    There are a number of customers who have implemented this in production environments and are perfectly happy with it. Have you tried this event in a test environment?

    Thank you
    Peter

  • Conditional causes declaration &amp; quot; grayed out &amp; quot;



    as if I put this in the head

    <!-[if lt IE 7] >
    < script type = "text/javascript" src = "unitpngfix.js" > < / script >
    <! [endif]-->


    then

    This: < script src = "Scripts/swfobject_modified.js" type = "text/javascript" > < / script > "

    becomes "grayed out".



    Why?


    also, why are grayed out conditional statements?



    What does it mean that the code does not in gray?

    well, that was stupid on my part! Ha ha

    but that's not all

    the problem seems to have been this:

    I had a deprecated code in my head section that I had not cleaned.

    I guess the lesson for me, it's... know your code!

    Thanks for the help

  • In the last week of firefox won't open a new empty tab and will not bring upward bookmarks options organization when I bookmark on a page. I have not changed my settings and can not find the settings that cause this difference. Any ideas?

    I hear a new empty tab, this is what happens if I click on the button with the + next door already open tabs or navigate to the file and click New tab nothing.

    Uninstall the toolbar Ask and it should work again. There is a compatibility issue with the Ask and Firefox toolbar that prevents the opening of new tabs.

  • Adaptive plans in 12 c

    Hello

    After completing my question I see than the quite extensive preface...

    After spending some time in an attempt to build a simple case of adaptive test plans in 12 c I'm more sure I understand the concept completely. In its white paper on the optimizer changes 12 c (http://www.oracle.com/technetwork/database/bi-datawarehousing/twp-optimizer-with-oracledb-12c-1963236.pdf), Maria Colgan says:

    adaptation plans allow the optimizer to postpone the decision of final plan for a statement, until the time of execution. The instruments of the optimizer plan chosen (the plan by default), among collectors of statistics so that at run time, it can detect if the cardinality estimate, differ greatly the actual number of lines seen by operations in the plan. If there is a significant difference, then the plan or any part of it can be automatically adapted so as to avoid suboptimal performance on the first execution of a SQL statement.

    So I waited for the collector of statistics would be aware of old and misleading statistics and change the Adaptive plan in my test case:

    -12.1.0.1 (Windows 7)

    ALTER session set statistics_level = all;

    drop table t1;

    drop table t2;

    create table t1

    as

    Select rownum id

    , mod (rownum, 10) col1

    , lpad ('* ', 20, ' *') col2

    of the double

    connect by level < = 100000;

    exec dbms_stats.gather_table_stats (user, 't1')

    create index t1_id_idx on t1 (col1, id);

    create table t2

    as

    Select the mod (rownum, 100) id_t1

    , lpad ('* ', 20, ' *') col2

    rownum col3

    of the double

    connect by level < = 100000;

    exec dbms_stats.gather_table_stats (user, 't2')

    create index t2_idx on t2 (id_t1);

    Select sum (t1.col1) sum_col3

    from t1

    t2

    where t1.id = t2.id_t1

    and t1.col1 = 1;

    SUM_COL3

    ----------

    10000

    Select *.

    table (dbms_xplan.display_cursor (null, null, 'ALLSTATS LAST'));

    PLAN_TABLE_OUTPUT

    -------------------------------------------------------------------------------------------------------------------------

    SQL_ID, 0g3mdd8b1pstt, number of children 0

    -------------------------------------

    Select sum (t1.col1) sum_col3 from t1, t2 where t1.id =

    T2.id_t1 and t1.col1 = 1

    Hash value of plan: 1632433607

    ----------------------------------------------------------------------------------------------------------------------------------

    | ID | Operation | Name | Begins | E - lines. A - lines.   A - time | Pads | Bed |  OMem |  1Mem | Used Mem.

    ----------------------------------------------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |           |      1.        |      1. 00:00:00.18 |     232.    223.       |       |          |

    |   1.  GLOBAL TRI |           |      1.      1.      1. 00:00:00.18 |     232.    223.       |       |          |

    |*  2 |   HASH JOIN |           |      1.    100K |  10000 | 00:00:00.18 |     232.    223.  1888K |  1888K | 2088K (0) |

    |*  3 |    INDEX RANGE SCAN | T1_ID_IDX |      1.  10000 |  10000 | 00:00:00.02 |      29.     28.       |       |          |

    |   4.    FULL RESTRICTED INDEX SCAN FAST | T2_IDX |      1.    100K |    100K | 00:00:00.09 |     203.    195.       |       |          |

    ----------------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    2 - access("T1".") ID '= 'T2'.' ID_T1')

    3 - access("T1".") COL1 "= 1)

    Note

    -----

    -This is an adaptation plan

    Update t1 set col1 = 1000 where id > 1;

    -> 99999 Zeilen written on.

    Select sum (t1.col1) sum_col3

    from t1

    t2

    where t1.id = t2.id_t1

    and t1.col1 = 1;

    SUM_COL3

    ----------

    1000


    Select *.

    table (dbms_xplan.display_cursor (null, null, 'ALLSTATS LAST'));


    PLAN_TABLE_OUTPUT

    -------------------------------------------------------------------------------------------------------------------------

    SQL_ID, 0g3mdd8b1pstt, number of children 0

    -------------------------------------

    Select sum (t1.col1) sum_col3 from t1, t2 where t1.id =

    T2.id_t1 and t1.col1 = 1

    Hash value of plan: 1632433607

    -------------------------------------------------------------------------------------------------------------------------

    | ID | Operation | Name | Begins | E - lines. A - lines.   A - time | Pads |  OMem |  1Mem | Used Mem.

    -------------------------------------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |           |      1.        |      1. 00:00:00.05 |     232.       |       |          |

    |   1.  GLOBAL TRI |           |      1.      1.      1. 00:00:00.05 |     232.       |       |          |

    |*  2 |   HASH JOIN |           |      1.    100K |   1000 | 00:00:00.05 |     232.  1969K |  1969K |  635K (0) |

    |*  3 |    INDEX RANGE SCAN | T1_ID_IDX |      1.  10000 |      1. 00:00:00.01 |      29.       |       |          |

    |   4.    FULL RESTRICTED INDEX SCAN FAST | T2_IDX |      1.    100K |    100K | 00:00:00.01 |     203.       |       |          |

    -------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    2 - access("T1".") ID '= 'T2'.' ID_T1')

    3 - access("T1".") COL1 "= 1)

    Note

    -----

    -This is an adaptation plan


    - but with a single-row for access over T1 a NL would be a cheaper option:

    Select / * + use_nl (t1, t2) * /.

    Sum (T1. Col1) sum_col3

    from t1

    t2

    where t1.id = t2.id_t1

    and t1.col1 = 1;

    SUM_COL3

    ----------

    1000

    Select *.

    table (dbms_xplan.display_cursor (null, null, 'ALLSTATS LAST'));

    PLAN_TABLE_OUTPUT

    ------------------------------------------------------------------------------------------

    SQL_ID, 3jfztz70m0qtm, number of children 0

    -------------------------------------

    Select / * + use_nl (t1, t2) * / sum (t1.col1) t1 sum_col3

    t2 where t1.id = t2.id_t1 and t1.col1 = 1

    Hash value of plan: 1261696607

    ------------------------------------------------------------------------------------------

    | ID | Operation | Name | Begins | E - lines. A - lines.   A - time | Pads |

    ------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |           |      1.        |      1. 00:00:00.01 |      33.

    |   1.  GLOBAL TRI |           |      1.      1.      1. 00:00:00.01 |      33.

    |   2.   NESTED LOOPS |           |      1.    100K |   1000 | 00:00:00.01 |      33.

    |*  3 |    INDEX RANGE SCAN | T1_ID_IDX |      1.  10000 |      1. 00:00:00.01 |      29.

    |*  4 |    INDEX RANGE SCAN | T2_IDX |      1.     10.   1000 | 00:00:00.01 |       4.

    ------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    3 - access("T1".") COL1 "= 1)

    4 - access("T1".") ID '= 'T2'.' ID_T1')


    Obviously, the plan is an adaptation plan (at least dbms_xplan says and in v$ sql the IS_RESOLVED_ADAPTIVE_PLAN column is defined on Y)- but the massive change of the actual cardinality for the systematic index scan (10000 before the update) and 1 after the update is invisible to the CBO. I also created a trace sql (10046 event) but did not find a sign of the activity of the interchange of statistics - what a strange representation of the Adaptive plan (and no sql_id for the query in the way):


    Select sum (t1.col1) sum_col3

    from t1

    t2

    where t1.id = t2.id_t1

    and t1.col1 = 1

    call the query of disc elapsed to cpu count current lines

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Parse        2      0.00       0.00          0          0          0           0

    Run 2 0.00 0.00 0 0 0 0

    Pick 4 0.22 0.12 223 464 0 2

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Total 8 0.12 0.23 223 464 0 2

    Chess in the library during parsing cache: 1

    Optimizer mode: ALL_ROWS

    The analysis of the user id: 110

    Caught plan statistics number: 2

    Ranks (1) operation of line Source lines (avg) lines (max)

    ---------- ---------- ----------  ---------------------------------------------------

    1 1 1 TRI GLOBAL (cr = 232 pr = 112 pw = time 0 = 114572 US)

    10000 5500 10000 HASH JOIN (cr = 232 pr = 112 pw = time 0 = 113613 US cost = size = 84 card 1100000 = 100000)

    10000 5001 10000 NESTED LOOPS (cr = 29 pr = 14 pw = time 0 = 20841 US cost = size = 84 card 1100000 = 100000)

    10000 5001 10000 COLLECTOR of STATISTICS (cr = 29 pr = 14 pw = time 0 = 18786 US)

    10000 5001 10000 T1_ID_IDX INDEX RANGE SCAN (cr = 29 pr 14 pw = time = 0 = 16473 US cost = 28 = size card 80000 = 10000) (object id 92499)

    0 0 0 T2_IDX INDEX RANGE SCAN (0 = 0 US cost = size 55 cr = 0 pr = 0 pw = time = 30 card = 10) (object id 92501)

    100000 100000 100000 T2_IDX INDEX FAST FULL SCAN (cr 203 pr = pw 98 = time = 0 = 41156 US cost = size 55 = 300000 card = 100000) (object id 92501)

    Without comments dbms_xplan provides (format = > '+ adaptive'; shows how information: marked lines '-' are inactive) the regime is quite a mess.

    Of course an additional dynamic sampling (now statistics daynamic) gives the CBO the missing details but I assumed adaptation plans have an independent function.

    Here is finally my questions are:

    -is the effective use of additional prerequistes-based Adaptive plans (I missed read more of Maria Colgan)?

    -can anyone provide a link to a test (including data creation scripts) scenario showing plans adaptive in action?

    - Or it is indeed difficult to find a situation in which adaptation plans do a decent job (at least so far)?

    Concerning

    Martin Preiss

    After playing a little more thanks to the function, it seems that:

    -It is sometimes a good idea to read a white paper...

    -Adaptive elements of an accommodation plan is indeed relevant "on the first execution of a SQL statement.

    -After the first execution of the column IS_RESOLVED_ADAPTIVE_PLAN is defined on Y, saying that "the Adaptive parts of a plan have been resolved to the final plan" - V$ SQL

    -without the option format '+ adaptive' explain plan shows the variant cheapest Adaptive parts prior to execution, while dbms_xplan.display_cursor shows items that are executed after the execution.

    -the cost identified in the plan values are still the values for the cheaper plan: If there is an Adaptive decision between a hash join and a join of NL and statistics favor the hash join then join NL will indicate the cost of the hash join after execution. This isn't a big surprise given that statistics are not changed-, but it can sometimes cause a little confusion seen operation with a cost value that does not fit (at least if you ignore the note "is an adaptation plan")

    -plans of adaptation are not a solution for the volatile data (with modifications of significant cardinality after the last collection of statistics): it's always a dynamic sampling work (i.e. dynamic statistics)

    -the representation of Adaptive plans in a (formatted) sql trace is not very readable - lack of comments on the Adaptive plan inactive parties.

  • MRP planned creation not arrested for demand of component discrete job

    Hello

    We have recently made a change to our "All the provisions" MRP setup to "Supply & Demand calendar only items" in order to reduce the MRP process, time of execution.  Our parts are a mixture of these two Planning MRP/MPP Min/Max and.  We did a comparison of the orders planned between the two configurations and have noticed that planned orders are not generating some expected MRP/MPP components (necessary for a discreet MRP/MPP scheduled work) under "offers and request it only calendar items.  We currently charge an SDM as an entry for the MRP.

    What are the possible problems that cause a difference in identification of demand for discreet task between the two configurations? Attached are screenshots of our configuration load copy merge and MRP.

    Kind regards

    Malcolm

    Hello

    Looks like that the discrete work of MRP/MPP planned items is not part of demand or supply schedule and has not any application associated with it. can you please add this parent to MDS and check if the components are planned.

    Alternatively, you can verify if this discreet work has been created manually. If Yes, try to set the closed flag to work and check.

    Best regards

  • ODI-conditional scheduling for a scenario

    @

    Hello

    I have a conditional obligation plan a work/scenario in ODI

    There is a scenario 1 - which must be scheduled to run every day at 06:00 except Sunday

    Scenario 2 - which should be scheduled to run only on Sunday at 6:00

    Scenario 1 should be scheduled to run on Sunday after scenario 2 is executed.

    Can anyone suggest the best way to do it.

    Any help or suggestion will be greatly appreciated.

    Thanks and greetings

    Reshma

    Hello

    For the first instance, as mentioned above, schedule the job for scenario 1 to run every day except Sunday.

    Second case, where scenario1 must be performed after scenario 2 Sunday only.

    Create a separate package, in which you add step 1 Scenario 2 then step 2 Scenario 1 time in a synchronous mode and generate a scenario (annex work for this scenario run only on Sunday)

    or

    Create a separate package, in which you add step 1 Scenario 2 then step 2 OdiwaitforChildSession, step 3 Scenario 1 and scenario (annex work for this scenario run only on Sunday)

    In both cases the scenario 1 will be executed after the success of scenario 2.

    Thank you.

  • Basic parameters of SQL defining in oracle 11g env plan

    Hi Experts,
    We have recently improved 10 g for the version of database 11g folloing on hardware 'SUN SPARC ENTERPRISE T5440 SERVER'

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE Production 11.2.0.3.0
    AMT for Solaris: 11.2.0.3.0 - Production Version
    NLSRTL Version 11.2.0.3.0 - Production

    Please can you comment on the setting that we set as below.
    If you see a problem with this setting.

    NAME VALUE ISDEFAULT
    FALSE FALSE OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES
    optimizer_use_sql_plan_baselines TRUE TRUE

    Target memory is set as 0
    Memory max target is defined as 49280M
    Size max of SGA is defined as 49280M
    SGA_target is defined as 44G
    PGA_aggregate_target is defined as 4G

    So now, when my developers will keep on adding changes, plans will be less than optimal.

    Why not optimal? Optimizer generates plan based on statistics. If the statistics are fresh, in most cases the plan will be optimal. But in some cases, for complex queries, plan may be not optimal. In this case, you can manually create fixed plan with outline, profile sql or sql base plan.

    As long as you recommend, that I should change the value of the parameter optimizer_capture_sql_plan_baselines to TRUE and must schedule a task that will evaluate and evolve the lines plan basic sql newly captured.

    Yes, you can leave data base automatically resolve these issues in this way. In addition, you can use "automatic sql tuning task" that will generate and accept the sql Profiler. But in this case DBA can lose control of what's going on. Bad plan may be caused by an error of the developer. The best way is to test each change in the QA system before it will be applied on production.

    Another question. Since I updated memory_target zero and set parameters of the SGA to a zero, I think I do not allow Oracle to decide what is the best setting it shoud choose automatically. You are recommended to set all the parameters of the SGA to zero and the MEMORY_TARGET value to a non zero value? current setting is as below.

    Target memory is set as 0
    Memory max target is defined as 49280M
    Size max of SGA is defined as 49280M
    SGA_target is defined as 44G
    PGA_aggregate_target is defined as 4G

    It depends on the workload, amount of the session. For example, if consuption pga and sga is constant, there is no need to follow to the memory usage, therefore, you can use sga_target and pga_aggregate_target. If the workload varies during the day, requiring more sga the morning and less time use memory_target order to always use all the memory. If you want to limit the total PGA in order to have still large SGA, use not memory_target. For example, by default a session cannot use more than 200 MB of pga. Seen 100 simultaneous sessions requiring a great pga database can use up to 20 GB of memory that will be used on the buffer cache, causing the performance impact.

  • Turn off the LEDs in the structure of the case

    Hello

    I was wondering if someone could help me solve a problem in a software test bench that I am developing. I have attached some of my code in which the problem is visible. I have a business structure that is triggered by a 'push button '. I want the TEST that is currently RUNNING LED remain lit until the end of the execution of the case structure (condition true) then shuts down once it is completed. But the LED does not turn off and remains lit. Is that what I can do in the condition False to activate the LED is off when the code is not running. Please note that to run the program, you will need to "run continuously. I want until the led turns off after getting the 'result' so that the software operator can know that he is free to perform the next test. But now when the 'Start Test 2 "is executed after 'Start Test', the LED stays on.

    It might be a simple solution that I can be not familiar with, but forgive me, I am a new user of Labview and I could not find a solution to this online.

    Thank you.

    Kind regards
    DPAC

    Hi DPAC.

    simple solution as requested:

  • BlackBerry SIM temporary Q10, change of plans?

    Hi all

    I have a Q10 with a & AT T Blackberry plan (out of business).

    I'm about to visit a foreign country and tentatively plan to take a SIM card to use a local data plan.  My interest is primarily in the data.   The security features of my Q10 will mean that I'll need a special plan of BB?   Where can I get a regular plan as I would with Android devices?

    Hello

    Unlike legacy devices, BB10 devices do not use a specific data BB plan... they use "generic" like every other smartphone data plans. In some cases, have a BIS plan heritage on a BB10 device does not actually. So, as long as your device is unlocked by carrier and as long as your model is compatible with the other network (for radio frequencies and others), then you should be able to simply change the SIM card with one that has a generic data plan and keep going right.

    Good luck and let us know!

  • which will cause 'notify() and wait()' mechanism no longer works?

    Hi all

    My application has worked for a few years, unless the user recently upgraded to OS7.1 and to try out my new device, all of a sudden, he is part works not properly.

    Appplcaition will download data from the server, long story Short,

    When there is no queue of download, application will wait until asked to download real.

    my code something like the follow up:

            InvokeContainer c = new InvokeContainer(r);
            synchronized (c.syncObj) {
                // push to queue
                synchronized (_queue) { _queue.addElement(c); }
                LogManager.getInstance().add("Notify queue Thread _queue size " + _queue.size());
                synchronized (_queueSyncObj) { _queueSyncObj.notifyAll(); }
                // wait for release
               // LogManager.getInstance().add("Invoke data wait to release");
                //synchronized(c.syncObj){
                    try { c.syncObj.wait(); } catch (Exception ex) {}
                //}
                LogManager.getInstance().add("Invoke data released");
            }
    
            while (!_stop) {
                InvokeContainer c = null;
    
                // wait for invoke
                c = getNextInvoke();
                if (c == null) {
                    LogManager.getInstance().add("Wait For next queue");
                    synchronized (_queueSyncObj) {
                        try {
                            _queueSyncObj.wait();
                            LogManager.getInstance().add("Invoked");
                        } catch (Exception ex) {
                            LogManager.getInstance().add("Exception happened: " + ex.toString());
                        }
                    }
                    c = getNextInvoke();
                    LogManager.getInstance().add("Get a new queue ");
                }
    

    My question is:

    my request always stop at the:

     LogManager.getInstance().add("Notify queue Thread _queue size " + _queue.size());
    

    and I saw there's a queue, waiting, however, the line after wait() never called.

    which will cause notify() citing not wait()?

    For me, in places, your code seems too complicated for what he seeks to achieve.  I'll try to simplify.

    First you have loads of protection around your creating a Singleton RuntimeStore object.  This seems pointless.  Take a look at this:

    http://supportforums.BlackBerry.com/T5/Java-development/create-a-singleton-using-the-RuntimeStore/TA...

    Go through your code, I wonder what follows:

    (1) public static synchronized IPCThread getServerInstance() {}

    Why is this it is synchronized?  Iron several people getting to this offers no additional protection.

    (2) synchronized (GlobalSync.getSyncObj (GUID))...

    This synchronized block offers no additional protection either.  Either the

    IPCThread will be there or it won't, there is no possibility of a race condition causes you a problem here.

    (3) public static synchronized IPCThread initServerInstance() {}
    synchronized (GlobalSync.getSyncObj (GUID)) {}

    Here, there might be some value to have only one person to create it at the same time.  But if it's a question, then the second person through should check if it has been created, this code is not.  Thus, each invocation of

    initServerInstance()

    will create and start a new IPCThread.  The synchronized are totally redundant and you have a potential hole in your treatment.

    (4) public synchronized static getInstance() {} IPCThread

    you have another way to get an IPCThread, which in fact is not identical to the above and, will be different if you start another instance of your Application, for example an alternative entry or a variant of starting.

    I recommend that you replace it with the unique getInstance() method based on article.  Do start the IPCThread if it creates.

    OK, I understand that you don't think that this is related to your problem, but with the code you have, there may be several IPCThreads and would not help.

    Now on your invocation code.

    Can you please remove static from the following:

    private static class InvokeContainer...

    As far as I KNOW, he does not buy you anything in this circumstance, and it confuses me.

    The idea here seems to be that you can provide an executable in this process, which it runs and then inform the task (if necessary) awaiting.  You pack the floor area in an InvokeContainer.

    The first thing to look at, it's how you entered extracting from the queue.  Here you protect with this line:

    synchronized (inasmuch)

    So what you're saying to me here, it's that you will protect this treatment in protecting access to the inasmuch.  Something we will add it to the queue. or something is going to take off it the queue, both may not occur at the same time.  That's ok.

    So how do add you to the queue?

    Ignoring the code that will process if the process id is the same, we get this:

    InvokeContainer c = new InvokeContainer (r);
    synchronized (c.syncObj) {}
    Push the queue
    synchronized (inasmuch) {_queue.addElement (c) ;}
    synchronized (_queueSyncObj) {_queueSyncObj.notifyAll () ;}
    wait for the release
    try {c.syncObj.wait () ;} catch (Exception ex) {}}
    }

    Now, we have already seen the queue is protected using "synchronized (inasmuch).  But this code will not prevent the entry we just added picked up before that we treat the notify - in other words, the notification cannot be taken into account.  But that's OK.  The reverse is not.  If the Thread that processes the code IPCThread is at this point:

    If (c == null) {}

    and the Thread that the addition of the transformation executes these two instructions:

    synchronized (inasmuch) {_queue.addElement (c) ;}
    synchronized (_queueSyncObj) {_queueSyncObj.notifyAll () ;}

    then the IPCThread will miss warn him.

    To fix this, I'll do what I suggested earlier.

    The way, this seems very strange:

    InvokeContainer c = new InvokeContainer (r);
    synchronized (c.syncObj) {...}

    but in fact, this means that the code will never fail of the treated IPCThread this practicable, since the notification

    synchronized (c.syncObj) {c.syncObj.notify () ;}

    Cannot run until this thread is waiting.  It's a good thing.

    So that leaves only one thing to discuss - the.invokeAsync.  This code looks good, if the

    synchronized (c.syncObj) {...}

    is completely redundant.

    Summary - 2 recommendations:

    (a) change your Singleton IPCThread to use the RuntimeStore method suggested in the KB article

    (b) check the inside of the protection of

    synchronized (_queueSyncObj) {}

    which

    c = getNextInvoke();

    is always set to null.

    Finally, have you thought about putting a delay time in your expectations, while without worrying about the activity or not, the Thread will pick up every now and again work?  For example:

    _queueSyncObj.wait (1000);

    Edit: Minor typo and readability...

  • DataGuard protection mode - difference between max and max performance available

    Hi all

    for maximum performance - transaction can commit both redo entries are written in redolog on the main site. Redo data is written to an asynchronous backup site.


    (T1) the main site to the backup site connection fail, recovery of desynchronization logs will sync on once the connection is established?

    to see availability max - transaction can commit both redo entries are written in redolog on the main site + 1 of the standbysite.  If the main site to the backup site connection fail, it will behave as performance Max once the connection is restored, he will return to the max availability again.

    (Q2) if the main site to the backup site connection fail, recovery of desynchronization logs will sync on once the connection is established?

    Q3) in this case, what is the real difference between mode 2 above?

    Kind regards

    Noob

    Q3 - performance Maximum does not wait do it write in standby when the standby is available; is maximum availability. If the reserves are not available, they are the same.

    Q1/q2 are the same question and the answer is 'yes '.

Maybe you are looking for