Testing (all_rows/first_rows)

What is the best optimiser mode to use, all rows or first rows... in the following scenario..
Experimental testing of a new (Relativley small) Database before it is rolled out.... testing where indexes can improve performance generally (no specific bottle knecks known)
Im under the impression that first rows shouwl only be used when a query can be singled out that takes a relativley long time to run, where as in the situation where we are testing a database , or optimising it in general then all rows would be a better testing strategy?
Any comments? (other than use both)

An excellent discussion (with lots of real life examples) on the topic can be found in the following thread...
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::p11_question_id:3310002340673
vr,
Sudhakar B.

Similar Messages

  • Query Performance Please Help

    Hi can any body tell me how do I improve the performance of this query.This query takes forever to execute.
    PLEASE HELP
    select substr(d.name,1,14) "dist",
    sum(r.room_net_sq_foot) "nsf",
    sum(r.student_station_count) "sta",
    sum(distinct(r.cofte)) "fte"
    from b_fish_report r,
    g_efis_organization d
    where substr(r.organization_code,-2,2) = substr(d.code,-2,2) and
    d.organization_type = 'CNTY' and
    r.room_satisfactory_flag = 'Y' and
    substr(d.code,-2,2) between '01' and '72'
    -- rownum < 50
    group by d.name, r.organization_code
    order by d.name
    It has nonunique Indexes on Organization code
    Thanks
    Asma.

    Asma,
    I tried your SQL on my tables T1 and T2. Indexes are on C1,C2,C3 and N1,N2,N3. The data in T1 and T2 are shown below with the explain plan (also called EP) listed. You really need to do an explain plan (free TOAD is easiest to do this in) and respond showing your EP results.
    By simply changing the optimizer mode to RULE I was able to get it to use indexes on both T1 and T2.
    T1 data
    C1     C2     C3     N1     N2
    001     Y     AAA     1     11
    002     Y     BBB     2     22
    003     Y     CCC     3     33
    111     N     DDD     4     44
    222     N     EEE     5     55
    333     Y     FFF     6     66
    070     Y     GGG     7     77
    071     N     HHH     8     88
    072     Y     III     9     99
    TEST     TEST     TEST     10     100
    T2 data
    C1     C2     C3     N1     N2
    001     CNTY     AAA     1     11
    002     CNTY     BBB     2     22
    003     CNTY     CCC     3     33
    111     XXX     DDD     4     44
    222     XXX     EEE     5     55
    333     CNTY     FFF     6     66
    070     CNTY     GGG     7     77
    071     XXX     HHH     8     88
    072     CNTY     III     9     99
    TEST     TEST     TEST     10     100
    This is the results when I run the SQL based on this data ...
    dist     nsf     sta     fte
    AAA     1     11     10
    BBB     2     22     20
    CCC     3     33     30
    FFF     6     66     60
    GGG     7     77     70
    III     9     99     90
    --[SQL 1] : with CHOOSE as the optimizer mode, which is normally the DEFAULT if no hint is specified
    select /*+ CHOOSE */
    substr(d.c3,1,14) "dist",
    sum(r.n1) "nsf",
    sum(r.n2) "sta",
    sum(distinct(r.n3)) "fte"
    from t1 r, t2 d
    where substr(r.c1,-2,2) = substr(d.c1,-2,2) and
    d.c2 = 'CNTY' and
    r.c2 = 'Y' and
    substr(d.c1,-2,2) between '01' and '72'
    group by d.c3, r.c1
    order by d.c3
    This is what the EP shows for your SQL (which will probably be the same for you once you do an EP on your actuall sql) ...
    SELECT STATEMENT Optimizer=CHOOSE (Cost=4 Card=1 Bytes=37)
    SORT (GROUP BY) (Cost=4 Card=1 Bytes=37)
    NESTED LOOPS (Cost=2 Card=1 Bytes=37)
    TABLE ACCESS (FULL) OF T1 (Cost=1 Card=1 Bytes=12)
    TABLE ACCESS (BY INDEX ROWID) OF T2 (Cost=1 Card=1 Bytes=25)
    INDEX (RANGE SCAN) OF I_NU_T2_C2 (NON-UNIQUE)
    Notice the FULL table scan of T1 which you don't want, and neither C1 index is getting used (I've explained why below).
    --[SQL 2] : only changed the hint to RULE ...
    select /*+ RULE */
    substr(d.c3,1,14) "dist",
    sum(r.n1) "nsf",
    sum(r.n2) "sta",
    sum(distinct(r.n3)) "fte"
    from t1 r, t2 d
    where substr(r.c1,-2,2) = substr(d.c1,-2,2) and
    d.c2 = 'CNTY' and
    r.c2 = 'Y' and
    substr(d.c1,-2,2) between '01' and '72'
    group by d.c3, r.c1
    order by d.c3
    SELECT STATEMENT Optimizer=HINT: RULE
    SORT (GROUP BY)
    NESTED LOOPS
    TABLE ACCESS (BY INDEX ROWID) OF T2
    INDEX (RANGE SCAN) OF I_NU_T2_C2 (NON-UNIQUE)
    TABLE ACCESS (BY INDEX ROWID) OF T1
    INDEX (RANGE SCAN) OF I_NU_T1_C2 (NON-UNIQUE)
    Though the C2 index is getting used (your r.c2 = 'Y' part in the where clause) the main problem your having here is the JOIN column (C1 in both tables) is not getting used. So the join you have ...
    where substr(r.c1,-2,2) = substr(d.c1,-2,2)
    isn't using an index and you want it too. There are 2 solutions to correct this..
    Solution #1
    The first is to make a function-based index for data. Since your doing SUBSTR on C1 that C1 index does not contain that partial information so it will not use it. Below is the syntax to make a function based index for this partial data ...
    CREATE INDEX I_NU_T1_C1_SUBSTR ON T1 (SUBSTR(C1,-2,2));
    CREATE INDEX I_NU_T2_C1_SUBSTR ON T2 (SUBSTR(C1,-2,2));
    or also this way if it's still not using the above indexes ...
    CREATE INDEX I_NU_T1_C1_SUBSTR ON T1 (SUBSTR(C1,-2,2),C1);
    CREATE INDEX I_NU_T2_C1_SUBSTR ON T2 (SUBSTR(C1,-2,2),C1);
    Solution #2
    The second solution is to make another column in both table and place this 2 digit information in it, and then index this new column. That way the join will look like ...
    where r.c_new_column = d.c_new_column
    and
    r.c_new_column between '01' and '72'
    also with this new column the BETWEEN clause at the end you will not need the substring as well. Also remember BETWEEN on character values is different than numbers.
    Final Notes
    I just tried creating the functional index and I can't get it to be used it for some reason (I might not have the right amount of data), but I really think that is your best option here. As long as it uses the functional index you won't have to change your code. You might want to try using INDEX() in the hint to get it to be used, but hopefully it will use it right away. Try all 4 types of optimizer modes (CHOOSE, RULE, ALL_ROWS, FIRST_ROWS) in your primary hints to see if it will use the new function-based index.
    You really do need to get explain plan going. Even if you make these functional indexes you won't know if its going to be using them until you look at the EP results. You can do EP manually (the SQL of how to produce the results is in OTN, though I find free TOAD is by far the easiest) and you will still need to have run the utlxplan.sql script. Oracle I do think has some GUI tools, maybe in OEM, that have explain plan built in as well.
    I hope this helps ya,
    Tyler D.

  • Confusion using dbms_stat package

    Hi,
    I am using oracle 10G. I am quite confusied between analyze comman and dbms_stat package. In 9i we can use the analyze command to generate the execution plan if the optimizer select the CHOOSE base. But in oracle 10G this is obsolete, instead of that we can use the three parameter values viz, ALL_ROWS, FIRST_ROWS and FIRTS_N_ROWS. In oracle documentation it is written that whenever we user the value ALL_ROWS then the oracle server automatically selects the COST based optimizer.
    So My question is that what is the use of using dbms_stat package if the plan is automatically generated by setting the value ALL_ROWS in the parameter OPTIMIZER_MODE.
    Please reply ASAP.
    Thanks
    SS

    > I am quite confusied
    It would seem so. This is the wrong forum for your subject matter. What makes you think that DBMS_STATS have anything to do with object orientated programming, object relational design and advance (user) defined data types in Oracle?
    > Please reply ASAP.
    We are volunteers doing answers for free here.
    Urgent asap answers are supplied by Oracle Support when you file a Service Request with them. So try http://metalink.oracle.com for your asap answer.

  • Ordered hints in Oracle:

    There's a fairly popular Ordered Hint example on the web as follows:
    <CODE>
    select /*+ ordered use_nl(bonus) parallel(e, 4) */
    e.ename,
    hiredate,
    b.comm
    from
    emp e,
    bonus b
    where
    e.ename = b.ename
    </CODE>
    I would like to know what the "parallel(e, 4)" clause does. Where does the "4" come from? What is "parallel" here?
    I also have another question: If I have 5 tables--T_OREGON, T_UTAH, T_VIRGINIA, T_TEXAS, and T_OKLAHOMA--lined up in a join right behind a FROM, coming in at row counts of
    T_OREGON: [a lot of rows; a lot more than T_UTAH]
    T_UTAH: [smaller than T_OREGON] 40550 rows
    T_VIRGINIA: 14 rows
    T_TEXAS: 66 rows
    T_OKLAHOMA: 8 rows
    like so:
    ...from T_OREGON or, T_UTAH ut, T_VIRGINIA va, T_TEXAS tx, T_OKLAHOMA ok...
    my question is, if an Ordered hint can be used here, is it that the smallest table (in this case T_OKLAHOMA) gets placed first in the join and the rest of the table ascension in the join doesn't matter? Or is it that T_OKLAHOMA gets placed first in the join, followed by T_VIRGINIA [at 14 rows], followed by T_TEXAS, T_UTAH, and finally T_OREGON?
    Thank you for any help that you can provide.

    It is why my other question involved the table order
    behind a FROM keyword, (when employing an Ordered
    hint).
    Can anybody help with that question? Thanks again.With rule based optimizer order was important.
    With cost based optimizer (optimizer mode one of the all_rows, first_rows, forst_rows_n) order is not important Oracle itself chooses the order how to join tables.
    If you have gathered statistics leave CBO do his work. See more about optimizer here http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm
    And if you have taken this citation out of http://articles.techrepublic.com.com/5100-22_11-1050199.html then there are at least following problems:
    1) article is 4 years old
    2) article doesn't say anything about downsides using this hint e.g. what if your data changes and order is not relevant anymore, quite high possibility that query is changed but hint forgotten to change, maintaining additional level of complexity where Oracle has invested many many resources to assist users enhancing CBO
    3) and there is at least 1 fallacy in this article these sentences are wrong:
    "When Oracle evaluates table join orders, it must consider every possible combination of tables. For example, a six-way table join has 720 (permutations of 6, or 6 * 5 * 4 * 3 * 2 * 1 = 720) possible ways that the tables can be joined together. This permutation issue becomes even more pronounced when you have more than 10 joined tables in a query: For a 15-way table join, there are over one trillion (1,307,674,368,000 to be exact) possible query permutations that must be evaluated."
    (emphasis is mine - Gints)
    CBO abandons each permutation as soon as the cost is higher than the smallest from previous steps. So in reality CBO is much smarter than article tries to explain.
    If you really want to know how CBO works then I can only suggest to get book Cost based oracle fundamentals by Jonathan Lewis.
    Gints Plivna
    http://www.gplivna.eu

  • Queries related to databasr 11g .

    We are upgrading our database to 11g .
    There some programs that have queries using the below hints.
    all_rows
    first_rows
    choose
    rule
    full
    rowid
    index
    parallel
    Please let us know which hints 11g query optmizer will consider.Which of them will not be considered.Will the hints cause query performance to degrade in 11g.
    Regards .

    Please see your database version documentation.
    19 Using Optimizer Hints
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16638/hintsref.htm
    11.5 Controlling Optimizer Behavior
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16638/optimops.htm#PFGRF94574
    Hints
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements006.htm#SQLRF00219
    Thanks,
    Hussein

  • First_rows without hints OR all_rows with hints?

    Hello,
    I have about 6 tables which are related like a hierarchy, so the most upper table has few rows (< 1k) and the bottom table has many rows (1000k). An application is using those tables for viewing filtered data per table. There are different views per table which has its own filter (sql-statement). When the user click on a view the data must presented < 3s. The number of rows from the resultset of the views can variate from 0 to 1000k depending on the filter that is used for the view.
    The data in each table is skewed so I collected histograms. However, the CBO is in some cases predicting more rows than it should (see link below). As a workaround I used cardinality hints but for some views the number of rows is not constant. In that case an optimizer_mode change from ALL_ROWS to FIRST_ROWS works great but not for other views.
    I want to know which optimizer_mode I should choose. The user needs all the data so it seems that FIRST_ROWS is not a good choice but if I do that I need (dynamic?) hints.
    Another question, is it possible that 3s can't be done for all those views? How can I determin that I need a somewhat "aggresive" solution like materialized views?
    Thanks in advance.
    Message was edited by:
    RZ
    Forgot the link, Tuning sql

    Unfortunately the data in some columns is very skewed and without cursor sharing the performance is very bad. Objected-oriented programming against oracle caused thousends of repeating statements with just another variable in each statement. The good news I think is that the collumns that are skewed almost never binded as variables.
    Is there a way how I can check if the 2 statements below are both cached in the shared pool when I execute them or shall the execution step of the first statement will be re-used for the second?
    select *
    from dept
    where dept_id = :id
    select *
    from dept
    where dept_id = :id
    and status in ('V','P')  -- <- histogram on status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Query Performance Issue (First_rows hint)

    Dear friends, I am running a query on default optimizer mode (all_rows) but its not picking the right execution plan nor the right index but if changing optimizer mode into first_rows, its running insteadly. Tables statistics for concern tables are upto date. Same query was running fine some days back.
    Any idea about this behavior ?
    My culprit query as follow:
    SELECT *
    FROM (SELECT *
    FROM (SELECT /*+ parallel(h,10) */
    MSISDN,
    IMSI,
    SUBSCRIBER_TYPE,
    CASE
    WHEN INSTR(IN_SERVICE_NAMES, 'MTCIN') = 0 THEN
    WHEN INSTR(IN_SERVICE_NAMES, 'MTCIN') <> 0 THEN
    SUBSTR(IN_SERVICE_NAMES,
    INSTR(IN_SERVICE_NAMES, 'MTCIN') + 5,
    2)
    END MTC
    FROM RDMBKPIPRDAPP.HLS_OUT H
    WHERE LOAD_PROC_ID = '20112501'
    AND LOADING_COUNT = '1'
    AND SUBSCRIBER_TYPE = 'Prepaid')) A
    INNER JOIN (SELECT /*+ fu parallel(i,10) */
    MSISDN, IN_ID, LTRIM(IN_ID, '0') IN_INID
    FROM RDMBKPIPRDAPP.IN_OUT I
    WHERE LOAD_PROC_ID = '20112501'
    ) B ON A.MSISDN = B.MSISDN
    WHERE A.MOC <> B.IN_ID
    Regards
    Irfan Ahmad

    Irfan_Ahmad wrote:
    Dear friends, I am running a query on default optimizer mode (all_rows) but its not picking the right execution plan nor the right index but if changing optimizer mode into first_rows, its running insteadly. Tables statistics for concern tables are upto date. Same query was running fine some days back.
    Any idea about this behavior ?
    What is the "right" plan, what is the "wrong" plan, and what method do you use to convince yourself that the "right" plan IS the right plan ?
    Please use the 'code' tags when reporting the execution plans so that they are easily readable. (See comments at end of note).
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    There is a +"Preview"+ tab at the top of the text entry panel. Use this to check what your message will look like before you post the message. If it looks a complete mess you're unlikely to get a response. (Click on the +"Plain text"+ tab if you want to edit the text to tidy it up.)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • SQL is slow with optimizer_mode=ALL_ROWS

    Hi.
    We have an application layer with htmldb 2.0 running on 10.2 on HP-UX Itanium.
    One of the applications runs a sql joining two tables and using bind variables as in the selection critieria.
    The two tables has the following number of rows;
    SQL> select count(1) from innsyn_kunde.kunde;
    COUNT(1)
    96708
    SQL> select count(1) from innsyn_kunde.regning;
    COUNT(1)
    1867136
    SQL>
    The following intialization parameters are set on instances level:
    SQL> show parameter optimiz
    NAME TYPE VALUE
    optimizer_dynamic_sampling integer 2
    optimizer_features_enable string 10.2.0.1
    optimizer_index_caching integer 80
    optimizer_index_cost_adj integer 10
    optimizer_mode string FIRST_ROWS
    optimizer_secure_view_merging boolean TRUE
    plsql_optimize_level integer 2
    SQL>
    All tables and indexes used by the application has fresh statistics gathered with dbms_stats.
    The following sql is defined in htmldb:
    select
    regn.regningnr
    ,regn.appl_kode
    ,regn.regningtekst1
    ,regn.regningdato
    ,regn.kundenr
    ,kund.kundenavn kunde
    from innsyn_kunde.regning regn
    , innsyn_kunde.kunde kund
    where
    regn.appl_kode=kund.appl_kode
    and regn.kundenr=kund.kundenr(+)
    and regn.appl_kode = :P31_appl_kode
    and regn.kundenr like upper(decode(:P31_kundenr,null,'%',:P31_kundenr||'%'))
    and regn.regningnr like decode(:P31_regningnr,null,'%',:P31_regningnr||'%')
    and kund.kundenavn like upper(decode(:P31_kundenavn,null,'%',:P31_kundenavn||'%'))
    order by regn.regningdato desc
    1) If we substitute the bind variables with actual values in the actual sql in order to fetch one row the query runs very fast:
    select
    regn.regningnr
    ,regn.appl_kode
    ,regn.regningtekst1
    ,regn.regningdato
    ,regn.kundenr
    ,kund.kundenavn kunde
    from innsyn_kunde.regning regn
    , innsyn_kunde.kunde kund
    where
    regn.appl_kode=kund.appl_kode
    and regn.kundenr=kund.kundenr(+)
    and regn.appl_kode = 'SKOL'
    and regn.kundenr like '%'
    and regn.regningnr like '1150456%'
    and kund.kundenavn like '%'
    order by regn.regningdato desc
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.00 5 8 0 1
    total 4 0.00 0.00 5 8 0 1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 95 (INNSYN_KUNDE)
    Rows Row Source Operation
    1 SORT ORDER BY (cr=8 pr=5 pw=0 time=343 us)
    1 NESTED LOOPS (cr=8 pr=5 pw=0 time=315 us)
    1 TABLE ACCESS BY INDEX ROWID REGNING (cr=4 pr=1 pw=0 time=182 us)
    1 INDEX RANGE SCAN REGNING_IDX_03 (cr=3 pr=1 pw=0 time=165 us)(object id 68870)
    1 TABLE ACCESS BY INDEX ROWID KUNDE (cr=4 pr=4 pw=0 time=129 us)
    1 INDEX UNIQUE SCAN PK_KUNDE (cr=3 pr=3 pw=0 time=99 us)(object id 68356)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: ALL_ROWS
    1 SORT (ORDER BY)
    1 NESTED LOOPS
    1 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF 'REGNING'
    (TABLE)
    1 INDEX MODE: ANALYZED (RANGE SCAN) OF 'REGNING_IDX_03'
    (INDEX)
    1 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF 'KUNDE'
    (TABLE)
    1 INDEX MODE: ANALYZED (UNIQUE SCAN) OF 'PK_KUNDE' (INDEX
    (UNIQUE))
    2) If we use bind variables to reproduce the problem in htmldb from sqlplus like this we get the following result;
    select
    regn.regningnr
    ,regn.appl_kode
    ,regn.regningtekst1
    ,regn.regningdato
    ,regn.kundenr
    ,kund.kundenavn kunde
    from innsyn_kunde.regning regn
    , innsyn_kunde.kunde kund
    where
    regn.appl_kode=kund.appl_kode
    and regn.kundenr=kund.kundenr(+)
    and regn.appl_kode = :P31_appl_kode
    and regn.kundenr like upper(decode(:P31_kundenr,null,'%',:P31_kundenr||'%'))
    and regn.regningnr like decode(:P31_regningnr,null,'%',:P31_regningnr||'%')
    and kund.kundenavn like upper(decode(:P31_kundenavn,null,'%',:P31_kundenavn||'%'))
    order by regn.regningdato desc
    call count cpu elapsed disk query current rows
    Parse 3 0.00 0.00 0 0 0 0
    Execute 3 0.00 0.00 0 0 0 0
    Fetch 2 30.19 32.64 516728 1406955 0 1
    total 8 30.19 32.64 516728 1406955 0 1
    Misses in library cache during parse: 0
    Parsing user id: 64 (INNSYN_WEB) (recursive depth: 1)
    Rows Row Source Operation
    1 SORT ORDER BY (cr=1406955 pr=516728 pw=75 time=32643407 us)
    1 TABLE ACCESS BY INDEX ROWID REGNING (cr=1406955 pr=516728 pw=75 time=32643357 us)
    1354432 NESTED LOOPS (cr=106950 pr=42778 pw=75 time=17612677 us)
    50191 VIEW index$_join$_002 (cr=661 pr=736 pw=75 time=447634 us)
    50191 HASH JOIN (cr=661 pr=736 pw=75 time=297306 us)
    50191 INDEX RANGE SCAN PK_KUNDE (cr=258 pr=258 pw=0 time=163 us)(object id 68356)
    96705 INDEX RANGE SCAN KUNDE_IDX01 (cr=403 pr=403 pw=0 time=97049 us)(object id 68688)
    1304240 INDEX RANGE SCAN REGNING_IDX_01 (cr=106289 pr=42042 pw=0 time=3401535 us)(object id 68363)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: ALL_ROWS
    1 SORT (ORDER BY)
    1 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF 'REGNING'
    (TABLE)
    1354432 NESTED LOOPS
    50191 VIEW OF 'index$_join$_002' (VIEW)
    50191 HASH JOIN
    50191 INDEX MODE: ANALYZED (RANGE SCAN) OF 'PK_KUNDE'
    (INDEX (UNIQUE))
    96705 INDEX MODE: ANALYZED (RANGE SCAN) OF 'KUNDE_IDX01'
    (INDEX)
    1304240 INDEX MODE: ANALYZED (RANGE SCAN) OF 'REGNING_IDX_01'
    (INDEX)
    By using bind-variables it uses 30 seconds to fetch one row that is returned in less than a second with standard litherals
    3) And by doing something we probably not should, at least on 10.2 is to hint with RULE based optimization.
    Parsing user id: 95 (INNSYN_KUNDE)
    select /*+ RULE */
    regn.regningnr
    ,regn.appl_kode
    ,regn.regningtekst1
    ,regn.regningdato
    ,regn.kundenr
    ,kund.kundenavn kunde
    from innsyn_kunde.regning regn,
    innsyn_kunde.kunde kund
    where
    regn.appl_kode=kund.appl_kode
    and regn.kundenr=kund.kundenr (+)
    and regn.appl_kode = :P31_appl_kode
    and regn.kundenr like upper(decode(:P31_kundenr,null,'%',:P31_kundenr||'%'))
    and regn.regningnr like decode(:P31_regningnr,null,'%',:P31_regningnr||'%')
    and kund.kundenavn like upper(decode(:P31_kundenavn,null,'%',:P31_kundenavn||'%'))
    order by regn.regningdato desc
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 2 0.13 0.12 1109 1122 0 1
    total 4 0.13 0.12 1109 1122 0 1
    Misses in library cache during parse: 0
    Optimizer mode: RULE
    Parsing user id: 95 (INNSYN_KUNDE)
    Rows Row Source Operation
    1 SORT ORDER BY (cr=1122 pr=1109 pw=0 time=123795 us)
    1 FILTER (cr=1122 pr=1109 pw=0 time=123752 us)
    1 MERGE JOIN OUTER (cr=1122 pr=1109 pw=0 time=123735 us)
    1 SORT JOIN (cr=4 pr=0 pw=0 time=125 us)
    1 TABLE ACCESS BY INDEX ROWID REGNING (cr=4 pr=0 pw=0 time=83 us)
    1 INDEX RANGE SCAN REGNING_IDX_03 (cr=3 pr=0 pw=0 time=64 us)(object id 68870)
    1 SORT JOIN (cr=1118 pr=1109 pw=0 time=123601 us)
    96708 TABLE ACCESS FULL KUNDE (cr=1118 pr=1109 pw=0 time=199 us)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: HINT: RULE
    1 SORT (ORDER BY)
    1 FILTER
    1 MERGE JOIN (OUTER)
    1 SORT (JOIN)
    1 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF
    'REGNING' (TABLE)
    1 INDEX MODE: ANALYZED (RANGE SCAN) OF
    'REGNING_IDX_03' (INDEX)
    1 SORT (JOIN)
    96708 TABLE ACCESS MODE: ANALYZED (FULL) OF 'KUNDE' (TABLE)
    By using Rule based it uses 0.1 second to fetch one row from the database.
    Anyone seen this problems using Cost based with good statistics and bind variables giving such bad performance .
    Any help would be apreciated.
    rgds
    Kjell

    I have to add that sql that runs with bind variables is defined the following way:
    variable P31_appl_kode varchar2(10);
    variable P31_kundenr varchar2(10);
    variable P31_regningnr varchar2(10);
    variable P31_kundenavn varchar2(10);
    begin
    :p31_appl_kode := 'SKOL';
    :p31_kundenr :=NULL;
    :p31_regningnr :='1150456';
    :p31_kundenavn := null;
    end;
    select /*+ RULE */
    regn.regningnr
    ,regn.appl_kode
    ,regn.regningtekst1
    ,regn.regningdato
    ,regn.kundenr
    ,kund.kundenavn kunde
    from innsyn_kunde.regning regn,
    innsyn_kunde.kunde kund
    where
    regn.appl_kode=kund.appl_kode
    and regn.kundenr=kund.kundenr (+)
    and regn.appl_kode = :P31_appl_kode
    and regn.kundenr like upper(decode(:P31_kundenr,null,'%',:P31_kundenr||'%'))
    and regn.regningnr like decode(:P31_regningnr,null,'%',:P31_regningnr||'%')
    and kund.kundenavn like upper(decode(:P31_kundenavn,null,'%',:P31_kundenavn||'%'))
    order by regn.regningdato desc;
    rgds
    Kjell

  • Handling First_rows in Web Logic

    Dear ALL,
    The First_rows hint in a query in oracle gives data in first come first server basis .
    Is there any way to handle java result set to act in sync with first_rows so that first few are processed not needing to wait for query completion.
    It seems resultset object waits for query completion (i.e) complete result set to be fetched.
    Basically i am just a beginner to java and middleware.
    Can this be done?
    There is an option prefetch enable in weblogic console ....does this correspond to first_rows ?
    Thanks in advance,
    Vijay G

    Hi,
    >Could you tell how to move the targets section?
    Weblogic Console-->Deployments-->Your Application-->Testing
    >Any link for reading?
    http://docs.oracle.com/cd/E14571_01/web.1111/b31974/deployment_topics.htm
    https://blogs.oracle.com/shay/entry/common_pitfalls_when_deploying
    After you deploy the application, you can test it from Oracle WebLogic Server. To test-run your ADF application, open a browser window and enter a URL:
      For non-Faces pages: http://<host>:port/<context root>/<page>
      For Faces pages: http://<host>:port/<context root>/faces/<view_id>  where <view_id> is the view ID of the ADF task flow view activity.
    Tip:
    The context root for an application is specified in the view-controller project settings by default as ApplicationName/ProjectName/context-root. You can shorten this name by specifying a name that is unique across the target application server. Right-click the view-controller project, and choose Project Properties. In the Project Properties dialog, select Java EE Application and enter a unique name for the context root.
    Note:
    /faces has to be in the URL for Faces pages. This is because JDeveloper configures your web.xml file to use the URL pattern of /faces in order to be associated with the Faces Servlet. The Faces Servlet does its per-request processing, strips out /faces part in the URL, then forwards the URL to the JSP. If you do not include the /faces in the URL, then the Faces Servlet is not engaged (since the URL pattern doesn't match). Your JSP is run without the necessary JSF per-request processing.
    Regards,
    Fabian

  • Does using "fetch first N rows only" make /*+ FIRST_ROWS([N]) */ hint redundant?

    I know the FIRST_ROWS hint tells the optimizer to minimize time to first row.  I know the new 12c functionality for "FETCH [FIRST|NEXT] [N] ROWS [ONLY|WITH TIES]"fetch first/next N rows only/with ties" will implement the query using ROW_NUMBER().  Should I leave hint in case it improves performance, or does the FETCH FIRST clause make this hint redundant?

    maybe the answer to this question is more complicated then I assumed at first: as Randolf Geist wrote in his presentation Everything You Wanted To Know About FIRST_ROWS_n But Were Afraid To Ask a rownum predicate implicitly defines a first rows n optimization. So I guessed that the fetch first clause would trigger a similar optimization. But a rownum predicate and a fetch first clause are not transformed into the same operation:
    create table t
    as
    select rownum id
      from dual
    connect by level <= 1000000;
    select id
      from t
    where rownum <= 5;
       ID
        1
        2
        3
        4
        5
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     5 |    25 |     2   (0)| 00:00:01 |
    |*  1 |  COUNT STOPKEY     |      |       |       |            |          |
    |   2 |   TABLE ACCESS FULL| T    |     5 |    25 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter(ROWNUM<=5)
    select id
      from t
    fetch first 5 rows only;
       ID
        1
        2
        3
        4
        5
    | Id  | Operation              | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT       |      |  1000K|    24M|   427   (1)| 00:00:01 |
    |*  1 |  VIEW                  |      |  1000K|    24M|   427   (1)| 00:00:01 |
    |*  2 |   WINDOW NOSORT STOPKEY|      |  1000K|  4882K|   427   (1)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL   | T    |  1000K|  4882K|   427   (1)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("from$_subquery$_002"."rowlimit_$$_rownumber"<=5)
       2 - filter(ROW_NUMBER() OVER ( ORDER BY  NULL )<=5)
    Looking at a CBO trace for the two operations I see signs of a first rows optimization only for the query with the rownum predicate:
    Final query after transformations:******* UNPARSED QUERY IS *******
    SELECT "T"."ID" "ID" FROM "C##TEST"."T" "T" WHERE ROWNUM<=5
    First K Rows: Setup begin
    And so I think there is no first rows optimization for the fetch first clause. Of course the analytics would make an optimization for fast response almost impossible if there is an order in the query since in this case the analytics have to read the complete set before the filtering takes place.
    Regards
    Martin Preiss

  • Pagination and first_rows hint

    For a report region, how does HTML DB pagination work if the query has a first_rows hint in it?
    The pagination scheme I am talking about is the "simplest" one, Rows X to Y with next/previous links.
    Suppose I have a large resultset (in the thousands). first_rows is designed to optimize the execution plan for fast response time. So I get my first few pages fast. As successive pages are fetched, it would start to get slower and slower, right? Especially because the HTML DB engine fetches all the rows for every page over and over again and discards all the rows before the currently displayed window.
    So, given a large resultset, is it advisable to first_rows hint the query?
    Heck forget the size of the resultset, wouldnt it make sense to first_rows hint all queries since interactive web apps always fast response to queries?
    Can someone please explain how all this works?
    Thanks

    I would expect most of the time a user would only
    page through the first few pages - if they need toAbsent the first_rows hint, the CBO behaviour is to optimize for best overall performance (corresponding to the the all_rows hint)
    Steve, I agree with you completely. So, since the user is going to page thru the first handful of pages anyway, why would I want to expend database resources to optimize for all_rows?
    I think my concern about getting slower and slower is very much justified. If I have a query region using htmldb_item calls to create a manual tabular form, each next/previous link fetches all the records from 1 all over again and discards rows that fall before the requested rows. There would be tons of wasted calls to htmldb_item and the associated context switching between SQL and PL/SQL.
    [When the pagination scheme is Rows X to Y, I fail to understand why HTML DB doesnt use the clever pagination technique Tom suggests at
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064
    This would get just the rows needed and avoid unnecessary calls to htmldb_item. But I digress from the question I raised on this thread...]
    Tyler, Tom is not a big fan of hints, but he does recommend 2 hints that "give information" to the CBO that it wouldnt otherwise have. Those 2 hints are first_rows and cardinality!
    Thanks

  • Data mismatch in Test and Prod environments

    Hi,
    we have a query in Test and Prod environments.this query is not giving same result both for Test and production. Please have a look and share your thoughts.
    Select D1.C3,D1.C21,D2.C3,D2.C21
    from
    (select
    sum(F.X_SALES_DEDUCTION_ALLOC_AMT)as C3,
    O.Customer_num as C21
    from
    ESA_W_ORG_D O,
    ESA_W_DAY_D D ,
    ESA_W_SALES_INVOICE_LINE_F F
    where
    O.ROW_WID = F.CUSTOMER_WID
    and D.ROW_WID = F.INVOICED_ON_DT_WID
    and D.PER_NAME_FSCL_MNTH = '2012 / 12'
    group by O.Customer_num)D1,
    (select
    sum(F.X_SALES_DEDUCTION_ALLOC_AMT)AS c3,
    O.Customer_num as C21
    from
    Sa.W_ORG_D@STPRD O,
    Sa.W_DAY_D@STPRD D ,
    Sa.W_SALES_INVOICE_LINE_F@STPRD F
    where
    O.ROW_WID = F.CUSTOMER_WID
    and D.ROW_WID = F.INVOICED_ON_DT_WID
    and D.PER_NAME_FSCL_MNTH = '2012 / 12'
    group by O.Customer_num)D2
    where
    D1.C21=D2.C21
    and D1.C3<>D2.C3;I have done the following steps:
    1. created one temporary table and searched for duplicate records because if any duplicates found am planning to delete those records. but didn't find any duplicates. searched for common column values using equi join condition. are there any possibilities in data mismatch apart from this?
    2. this query is taking around 45 minutes to retrieve the output. I want to increase the performance of the query. so created Unique on 5 columns. but still taking the same time.
    so uing ALL_ROW HINT and ran the query but still it's taking the same time.
    so suggest me any thing needs to add to increase the performance?
    appreciate your support.
    Thanks.

    If you can create a temporary database link between the two environments use DBMS_RECTIFIER_DIFF or DBMS_COMPARISON to compare the two tables' contents.
    http://www.morganslibrary.org/reference/pkgs/dbms_comparison.html
    http://www.morganslibrary.org/reference/pkgs/dbms_rectifier_diff.html

  • Unit Testing, Null, and Warnings

    I have a Unit Test that includes the following lines:
    Dim nullarray As Integer()()
    Assert.AreEqual(nullarray.ToString(False), "Nothing")
    The variable "nullarray" will obviously be null when ToString is called (ToString is an extension method, which is the one I am testing). This is by design, because the purpose of this specific unit test is to make sure that my ToString extension
    method handles null values the way I expect. The test runs fine, but Visual Studio 2013 gives includes the following warning:
    Variable 'nullarray' is used before it has been assigned a value. A null reference exception could result at runtime.
    This warning is to be expected, and I don't want to stop Visual Studio 2013 from showing this warning or any other warnings, just this specific case (and several others that involve similar scenarios). Is there any way to mark a line or segment
    of code so that it is not checked for warnings? Otherwise, I will end up with lots of warnings for things that I am perfectly aware of and don't plan on changing.
    Nathan Sokalski [email protected] http://www.nathansokalski.com/

    Hi Nathan Sokalski,
    Variable 'nullarray' is used before it has been assigned a value. A null reference exception could result at runtime.
    Whether the warning above was thrown when you built the test project but the test run successfully? I assume Yes.
    Is there any way to mark a line or segment of code so that it is not checked for warnings?
    There is no built-in way to make some code snippet or a code line not be checked during compiling, but we can configure some specific warnings not to be warned during compiling in Visual Basic through project Properties->Compile
    tab->warning configurations box.
    For detailed information, please see: Configuring Warnings in Visual Basic
    Another way is to correct your code logic and make sure the code will not generate warning at runtime.
    If I misunderstood you, please tell us what code you want it not to be checked for warnings with a sample so that we can further look at your issue.
    Thanks,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Previewing on local testing server

    When previewing a file in the Dreamweaver development
    environment, Dreamweaver loads the file, say testfile.html, in the
    browser with its file system address, eg
    file://Applications/MAMP/htdocs/jsMath/test/testfile.html. However,
    the local website address of this file is
    http://localhost:8888/jsMath/test/testfile.html.
    This leads to a security error
    Security Error: Content at
    file:///Applications/MAMP/htdocs/jsMath/test/testfile.html may not
    load data from
    http://localhost:8888/jsMath/plugins/autoload.js.
    The problem can be circumvented by avoiding the Dreamweaver
    preview and hand-loading the file directly as
    http://localhost:8888/jsMath/test/testfile.html
    Surely the preview feature must not be bound by this
    restriction. What might be done to get preview to work properly
    with this local testing server?
    -dao

    daoliver wrote:
    > Surely the preview feature must not be bound by this
    restriction. What might
    > be done to get preview to work properly with this local
    testing server?
    You need to define the testing server correctly in your site
    definition.
    In your case, the Testing server folder field should be set
    to
    Applications/MAMP/htdocs/jsMath/test/ and the URL prefix to
    http://localhost:8888/jsMath/test/.
    David Powers
    Adobe Community Expert, Dreamweaver
    http://foundationphp.com

  • SSL TEST IN R12

    Hi,
    we are about to implement SSL in ebs r12.0.4 to ensure that the user name and password get passed over the browser as encrypted(by default which is passed as simple text).
    Now i am following metalink document Enabling SSL in Release 12 [ID 376700.1]
    Initially i was testing with the demo certifcatest at the $INST_TOP/certs/Apache.
    All the middle tier setups has been done.Then when i restarted the Application and tried to connect my url that get redirected to the SSL port correctly but then failed with following:--
    500 Internal Server Error
    java.lang.NoClassDefFoundError     at oracle.apps.fnd.sso.AppsLoginRedirect.AppsSetting(AppsLoginRedirect.java:120)     
    at oracle.apps.fnd.sso.AppsLoginRedirect.init(AppsLoginRedirect.java:161)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpApplication.loadServlet(HttpApplication.java:2231)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpApplication.findServlet(HttpApplication.java:4617)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpApplication.findServlet(HttpApplication.java:4541)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2821)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:740)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)     
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)     
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)     
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)     
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)     
    at java.lang.Thread.run(Thread.java:595)Please help.
    Edited by: Susmit on Dec 24, 2010 4:24 PM

    Hi;
    please check below notes:
    "500 Internal Server Error - java.lang.NoClassDefFoundError: oracle.apps.fnd.profiles.Profiles" on 10G [ID 567554.1]
    R12: Troubleshooting 500 Internal Server Error in Oracle E-Business suite [ID 813523.1]
    Regard
    Helios

Maybe you are looking for

  • Macbook speaker issure w/ Boot Camp and Windows XP

    I've just noticed that my new C2D Macbook's left internal speaker only outputs from the high-freq. driver when running Windows XP under Boot Camp. The right speaker works fine, both low-end and top-end output are fine. Everything works fine under OS

  • Multicamera angle's view out to external monitor?

    Hello Forum, Is it possible to have the angle view of multicamera viewable via transmit to my external monitor?  (via Blackmagic Intensity Pro) Currently, it only displays the active angle. Thanks all! - Ryan

  • Error when installing an ad hoc distribution build - what is this error?

    I've followed all the manual instructions to the letter I believe. But when installing the app and provisioning profile on an iPhone (one of the iPhones in the profile) the following error occurs: the application someAppName was not installed on the

  • CS 5.5 production premium and Camera RAW

    hello i just bought adobe creative suite 5.5 production premium when i opened the box i saw 3 stickers of Serial numbers , one for Color Finesse , PPro/AE CS4 32bit and Production Premium I put Production Premium SN when the installer lunched and i t

  • ITunes hangs with external drives; Genius is totally impossible to setup

    iTunes very frequently hangs when I am using tracks on my external hard drive. I have verified the correct xml of the library files, and the drive's permissions are good. I also recently defragged it. However, oftentimes if I am editing the tags on o