Query hint no_push_pred

Hi,
I want to prevent oracle to do a VIEW PUSHED PREDICATE, because it slows down my query.
I know that adding query hints is not a good practice, anyway, I wonder why the hint /*+ NO_PUSH_PRED +*/ doesn't remove the VIEW PUSHED PREDICATE from my plan.
Do I always have to specify an alias /*+ NO_PUSH_PRED(TABLE_1) +*/ to get that working correctly?
Thanks!

Hi,
the hint can be used with or without an argument, but it has to be placed correctly, see http://docs.oracle.com/cd/B12037_01/server.101/b10752/hintsref.htm#6195
Also, the second "+" is redundant (i.e. /*+ NO_PUSH_PRED */ => /* NO_PUSH_PRED */ ).
If it doesn't resolve your issue, please post the text of the query.
Best regards,
Nikolay

Similar Messages

  • Query HINT help requested Pls.

    A query thus:
    SELECT equipment_id,
    vsemml.stock_equipment_id,
    game_ware_id
    FROM v_stocked_equipment_inven_his vsdeih,
    v_stock_equipment_mod_man_list vsemml
    WHERE vsemml.stock_equipment_id = vsdeih.stock_equipment_id(+)
    AND equipment_status_code IN
    ('ALL', 'AVA' )
    AND ec_end_date IS NULL
    AND eav_end_date IS NULL
    GROUP BY equipment_id,
    vsemml.stock_equipment_id,
    game_ware_id
    HAVING COUNT (model_attribute_value_id) =
    (SELECT COUNT (*)
    FROM stock_equipment JOIN stock_equipment_attrib_value
    USING (stock_equipment_id)
    WHERE stock_equipment_id =
    vsemml.stock_equipment_id);
    has result :
    513 rows selected.
    Elapsed: 00:04:59.17
    Execution Plan
    Plan hash value: 3816309895
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 240 | 21120 | | 38010 (7)| 00:07:37 |
    |* 1 | FILTER | | | | | | |
    | 2 | HASH GROUP BY | | 240 | 21120 | | 38010 (7)| 00:07:37 |
    |* 3 | FILTER | | | | | | |
    |* 4 | HASH JOIN OUTER | | 23915 | 2055K| | 38006 (7)| 00:07:37 |
    |* 5 | HASH JOIN | | 42 | 630 | | 7 (15)| 00:00:01 |
    | 6 | TABLE ACCESS FULL | MODEL | 31 | 279 | | 3 (0)| 00:00:01 |
    | 7 | TABLE ACCESS FULL | STOCK_EQUIPMENT | 42 | 252 | | 3 (0)| 00:00:01 |
    | 8 | VIEW | V_STOCKED_EQUIPMENT_INVEN_HIS | 23915 | 1704K| | 37998 (7)| 00:07:36 |
    | 9 | HASH UNIQUE | | 23915 | 2989K| 6392K| 37998 (7)| 00:07:36 |
    |* 10 | HASH JOIN RIGHT OUTER | | 23915 | 2989K| | 37307 (7)| 00:07:28 |
    | 11 | TABLE ACCESS FULL | GAME_WARE | 325 | 1950 | | 3 (0)| 00:00:01 |
    |* 12 | HASH JOIN RIGHT OUTER | | 23915 | 2849K| | 37303 (7)| 00:07:28 |
    | 13 | TABLE ACCESS FULL | GAMESET | 825 | 8250 | | 5 (0)| 00:00:01 |
    |* 14 | HASH JOIN | | 23915 | 2615K| | 37297 (7)| 00:07:28 |
    | 15 | TABLE ACCESS FULL | EQUIPMENT_STATUS | 16 | 128 | | 3 (0)| 00:00:01 |
    |* 16 | HASH JOIN | | 23915 | 2428K| | 37293 (7)| 00:07:28 |
    | 17 | TABLE ACCESS FULL | STOCK_EQUIPMENT | 42 | 252 | | 3 (0)| 00:00:01 |
    |* 18 | HASH JOIN | | 645K| 60M| | 37278 (7)| 00:07:28 |
    | 19 | INDEX FULL SCAN | XPKSTOCK_EQUIPMENT_ATTRIB_VAL | 42 | 294 | | 1 (0)| 00:00:01 |
    |* 20 | HASH JOIN | | 5288K| 458M| 9M| 37180 (7)| 00:07:27 |
    | 21 | TABLE ACCESS FULL | EQUIPMENT_ATTRIBUTE_VALUE | 297K| 6672K| | 784 (3)| 00:00:10 |
    |* 22 | HASH JOIN | | 7467K| 484M| 6328K| 5447 (5)| 00:01:06 |
    | 23 | INDEX FAST FULL SCAN | PK_EQUIPMENT_CONFIGURATION | 380K| 1859K| | 398 (3)| 00:00:05 |
    |* 24 | HASH JOIN | | 380K| 22M| 4528K| 3235 (2)| 00:00:39 |
    |* 25 | HASH JOIN | | 140K| 2876K| | 563 (2)| 00:00:07 |
    | 26 | MERGE JOIN | | 281 | 3372 | | 6 (17)| 00:00:01 |
    | 27 | TABLE ACCESS BY INDEX ROWID| SITE_TYPE | 4 | 20 | | 2 (0)| 00:00:01 |
    | 28 | INDEX FULL SCAN | PK_SITE_TYPE | 4 | | | 1 (0)| 00:00:01 |
    |* 29 | SORT JOIN | | 281 | 1967 | | 4 (25)| 00:00:01 |
    | 30 | VIEW | index$_join$_016 | 281 | 1967 | | 3 (0)| 00:00:01 |
    |* 31 | HASH JOIN | | | | | | |
    | 32 | INDEX FAST FULL SCAN | PK_SITE | 281 | 1967 | | 1 (0)| 00:00:01 |
    | 33 | INDEX FAST FULL SCAN | XIF1SITE | 281 | 1967 | | 1 (0)| 00:00:01 |
    | 34 | TABLE ACCESS FULL | LOCATION | 140K| 1232K| | 554 (2)| 00:00:07 |
    | 35 | TABLE ACCESS FULL | EQUIPMENT_CONFIGURATION | 380K| 15M| | 1460 (2)| 00:00:18 |
    | 36 | SORT AGGREGATE | | 1 | 6 | | | |
    | 37 | NESTED LOOPS | | 1 | 6 | | 0 (0)| 00:00:01 |
    |* 38 | INDEX UNIQUE SCAN | XPKSTOCK_EQUIPMENT | 1 | 3 | | 0 (0)| 00:00:01 |
    |* 39 | INDEX RANGE SCAN | XIF1STOCK_EQUIPMENT_ATTRIB_VAL | 1 | 3 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter(COUNT("MODEL_ATTRIBUTE_VALUE_ID")= (SELECT COUNT(*) FROM "STOCK_EQUIPMENT_ATTRIB_VALUE"
    "STOCK_EQUIPMENT_ATTRIB_VALUE","STOCK_EQUIPMENT" "STOCK_EQUIPMENT" WHERE "STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"=:B1 AND
    "STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID" AND
    "STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID"=:B2))
    3 - filter(("EQUIPMENT_STATUS_CODE"='ALL' OR "EQUIPMENT_STATUS_CODE"='AVA') AND "EC_END_DATE" IS NULL AND "EAV_END_DATE"
    IS NULL)
    4 - access("SE"."STOCK_EQUIPMENT_ID"="VSDEIH"."STOCK_EQUIPMENT_ID"(+))
    5 - access("SE"."MODEL_ID"="M"."MODEL_ID")
    10 - access("GS"."GAME_WARE_ID"="GW"."GAME_WARE_ID"(+))
    12 - access("EC"."GAMESET_ID"="GS"."GAMESET_ID"(+))
    14 - access("EC"."EQUIPMENT_STATUS_ID"="ES"."EQUIPMENT_STATUS_ID")
    16 - access("EC"."MODEL_ID"="STOCK_EQUIPMENT"."MODEL_ID" AND
    "STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID")
    18 - access("MODEL_ATTRIBUTE_VALUE_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."MODEL_ATTRIBUTE_VALUE_ID")
    20 - access("EC"."EQUIPMENT_ID"="EAV"."EQUIPMENT_ID")
    filter("EAV"."START_DATE">="EC"."START_DATE" AND ("EAV"."END_DATE" IS NULL AND "EC"."END_DATE">="EAV"."START_DATE" OR
    "EC"."END_DATE" IS NULL OR "EAV"."END_DATE"<="EC"."END_DATE") OR "EC"."START_DATE">="EAV"."START_DATE" AND ("EC"."END_DATE"
    IS NULL AND "EAV"."END_DATE">="EC"."START_DATE" OR "EAV"."END_DATE" IS NULL OR "EC"."END_DATE"<="EAV"."END_DATE"))
    22 - access("EC"."EQUIPMENT_ID"="EC"."EQUIPMENT_ID")
    24 - access("EC"."LOCATION_ID"="L"."LOCATION_ID")
    25 - access("L"."SITE_ID"="S"."SITE_ID")
    29 - access("S"."SITE_TYPE_ID"="ST"."SITE_TYPE_ID")
    filter("S"."SITE_TYPE_ID"="ST"."SITE_TYPE_ID")
    31 - access(ROWID=ROWID)
    38 - access("STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"=:B1)
    39 - access("STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID")
    filter("STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID"=:B1)
    Query altered to:
    =================
    SELECT equipment_id,
    vsemml.stock_equipment_id,
    game_ware_id
    FROM v_stocked_equipment_inven_his vsdeih,
    v_stock_equipment_mod_man_list vsemml
    WHERE vsemml.stock_equipment_id = vsdeih.stock_equipment_id(+)
    AND equipment_status_code = 'ALL'
    AND ec_end_date IS NULL
    AND eav_end_date IS NULL
    GROUP BY equipment_id,
    vsemml.stock_equipment_id,
    game_ware_id
    HAVING COUNT (model_attribute_value_id) =
    (SELECT COUNT (*)
    FROM stock_equipment JOIN stock_equipment_attrib_value
    USING (stock_equipment_id)
    WHERE stock_equipment_id =
    vsemml.stock_equipment_id)
    union
    SELECT equipment_id,
    vsemml.stock_equipment_id,
    game_ware_id
    FROM v_stocked_equipment_inven_his vsdeih,
    v_stock_equipment_mod_man_list vsemml
    WHERE vsemml.stock_equipment_id = vsdeih.stock_equipment_id(+)
    AND equipment_status_code = 'AVA'
    AND ec_end_date IS NULL
    AND eav_end_date IS NULL
    GROUP BY equipment_id,
    vsemml.stock_equipment_id,
    game_ware_id
    HAVING COUNT (model_attribute_value_id) =
    (SELECT COUNT (*)
    FROM stock_equipment JOIN stock_equipment_attrib_value
    USING (stock_equipment_id)
    WHERE stock_equipment_id =
    vsemml.stock_equipment_id);
    Results in:
    513 rows selected.
    Elapsed: 00:00:07.40
    Execution Plan
    Plan hash value: 3317078232
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 2 | 176 | | 6431 (51)| 00:01:18 |
    | 1 | SORT UNIQUE | | 2 | 176 | | 6431 (51)| 00:01:18 |
    | 2 | UNION-ALL | | | | | | |
    |* 3 | FILTER | | | | | | |
    | 4 | HASH GROUP BY | | 1 | 88 | | 3216 (2)| 00:00:39 |
    |* 5 | HASH JOIN | | 95 | 8360 | | 3214 (2)| 00:00:39 |
    |* 6 | HASH JOIN | | 42 | 630 | | 7 (15)| 00:00:01 |
    | 7 | TABLE ACCESS FULL | MODEL | 31 | 279 | | 3 (0)| 00:00:01 |
    | 8 | TABLE ACCESS FULL | STOCK_EQUIPMENT | 42 | 252 | | 3 (0)| 00:00:01 |
    | 9 | VIEW | V_STOCKED_EQUIPMENT_INVEN_HIS | 95 | 6935 | | 3207 (2)| 00:00:39 |
    | 10 | HASH UNIQUE | | 95 | 12160 | | 3207 (2)| 00:00:39 |
    |* 11 | HASH JOIN RIGHT OUTER | | 95 | 12160 | | 3206 (2)| 00:00:39 |
    | 12 | TABLE ACCESS FULL | GAME_WARE | 325 | 1950 | | 3 (0)| 00:00:01 |
    |* 13 | HASH JOIN OUTER | | 95 | 11590 | | 3202 (2)| 00:00:39 |
    |* 14 | HASH JOIN | | 95 | 10640 | | 3196 (2)| 00:00:39 |
    | 15 | TABLE ACCESS FULL | SITE_TYPE | 4 | 20 | | 3 (0)| 00:00:01 |
    |* 16 | HASH JOIN | | 95 | 10165 | | 3193 (2)| 00:00:39 |
    | 17 | VIEW | index$_join$_021 | 281 | 1967 | | 3 (0)| 00:00:01 |
    |* 18 | HASH JOIN | | | | | | |
    | 19 | INDEX FAST FULL SCAN | PK_SITE | 281 | 1967 | | 1 (0)| 00:00:01 |
    | 20 | INDEX FAST FULL SCAN | XIF1SITE | 281 | 1967 | | 1 (0)| 00:00:01 |
    | 21 | NESTED LOOPS | | 95 | 9500 | | 3189 (2)| 00:00:39 |
    |* 22 | HASH JOIN | | 96 | 8736 | 4440K| 3093 (2)| 00:00:38 |
    |* 23 | HASH JOIN | | 56789 | 3771K| | 1679 (2)| 00:00:21 |
    |* 24 | HASH JOIN | | 2894 | 178K| | 1273 (1)| 00:00:16 |
    | 25 | INDEX FULL SCAN | XPKSTOCK_EQUIPMENT_ATTRIB_VAL | 42 | 294 | | 1 (0)| 00:00:01 |
    |* 26 | HASH JOIN | | 2894 | 158K| | 1271 (1)| 00:00:16 |
    | 27 | TABLE ACCESS FULL | STOCK_EQUIPMENT | 42 | 252 | | 3 (0)| 00:00:01 |
    |* 28 | TABLE ACCESS BY INDEX ROWID| EQUIPMENT_CONFIGURATION | 1279 | 53718 | | 1265 (1)| 00:00:16 |
    | 29 | NESTED LOOPS | | 1860 | 93000 | | 1268 (1)| 00:00:16 |
    |* 30 | TABLE ACCESS FULL | EQUIPMENT_STATUS | 1 | 8 | | 3 (0)| 00:00:01 |
    |* 31 | INDEX RANGE SCAN | XIF3EQUIPMENT_CONFIGURATION | 23796 | | | 48 (3)| 00:00:01 |
    | 32 | INDEX FAST FULL SCAN | PK_EQUIPMENT_CONFIGURATION | 380K| 1859K| | 398 (3)| 00:00:05 |
    |* 33 | TABLE ACCESS FULL | EQUIPMENT_ATTRIBUTE_VALUE | 242K| 5451K| | 785 (3)| 00:00:10 |
    | 34 | TABLE ACCESS BY INDEX ROWID | LOCATION | 1 | 9 | | 1 (0)| 00:00:01 |
    |* 35 | INDEX UNIQUE SCAN | PK_LOCATION | 1 | | | 0 (0)| 00:00:01 |
    | 36 | TABLE ACCESS FULL | GAMESET | 825 | 8250 | | 5 (0)| 00:00:01 |
    | 37 | SORT AGGREGATE | | 1 | 6 | | | |
    | 38 | NESTED LOOPS | | 1 | 6 | | 0 (0)| 00:00:01 |
    |* 39 | INDEX UNIQUE SCAN | XPKSTOCK_EQUIPMENT | 1 | 3 | | 0 (0)| 00:00:01 |
    |* 40 | INDEX RANGE SCAN | XIF1STOCK_EQUIPMENT_ATTRIB_VAL | 1 | 3 | | 0 (0)| 00:00:01 |
    |* 41 | FILTER | | | | | | |
    | 42 | HASH GROUP BY | | 1 | 88 | | 3216 (2)| 00:00:39 |
    |* 43 | HASH JOIN | | 95 | 8360 | | 3214 (2)| 00:00:39 |
    |* 44 | HASH JOIN | | 42 | 630 | | 7 (15)| 00:00:01 |
    | 45 | TABLE ACCESS FULL | MODEL | 31 | 279 | | 3 (0)| 00:00:01 |
    | 46 | TABLE ACCESS FULL | STOCK_EQUIPMENT | 42 | 252 | | 3 (0)| 00:00:01 |
    | 47 | VIEW | V_STOCKED_EQUIPMENT_INVEN_HIS | 95 | 6935 | | 3207 (2)| 00:00:39 |
    | 48 | HASH UNIQUE | | 95 | 12160 | | 3207 (2)| 00:00:39 |
    |* 49 | HASH JOIN RIGHT OUTER | | 95 | 12160 | | 3206 (2)| 00:00:39 |
    | 50 | TABLE ACCESS FULL | GAME_WARE | 325 | 1950 | | 3 (0)| 00:00:01 |
    |* 51 | HASH JOIN OUTER | | 95 | 11590 | | 3202 (2)| 00:00:39 |
    |* 52 | HASH JOIN | | 95 | 10640 | | 3196 (2)| 00:00:39 |
    | 53 | TABLE ACCESS FULL | SITE_TYPE | 4 | 20 | | 3 (0)| 00:00:01 |
    |* 54 | HASH JOIN | | 95 | 10165 | | 3193 (2)| 00:00:39 |
    | 55 | VIEW | index$_join$_044 | 281 | 1967 | | 3 (0)| 00:00:01 |
    |* 56 | HASH JOIN | | | | | | |
    | 57 | INDEX FAST FULL SCAN | PK_SITE | 281 | 1967 | | 1 (0)| 00:00:01 |
    | 58 | INDEX FAST FULL SCAN | XIF1SITE | 281 | 1967 | | 1 (0)| 00:00:01 |
    | 59 | NESTED LOOPS | | 95 | 9500 | | 3189 (2)| 00:00:39 |
    |* 60 | HASH JOIN | | 96 | 8736 | 4440K| 3093 (2)| 00:00:38 |
    |* 61 | HASH JOIN | | 56789 | 3771K| | 1679 (2)| 00:00:21 |
    |* 62 | HASH JOIN | | 2894 | 178K| | 1273 (1)| 00:00:16 |
    | 63 | INDEX FULL SCAN | XPKSTOCK_EQUIPMENT_ATTRIB_VAL | 42 | 294 | | 1 (0)| 00:00:01 |
    |* 64 | HASH JOIN | | 2894 | 158K| | 1271 (1)| 00:00:16 |
    | 65 | TABLE ACCESS FULL | STOCK_EQUIPMENT | 42 | 252 | | 3 (0)| 00:00:01 |
    |* 66 | TABLE ACCESS BY INDEX ROWID| EQUIPMENT_CONFIGURATION | 1279 | 53718 | | 1265 (1)| 00:00:16 |
    | 67 | NESTED LOOPS | | 1860 | 93000 | | 1268 (1)| 00:00:16 |
    |* 68 | TABLE ACCESS FULL | EQUIPMENT_STATUS | 1 | 8 | | 3 (0)| 00:00:01 |
    |* 69 | INDEX RANGE SCAN | XIF3EQUIPMENT_CONFIGURATION | 23796 | | | 48 (3)| 00:00:01 |
    | 70 | INDEX FAST FULL SCAN | PK_EQUIPMENT_CONFIGURATION | 380K| 1859K| | 398 (3)| 00:00:05 |
    |* 71 | TABLE ACCESS FULL | EQUIPMENT_ATTRIBUTE_VALUE | 242K| 5451K| | 785 (3)| 00:00:10 |
    | 72 | TABLE ACCESS BY INDEX ROWID | LOCATION | 1 | 9 | | 1 (0)| 00:00:01 |
    |* 73 | INDEX UNIQUE SCAN | PK_LOCATION | 1 | | | 0 (0)| 00:00:01 |
    | 74 | TABLE ACCESS FULL | GAMESET | 825 | 8250 | | 5 (0)| 00:00:01 |
    | 75 | SORT AGGREGATE | | 1 | 6 | | | |
    | 76 | NESTED LOOPS | | 1 | 6 | | 0 (0)| 00:00:01 |
    |* 77 | INDEX UNIQUE SCAN | XPKSTOCK_EQUIPMENT | 1 | 3 | | 0 (0)| 00:00:01 |
    |* 78 | INDEX RANGE SCAN | XIF1STOCK_EQUIPMENT_ATTRIB_VAL | 1 | 3 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    3 - filter(COUNT("MODEL_ATTRIBUTE_VALUE_ID")= (SELECT COUNT(*) FROM "STOCK_EQUIPMENT_ATTRIB_VALUE"
    "STOCK_EQUIPMENT_ATTRIB_VALUE","STOCK_EQUIPMENT" "STOCK_EQUIPMENT" WHERE "STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"=:B1 AND
    "STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID" AND
    "STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID"=:B2))
    5 - access("SE"."STOCK_EQUIPMENT_ID"="VSDEIH"."STOCK_EQUIPMENT_ID")
    6 - access("SE"."MODEL_ID"="M"."MODEL_ID")
    11 - access("GS"."GAME_WARE_ID"="GW"."GAME_WARE_ID"(+))
    13 - access("EC"."GAMESET_ID"="GS"."GAMESET_ID"(+))
    14 - access("S"."SITE_TYPE_ID"="ST"."SITE_TYPE_ID")
    16 - access("L"."SITE_ID"="S"."SITE_ID")
    18 - access(ROWID=ROWID)
    22 - access("MODEL_ATTRIBUTE_VALUE_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."MODEL_ATTRIBUTE_VALUE_ID" AND
    "EC"."EQUIPMENT_ID"="EAV"."EQUIPMENT_ID")
    filter("EAV"."START_DATE">="EC"."START_DATE" AND ("EAV"."END_DATE" IS NULL AND "EC"."END_DATE">="EAV"."START_DATE" OR
    "EC"."END_DATE" IS NULL OR "EAV"."END_DATE"<="EC"."END_DATE") OR "EC"."START_DATE">="EAV"."START_DATE" AND ("EC"."END_DATE"
    IS NULL AND "EAV"."END_DATE">="EC"."START_DATE" OR "EAV"."END_DATE" IS NULL OR "EC"."END_DATE"<="EAV"."END_DATE"))
    23 - access("EC"."EQUIPMENT_ID"="EC"."EQUIPMENT_ID")
    24 - access("STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID")
    26 - access("EC"."MODEL_ID"="STOCK_EQUIPMENT"."MODEL_ID")
    28 - filter("EC"."END_DATE" IS NULL)
    30 - filter("ES"."EQUIPMENT_STATUS_CODE"='ALL')
    31 - access("EC"."EQUIPMENT_STATUS_ID"="ES"."EQUIPMENT_STATUS_ID")
    33 - filter("EAV"."END_DATE" IS NULL)
    35 - access("EC"."LOCATION_ID"="L"."LOCATION_ID")
    39 - access("STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"=:B1)
    40 - access("STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID")
    filter("STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID"=:B1)
    41 - filter(COUNT("MODEL_ATTRIBUTE_VALUE_ID")= (SELECT COUNT(*) FROM "STOCK_EQUIPMENT_ATTRIB_VALUE"
    "STOCK_EQUIPMENT_ATTRIB_VALUE","STOCK_EQUIPMENT" "STOCK_EQUIPMENT" WHERE "STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"=:B1 AND
    "STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID" AND
    "STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID"=:B2))
    43 - access("SE"."STOCK_EQUIPMENT_ID"="VSDEIH"."STOCK_EQUIPMENT_ID")
    44 - access("SE"."MODEL_ID"="M"."MODEL_ID")
    49 - access("GS"."GAME_WARE_ID"="GW"."GAME_WARE_ID"(+))
    51 - access("EC"."GAMESET_ID"="GS"."GAMESET_ID"(+))
    52 - access("S"."SITE_TYPE_ID"="ST"."SITE_TYPE_ID")
    54 - access("L"."SITE_ID"="S"."SITE_ID")
    56 - access(ROWID=ROWID)
    60 - access("MODEL_ATTRIBUTE_VALUE_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."MODEL_ATTRIBUTE_VALUE_ID" AND
    "EC"."EQUIPMENT_ID"="EAV"."EQUIPMENT_ID")
    filter("EAV"."START_DATE">="EC"."START_DATE" AND ("EAV"."END_DATE" IS NULL AND "EC"."END_DATE">="EAV"."START_DATE" OR
    "EC"."END_DATE" IS NULL OR "EAV"."END_DATE"<="EC"."END_DATE") OR "EC"."START_DATE">="EAV"."START_DATE" AND ("EC"."END_DATE"
    IS NULL AND "EAV"."END_DATE">="EC"."START_DATE" OR "EAV"."END_DATE" IS NULL OR "EC"."END_DATE"<="EAV"."END_DATE"))
    61 - access("EC"."EQUIPMENT_ID"="EC"."EQUIPMENT_ID")
    62 - access("STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID")
    64 - access("EC"."MODEL_ID"="STOCK_EQUIPMENT"."MODEL_ID")
    66 - filter("EC"."END_DATE" IS NULL)
    68 - filter("ES"."EQUIPMENT_STATUS_CODE"='AVA')
    69 - access("EC"."EQUIPMENT_STATUS_ID"="ES"."EQUIPMENT_STATUS_ID")
    71 - filter("EAV"."END_DATE" IS NULL)
    73 - access("EC"."LOCATION_ID"="L"."LOCATION_ID")
    77 - access("STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"=:B1)
    78 - access("STOCK_EQUIPMENT"."STOCK_EQUIPMENT_ID"="STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID")
    filter("STOCK_EQUIPMENT_ATTRIB_VALUE"."STOCK_EQUIPMENT_ID"=:B1)
    5 minutes reduced to 7 seconds.!!
    THE QUESTION.
    Which (and where) query hint do I use to get the FIRST query to use the execution plan "method" of the second -
    IE: To still perform well when a IN-LIST is used instead of EQUALS.
    Technical:
    Oracle 10.2.0.2 EE on Solaris 8, 64 bit.
    Please help.
    Thank you.
    Below is the code of the referenced views for clarity.
    CREATE OR REPLACE FORCE VIEW etrak.v_stocked_equipment_inven_his (stock_equipment_id,
    equipment_id,
    model_id,
    gameset_id,
    gameset_is_active,
    game_ware_id,
    game_ware_is_active,
    equipment_status_code,
    ec_start_date,
    ec_end_date,
    eav_start_date,
    eav_end_date,
    model_attribute_value_id,
    site_id,
    is_store
    AS
    SELECT DISTINCT stock_equipment_id, equipment_id, model_id, gameset_id,
    gameset_is_active, game_ware_id, game_ware_is_active,
    equipment_status_code, ec_start_date, ec_end_date,
    eav_start_date, eav_end_date, model_attribute_value_id,
    site_id, is_store
    FROM (SELECT stock_equipment_id, equipment_id, model_id,
    gameset_id, gameset_is_active, game_ware_id,
    game_ware_is_active, equipment_status_code,
    ec_start_date, ec_end_date, eav_start_date,
    eav_end_date, model_attribute_value_id, site_id,
    is_store
    FROM (SELECT DISTINCT equipment_id, model_id,
    gameset_id, gameset_is_active,
    game_ware_id, game_ware_is_active,
    equipment_status_code,
    model_attribute_value_id,
    ec_start_date, ec_end_date,
    eav_start_date, eav_end_date,
    site_id, is_store
    FROM (SELECT ec.equipment_id,
    ec.model_id,
    gs.gameset_id,
    gs.active_flag
    AS gameset_is_active,
    gw.game_ware_id,
    gw.active_flag
    AS game_ware_is_active,
    es.equipment_status_code,
    ec.start_date
    AS ec_start_date,
    ec.end_date
    AS ec_end_date,
    l.site_id, st.is_store
    FROM equipment_configuration ec,
    equipment_status es,
    LOCATION l,
    site s,
    site_type st,
    gameset gs,
    game_ware gw
    WHERE ec.equipment_status_id =
    es.equipment_status_id
    AND ec.gameset_id = gs.gameset_id(+)
    AND gs.game_ware_id = gw.game_ware_id(+)
    AND ec.location_id =
    l.location_id
    AND l.site_id = s.site_id
    AND s.site_type_id =
    st.site_type_id)
    JOIN
    (SELECT ec.equipment_id,
    model_attribute_value_id,
    eav.start_date
    AS eav_start_date,
    eav.end_date
    AS eav_end_date
    FROM equipment_configuration ec,
    equipment_attribute_value eav
    WHERE ec.equipment_id =
    eav.equipment_id)
    USING (equipment_id)
    WHERE ( eav_start_date >=
    ec_start_date
    AND ( ( eav_end_date IS NULL
    AND ec_end_date >=
    eav_start_date
    OR ec_end_date IS NULL
    OR eav_end_date <=
    ec_end_date
    OR ( ec_start_date >=
    eav_start_date
    AND ( ( ec_end_date IS NULL
    AND eav_end_date >=
    ec_start_date
    OR eav_end_date IS NULL
    OR ec_end_date <=
    eav_end_date
    JOIN
    (SELECT stock_equipment_id, model_id,
    model_attribute_value_id
    FROM stock_equipment JOIN stock_equipment_attrib_value
    USING (stock_equipment_id)
    ) USING (model_id,
    model_attribute_value_id)
    CREATE OR REPLACE FORCE VIEW etrak.v_stock_equipment_mod_man_list (stock_equipment_id,
    stock_equipment_code,
    model_id,
    model_name,
    model_type_id,
    model_type_code,
    model_type_name,
    man_id,
    man_name
    AS
    SELECT se.stock_equipment_id, se.stock_equipment_code, m.model_id,
    m.model_name, mt.model_type_id, mt.model_type_code,
    mt.model_type_name, ma.man_id, ma.man_name
    FROM stock_equipment se, model m, model_type mt, manufacturer ma
    WHERE se.model_id = m.model_id
    AND m.model_type_id = mt.model_type_id
    AND m.man_id = ma.man_id;

    What also makes it difficult to read is the lack of formatting tags ([code][/code] or [pre][/pre]) so that we can actually read the code and execution plans.
    I'm not going to trawl through formatting all that myself just to try and see what the differences are between query 1 and query 2.
    Also bear in mind that when query 2 ran, the data may have been cached and so there is less physical I/O required.
    You don't really want to use any hints to cause re-use of execution plans from 1 query to a different query (like I said, I don't know how different they are). What you want to do is determine what poor SQL coding is making the first query slow and fix it.

  • Query hint to force SQL to use a temporary table in a CTE query?

    Hi,
    is it possible to tell SQL Server to create a temporary table by itself when I'm using a CTE in my query?
    I have a query starting with a CTE where I group by my record, then another recursive CTE use the first CTE and finally my select statement like:
    with cte as (select a,b,c,row_number() ...  from mytable group by a,b,c)
    , cte2(select .... from cte A where rownum =1
    union all select ... from cte B inner join cte2 C on ......
    select * from cte2
    this query is very very slow, but if I store the first CTE into a temporary table and then cte2 consume my temp table rather than the CTE, the query is very fast.
    creating the temp table took 10sec and the select took 20sec
    while the initial query didnt return anything  after 2minutes!!!
    so what can I try to do to have the query running in less than 30sec without creating the temp table first?
    is there a query hint which can be used to tell SQL Server to convert the CTE into a temp table?
    as I have a lot of query to manage, I want to simplify my model without relying in temporary tables every time I suffer this issue...
    thanks.

    What is your SQL Server version?
    There is no hint to materialize results of cte into a temp table, so the solution you tried is the best you can have.
    I think the idea of materializing CTE into a temp table was already proposed on Connect. Try searching for this and vote.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Oracle query hints in JPQL - is it possible?

    Sorry, posted to wrong forum... I don't know how to delete it - only edit...
    Hello,
    I am using Sun Java Application Server 9.1 (GlassFish), EJB 3.0 and JPA (TopLink). My database is Oracle.
    Is there any way to specify Oracle query hints (for example, /*+ rule */ in JPQL queries? Or the only way to do it is using native queries?
    Many thanks in advance
    Edited by: Troff_2 on Nov 27, 2007 5:50 AM

    Yes.It is possible.Only need to modify the view for order tracker query need to change.
    You can use decode statement in the query to add status as Processing .
    Please refer the IBE_ORDER_SUM_V view for details.
    Eg:
    decode(oel.meaning,'Booked',"Processing",oel.meaning) from
    oe_lookups        
    oel,

  • Parallel query hint with stored outlines

    Hi,
    Can I use parallel query hint with stored outlines.
    Regards
    MMU

    I'm not quite sure what you're asking, since stored outlines themselves implement hints to try to maintain plan stability.
    If you're asking if stored outlines will utililze the parallel query hints I'd have to assume "yes" but would test the idea anyway.
    Message was edited by:
    riedelme

  • Use query hints to build the aggregate views

    can i get a link on this information
    and wherr can i find out about Aggregated design wizard that helps create aggregation scripts
    thanks
    Edited by: Next Level on Jul 8, 2012 6:10 AM

    Try
    Look for Query Hints - http://docs.oracle.com/cd/E17236_01/epm.1112/esb_dbag/alocare.html#alocare1073704
    Probably worth reading
    Aggregating an Aggregate Storage Database - http://docs.oracle.com/cd/E17236_01/epm.1112/esb_dbag/alocare.html#alocare1078558
    EAS documentation
    Query Hints http://docs.oracle.com/cd/E17236_01/epm.1112/eas_help/queryhints.html
    Aggregation Design Wizard - http://docs.oracle.com/cd/E17236_01/epm.1112/eas_help/dbwzagg.html
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Query hints in 10g

    Hello All-
    I am a database programmer who's attempting to understand how 10g handles hints within the CBO. Our applications have run with the RBO and will be migrating to 10g next year. I understand that the RBO will no longer be supported so I would assume that hints are now ignored, but in testing it does not appear that way (mostly queries using the APPEND hint are running much slower). Does anyone know how Oracle 10g handles hints embedded in packaged queries now?
    Thanks for your help!

    I am not gathering statistics in 9i. In addition, I setup 2 new machines (hardware and setup identical) and installed 9i on one and 10g on the other. The only difference is obviously the optimizer mode and the other parameters (I let Oracle decide these and have not modified them). When I look at a query that performed differently between the 2 versions, the explain plans are the same, yet the execution time is drastically different (1 minute on 9i versus 10 minutes on 10g- using the same data set and load).
    Do you think the differences could be attributable to the other parameters (sort area size, shared pool size, etc.) or is there something inherent about the optimizer that I am missing?
    Thanks for much for your input,
    Amy

  • Sql query hint - first filter , then join

    hello
    i have a following query (based on OWB data model views)
    select /* + LEADING(all_iv_xform_map_components all_iv_xform_map_parameters) USE_NL(all_iv_xform_map_components all_iv_xform_map_parameters) */
    comp.map_name,
    comp.operator_type ,
    param.map_component_name ,
    param.parameter_name,
    md.map_component_id,
    md.map_component_name,
    mp.MAP_COMPONENT_ID     ,
    mp.MAP_COMPONENT_NAME     
    from all_iv_xform_map_components comp,
    all_iv_xform_map_parameters param,
    ALL_IV_XFORM_MAP_PROPERTIES mp,
    ALL_IV_XFORM_MAP_DETAILS md
    where comp.map_name = nvl('&load_map_name','LOAD_MY_TABLE')
    and param.map_component_id = comp.map_component_id
    and param.map_component_id=md.map_component_id
    and md.map_component_id=mp.map_component_id
    what i want to achieve is to force the query to first filter out the table all_iv_xform_map_components and do the join with the remainign tables on the filtered rows only;
    i tried using the above hint but its not working; oracle still grabs to the full table: ALL_IV_XFORM_MAP_PROPERTIES
    id appreciate any tips
    thanks
    rgds

    HI
    for the sake of the case:
    i ran your query and its giving the clob error
    i hard coded the com id's and its not giving error anymore
    WITH comp AS
    (   SELECT --+materialize
            comp.map_name,
            comp.operator_type,
            comp.map_component_id,
            param.map_component_name ,
            param.parameter_name
        FROM
            all_iv_xform_map_components comp,
            all_iv_xform_map_parameters param
        WHERE
            comp.map_name = nvl('&load_map_name','LOAD_MY_TABLE)
        AND param.map_component_id = comp.map_component_id
        AND param.map_component_id  in ('3931622','3931625','3931624','3931623','3931626')  --> without this line its giving clob error, but these are the only comp ids retured by that query
    select
        comp.map_name,
        comp.operator_type ,
        comp.map_component_name ,
        comp.parameter_name,
        md.map_component_id,
        md.map_component_name,
        mp.MAP_COMPONENT_ID ,
        mp.MAP_COMPONENT_NAME
    from
        comp,
        ALL_IV_XFORM_MAP_PROPERTIES mp,
        ALL_IV_XFORM_MAP_DETAILS md
    where
        comp.map_component_id = md.map_component_id
    and comp.map_component_id = mp.map_component_id
    /

  • Query Hint on OBIEE

    Hi,
    how can I use Hints in OBIEE Query in OBIEE 11g?
    Thank you, best regards. R.

    Hi,
    Check this,
    http://www.howtoexam.com/index.php?option=com_content&view=article&id=75%3Ausing-hints-in-obiee-rpd-and-answers&catid=790%3Acomputers-and-software&Itemid=166
    Thanks
    Satya

  • Query hint in ASo

    Hi all,
    Wat is queryhint in ASO(11v)
    how it will work for performance
    wat should i do & how can i do this
    Please Can any one explain
    Thnaks

    Query hint is a way to give essbase an idea of the most likely queries that user will run against each dimension. For example - if your users will often query the lowest level of department in your cost center dimension you would set the hint for cost center to one of the level 0 members of that dimension. The idea is that this should speed up the queries from the users and give priority to these views. However if the system identfies that other levels are actually queried more often it will switch priority to the usage views. A full explanation is available in the dbag
    http://download.oracle.com/docs/cd/E12825_01/epm.111/esb_dbag/frameset.htm?launch.htm
    Hope this helps!

  • NOT Using Named Parameters in a Native Query

    Hi!
    like it is written in the Toplink JPA Extensions reference Toplink supports using named parameters in native queries.
    See example from http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-extensions.html:
    Example 1-11 Specifying a Named Parameter With #
    Query queryEmployees = entityManager.createNativeQuery(
    "SELECT OBJECT(emp) FROM Employee emp WHERE emp.firstName = #firstname"
    queryEmployeeByFirstName.setParameter("firstName", "Joan");
    Collection employees = queryEmployees.getResultList();
    But I want to use "#" in the SQL statement so I want to disable this parameter binding somehow and let the query just execute the SELECT statement I deliver.
    I have tried to add the property
    <property name="toplink.jdbc.bind-parameters" value="false"/>
    into the persistence.xml and I have also tried to add the query hint
    query.setHint(TopLinkQueryHints.BIND_PARAMETERS, HintValues.FALSE);
    but none of them prevents the # to be uses as a paramter. this causes the exception:
    Exception [TOPLINK-6132] (Oracle TopLink Essentials - 9.1 (Build b22)): oracle.toplink.essentials.exceptions.QueryException
    Exception Description: Query argument ######' not found in list of parameters provided during query execution.
    Query: ReadAllQuery(de.merck.compas.material.SimilarLocalMaterialListItemBV)
    The SQL Statement is
    SELECT * FROM TABLE (
    CAST ( RCGC.PHA_P_COMPASMDM.LookupSimilarMats
    ( 'COC003','10021500150000000997','30','30','040','standard','','001001','001001','123456','##########','X','X','X','X','U' )
    AS RCGC.PHA_COMPAS_SIMILAR_MATS ) )
    I am using the latest Toplink essentials build together with an Oracle 9.2i DB in a Java SE web application.
    Can anyone give me a little hint what to do?
    Thanks and best regards,
    Alex

    I hope this is what you need:
    [TopLink Fine]: 2007.01.19 02:56:48.278--ServerSession(17712783)--Connection(723185)--Thread(Thread[http-8080-Processor2
    3,5,main])--SELECT APPL_CGP_MATLOC, CHANGE_REQ_MATLOC, CD_PHA_MAT_LOC, LCOMP, LOC_MAT_NAME, APPL_GDM_MATLOC, LOC_MAT_NAM
    E_SHORT, APPL_PDW_MATLOC, PHA_MAT_LOC_LCOMMENT, APPL_TP_MATLOC, DIVISION, APPL_WRS_MATLOC, ARTICLE_ID_MDA, LU_PHA_MAT_LO
    C, LOC_MAT_NAME_OLD, LDT_PHA_MAT_LOC, PHA_MAT_LOC_STATUS, CU_PHA_MAT_LOC, MAT_LOC_ID, RCOMP, MAT_ID FROM RCGC.PHA_V_COMP
    AS_MAT_MATLOC WHERE ((MAT_LOC_ID = '123456') AND (RCOMP = '001001'))
    [TopLink Fine]: 2007.01.19 02:56:48.398--ServerSession(17712783)--Connection(32404901)--Thread(Thread[http-8080-Processo
    r23,5,main])--SELECT MAT_ID, DESCRIPTION, PHA_MATERIAL_LCOMMENT, PACKSIZE, LU_PHA_MATERIAL, PACKSIZE_UNIT, LDT_PHA_MATER
    IAL, CONTAINER_NAME, CU_PHA_MATERIAL, PURPOSE, CD_PHA_MATERIAL, CONTENT, CONTAINER_ID, AI_FACTOR, PHA_MATERIAL_STATUS, C
    MG_SPEC_APP, PROD_LEVEL, PACKAGE_SIZE, PRODUCT_ID FROM RCGC.PHA_V_COMPAS_MATERIAL WHERE (MAT_ID = '10021500150000000997'
    [TopLink Fine]: 2007.01.19 02:56:48.468--ServerSession(17712783)--Connection(723185)--Thread(Thread[http-8080-Processor2
    3,5,main])--SELECT PRODUCT_ID, PROD_GRP_ID, APPL_FORM_NAME, PRODUCT_NAME, GALENIC_FORM_NAME, APPL_FORM_ID, PHA_PRODUCT_S
    TATUS, PHA_PRODUCT_LCOMMENT, GALENIC_FORM_ID, LU_PHA_PRODUCT, INN, LDT_PHA_PRODUCT FROM RCGC.PHA_V_COMPAS_PRODUCT WHERE
    (PRODUCT_ID = 'COC003')
    [TopLink Fine]: 2007.01.19 02:56:48.568--ServerSession(17712783)--Connection(32404901)--Thread(Thread[http-8080-Processo
    r23,5,main])--SELECT APPL_CGP_MATLOC, CHANGE_REQ_MATLOC, CD_PHA_MAT_LOC, LCOMP, LOC_MAT_NAME, APPL_GDM_MATLOC, LOC_MAT_N
    AME_SHORT, APPL_PDW_MATLOC, PHA_MAT_LOC_LCOMMENT, APPL_TP_MATLOC, DIVISION, APPL_WRS_MATLOC, ARTICLE_ID_MDA, LU_PHA_MAT_
    LOC, LOC_MAT_NAME_OLD, LDT_PHA_MAT_LOC, PHA_MAT_LOC_STATUS, CU_PHA_MAT_LOC, MAT_LOC_ID, RCOMP, MAT_ID FROM RCGC.PHA_V_CO
    MPAS_MAT_MATLOC WHERE (MAT_ID = '10021500150000000997')
    [TopLink Warning]: 2007.01.19 02:56:48.638--UnitOfWork(4469532)--Thread(Thread[http-8080-Processor23,5,main])--Exception
    [TOPLINK-6132] (Oracle TopLink Essentials - 9.1 (Build b22)): oracle.toplink.essentials.exceptions.QueryException
    Exception Description: Query argument ######' not found in list of parameters provided during query execution.
    Query: ReadAllQuery(de.merck.compas.material.SimilarLocalMaterialListItemBV)
    Local Exception Stack:
    Exception [TOPLINK-6132] (Oracle TopLink Essentials - 9.1 (Build b22)): oracle.toplink.essentials.exceptions.QueryExcept
    ion
    Exception Description: Query argument ######' not found in list of parameters provided during query execution.
    Query: ReadAllQuery(de.merck.compas.material.SimilarLocalMaterialListItemBV)
    at oracle.toplink.essentials.exceptions.QueryException.namedArgumentNotFoundInQueryParameters(QueryException.jav
    a:206)
    at oracle.toplink.essentials.internal.databaseaccess.DatasourceCall.getValueForInParameter(DatasourceCall.java:6
    86)
    at oracle.toplink.essentials.internal.databaseaccess.DatasourceCall.getValueForInOutParameter(DatasourceCall.jav
    a:704)
    at oracle.toplink.essentials.internal.databaseaccess.DatasourceCall.translateQueryString(DatasourceCall.java:630
    at oracle.toplink.essentials.internal.databaseaccess.DatabaseCall.translate(DatabaseCall.java:850)
    at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQuer
    yMechanism.java:212)
    at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQuer
    yMechanism.java:199)
    at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCa
    llQueryMechanism.java:270)
    at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQu
    eryMechanism.java:600)
    at oracle.toplink.essentials.queryframework.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:302)
    at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:
    709)
    at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:609)
    at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:677)
    at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:7
    31)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2218)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:346)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:447)
    at de.merck.compas.material.SimilarLocalMaterialListItemBC.selectList(SimilarLocalMaterialListItemBC.java:40)
    at de.merck.compas.material.SimilarLocalMaterialListItemBC.selectSimilar(SimilarLocalMaterialListItemBC.java:53)
    at de.merck.compas.material.MaterialMaintainFS.init(MaterialMaintainFS.java:158)
    at de.merck.compas.material.MaterialListSV.startMaterialMaintain(MaterialListSV.java:186)
    at de.merck.compas.material.MaterialListSV.processPage(MaterialListSV.java:97)
    at de.merck.jsfw.servletFramework.AbstractServlet.processPage(AbstractServlet.java:141)
    at de.merck.jsfw.servletFramework.ControllerServlet.processLastPage(ControllerServlet.java:240)
    at de.merck.jsfw.servletFramework.ControllerServlet.processRequest(ControllerServlet.java:206)
    at de.merck.jsfw.servletFramework.ControllerServlet.doGet(ControllerServlet.java:181)
    at de.merck.jsfw.servletFramework.ControllerServlet.doPost(ControllerServlet.java:191)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at de.merck.comp.ntml.NTLMFilter.negotiate(NTLMFilter.java:384)
    at de.merck.comp.ntml.NTLMFilter.doFilter(NTLMFilter.java:165)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java
    :664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
    The Toplink manifest file with version number:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.5
    Created-By: 1.5.0_09-b03 (Sun Microsystems Inc.)
    Specification-Title: Java Persistence API
    Specification-Vendor: Sun Microsystems, Inc., Oracle Corp.
    Specification-Version: 1.0
    Implementation-Title: TopLink Essentials
    Implementation-Vendor: Sun Microsystems, Inc., Oracle Corp.
    Implementation-Version: 9.1 build: b22
    Thanks again for your help!

  • Query In SP runs 10x slower than straight query - NOT Parameter Sniffing Issue

    Hi Everyone,
    I have a real mystery on my hands that appears to be a parameter sniffing issue with my SP but I think is not. I have tried every parameter sniffing workaround trick in the book ( local variables, option recompile, with recompile, optimize for variables,UNKNOWN,
    table hints, query hints, MAXDOP, etc.) I have dropped indexes/recreated indexes, updated statistics, etc. I have restored a copy of the DB to 2 different servers ( one with identical HW specs as the box having the issue, one totally different ) and the SP
    runs fine on those 2, no workarounds needed. Execution plans are identical on all boxes. When I run a profiler on the 2 different boxes however, I see that on the server having issues, the Reads are around 8087859 while the other server with identical HW,
    the reads are 10608. Not quite sure how to interpret those results or where to look for answers. When the sql server service is restarted on the server having issues and the sp is run, it runs fine for a time ( not sure how long ) and then goes back to its
    snail pace speed. Here is the profile trace:
    Here is the stored procedure. The only modifications I made were the local variables to eliminate the obvious parameter sniffing issues and I added the WITH NOLOCK hints:
    /****** Object:  StoredProcedure [dbo].[EC_EMP_APPR_SIGNATURE_SEL_TEST]    Script Date: 12/03/2014 08:06:01 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    /****** Object:  StoredProcedure [dbo].[EC_EMP_APPR_SIGNATURE_SEL_TEST]    Script Date: 12/02/2014 22:24:45 ******/
    ALTER PROCEDURE [dbo].[EC_EMP_APPR_SIGNATURE_SEL_TEST]
    @EMPLOYEE_ID varchar(9) ,
    @OVERRIDE_JOB_CODE varchar(8),
    @OVERRIDE_LOCATION_CODE varchar(8),
    @OVERRIDE_EST_CODE varchar(8),
    @OVERRIDE_EMP_GROUP_CODE varchar(8)
    AS
    set NOCOUNT ON
    declare
    @EMPLOYEE_ID_LOCAL varchar(9),
    @OVERRIDE_JOB_CODE_LOCAL varchar(8),
    @OVERRIDE_LOCATION_CODE_LOCAL varchar(8),
    @OVERRIDE_EST_CODE_LOCAL varchar(8),
    @OVERRIDE_EMP_GROUP_CODE_LOCAL varchar(8)
    set @EMPLOYEE_ID_LOCAL = @EMPLOYEE_ID
    set @OVERRIDE_JOB_CODE_LOCAL = @OVERRIDE_JOB_CODE
    set @OVERRIDE_LOCATION_CODE_LOCAL = @OVERRIDE_LOCATION_CODE
    set @OVERRIDE_EST_CODE_LOCAL = @OVERRIDE_EST_CODE
    set @OVERRIDE_EMP_GROUP_CODE_LOCAL = @OVERRIDE_EMP_GROUP_CODE
    select 3 as SIGNATURE_ID
    from EC_EMPLOYEE_POSITIONS p
    where p.EMPLOYEE_ID = @EMPLOYEE_ID_LOCAL
     and DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) between p.POSITION_START_DATE and ISNULL(p.POSITION_END_DATE, convert(datetime, '47121231', 112))
     and (dbo.lpad(isnull(p.job_code,''), 8, ' ') + dbo.lpad(isnull(p.location_code,''), 8, ' ') + dbo.lpad(isnull(p.ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(p.EMP_GROUP_CODE,''), 8, ' '))
     in
     (select (dbo.lpad(isnull(ep.REPORTING_JOB_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_LOCATION_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_EMP_GROUP_CODE,''),
    8, ' '))
      from EC_POSITIONS  ep
      where DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) between ep.POSITION_EFFECT_DATE
       and ISNULL(ep.POSITION_TERM_DATE, convert(datetime, '47121231', 112))
       and (dbo.lpad(isnull(ep.job_code,''), 8, ' ') + dbo.lpad(isnull(ep.location_code,''), 8, ' ') + dbo.lpad(isnull(ep.ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.EMP_GROUP_CODE,''), 8, ' '))
       = (dbo.lpad(isnull(@OVERRIDE_JOB_CODE_LOCAL,''), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_LOCATION_CODE_LOCAL,''), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_EST_CODE_LOCAL,'<N/A>'), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_EMP_GROUP_CODE_LOCAL,''),
    8, ' ')))
    union
    select 4 as SIGNATURE_ID
    from EC_EMPLOYEE_POSITIONS p
    where p.EMPLOYEE_ID = @EMPLOYEE_ID_LOCAL
     and DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) between p.POSITION_START_DATE and ISNULL(p.POSITION_END_DATE, convert(datetime, '47121231', 112))
     and (dbo.lpad(isnull(p.job_code,''), 8, ' ') + dbo.lpad(isnull(p.location_code,''), 8, ' ') + dbo.lpad(isnull(p.ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(p.EMP_GROUP_CODE,''), 8, ' '))
     in
     (select (dbo.lpad(isnull(ep.REPORTING_JOB_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_LOCATION_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_EMP_GROUP_CODE,''),
    8, ' '))
      from EC_POSITIONS  ep with (NOLOCK)
      where DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) between ep.POSITION_EFFECT_DATE
       and ISNULL(ep.POSITION_TERM_DATE, convert(datetime, '47121231', 112))
       and (dbo.lpad(isnull(ep.job_code,''), 8, ' ') + dbo.lpad(isnull(ep.location_code,''), 8, ' ') + dbo.lpad(isnull(ep.ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.EMP_GROUP_CODE,''), 8, ' '))
       in   
     (select (dbo.lpad(isnull(ep.REPORTING_JOB_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_LOCATION_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_EMP_GROUP_CODE,''),
    8, ' '))
      from EC_POSITIONS ep  with (NOLOCK)
      where DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) between ep.POSITION_EFFECT_DATE
       and ISNULL(ep.POSITION_TERM_DATE, convert(datetime, '47121231', 112))
       and (dbo.lpad(isnull(ep.job_code,''), 8, ' ') + dbo.lpad(isnull(ep.location_code,''), 8, ' ') + dbo.lpad(isnull(ep.ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.EMP_GROUP_CODE,''), 8, ' '))
       = (dbo.lpad(isnull(@OVERRIDE_JOB_CODE_LOCAL,''), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_LOCATION_CODE_LOCAL,''), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_EST_CODE_LOCAL,'<N/A>'), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_EMP_GROUP_CODE_lOCAL,''),
    8, ' '))))
    order by SIGNATURE_ID
    Any suggestions would be greatly appreciated by anyone. I have no more tricks left in my toolbox and am starting to think its either the hardware or the database engine itself that is at fault.
    Max

    fast server:
    SQL Server parse and compile time:
       CPU time = 0 ms, elapsed time = 0 ms.
    SQL Server Execution Times:
    CPU time = 0 ms, elapsed time = 0 ms.
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    Table 'EC_POSITIONS'. Scan count 3, logical reads 10450, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'EC_EMPLOYEE_POSITIONS'. Scan count 2, logical reads 6, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    SQL Server Execution Times:
       CPU time = 3343 ms,  elapsed time = 3460 ms.
    SQL Server Execution Times:
       CPU time = 3343 ms,  elapsed time = 3460 ms.
    Slow server:
    SQL Server parse and compile time:
       CPU time = 0 ms, elapsed time = 0 ms.
    SQL Server Execution Times:
    CPU time = 0 ms, elapsed time = 0 ms.
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    Table 'EC_POSITIONS'. Scan count 3, logical reads 10450, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'EC_EMPLOYEE_POSITIONS'. Scan count 2, logical reads 6, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    SQL Server Execution Times:
       CPU time = 37875 ms,  elapsed time = 38295 ms.
    SQL Server Execution Times:
       CPU time = 37875 ms,  elapsed time = 38295 ms.
    Big diff in server execution times....

  • Can i Use two qery hints in one SQL(Oracle)?

    Hi,
    Can i Use two Query hints in one SQL(Oracle)? USE_HASH and No_Merge
    Thanks

    user10916886 wrote:
    Can I use like
    /*+ USE_HASH(X,Y) NO_MERGE(X) */
    will this work?Not really: NO_MERGE relates to mergeable views, not base tables. So whilst the USE_HASH may result in a hash join between the tables X and Y, USE_MERGE will be ignored for X.
    As hoek says, however, HINTs should be a last resort only, and if they're to be used at all you're best to stay with those that don't involve explicit objects, like ALL_ROWS, FIRST_ROWS_10, etc.
    user10916886 wrote:
    Im my database, if i don't use query hints. The expalin plan uses Nested loops, hence the query takes a lot of time.You would be better trying the ALL_ROWS hint here, instead of USE_HASH.
    Edit
    The optimizer, however, will have chosen NESTED LOOPs where it did because it believed that to be the most efficient data retrieval path with the information that it had to hand. So, if your statistics are comprehensive and up-to-date, yet the optimizer is continually opting for the less efficient plan, there's something else wrong, and HINTs are only masking that problem in the short-term.

  • Batch hint in toplink jpa

    hi all.
    Is there any mechanism in TopLink Essentials to make query with batch query hints like in EclipseLink?
    Thanks in advance.

    No, this functionality is only offered in EclipseLink. You can upgrade to EclipseLink for this.
    James : http://www.eclipselink.org

  • Copying Query & Formatting on Worksheet to New Worksheet in Same Workbook

    Hi,
    Can anyone advise me the quickest way to copy a query that is working on one worksheet to a new worksheet. More importantly how do I retain the formatted features of the worksheet from which I am coping from? I have tried to copy the query to a new worksheet which is OK but I cannot seem to retain the format features from the original worksheet. Am I missing something simple?  We are on version 3.5.
    Thanks

    Shanky_621: Thanks for taking the time to help. The following blog article talks about what I'm trying to do:
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;914288
    The goal is to recreate the inefficent plan on a test database without copying the data. The article talks about this as a "statistics only copy".
    You noted, "SQL server generating query plan is internal mechanism into which we cannot interfere unless we use Query hint...". The engine uses statistics and histograms to generate plans then choose the most efficent one for execution. Those statistics
    are generated from data in the database, and that process is done periodically. You don't think the engine actively scans each table in a query each and every time a query is run? Right! That would be crazy. It just checks the stats. What I'm trying to
    do is pull the stats from one database into another. The article does a better job explaining this.
    JRStern (Josh): Yes brother! You understand what I'm trying to do. Like you, I am wrestling with a feature/process I've only read about. The actual execution is... not as expected. I actually just found the article I noted to Shanky. I'm trying that process
    now. I'll tell you how it goes.
    Adam

Maybe you are looking for

  • How can I make the webpage display the same on different sized screens?

    I have made a webpage, but it appears differently in different resolutions. I am in 1920x1080 and it appears fine on my screen, but anything smaller than that, the text is zoomed in more and it is not central. website can be found here: http://www.fi

  • How do I sync my email on multiple devices?

    I read my email from several devices: my home computer, work computer, phone and ipad.  If I read it on one device and delete it, is not deleted when I read it from the other devices.  Is there a way to sync them so I can read, delete, save, file one

  • Send As permissions are being deleted, possible Protected Group problem

    I have a SBS 2008 server with a number of shared mailboxes that I need to assign Send As permissions to. However, I am getting bouncebacks when trying to use the Send As and have noticed that the settings I am applying are deleted after a short time.

  • Batch auto exposure or auto levels for a bunch of RAW images?

    Hi, I want to apply the "auto level" to a bunch of RAW images all at the same time. I've tried to use the lift+stamp tools, but they lift the applied level instead of the function "auto level" itself, and thus uses the same levels for all the images.

  • Multiple SAP component transport strategy

    Hi all, I have a SAP landscape with ERP, BW, F&R and DM. Each of these components has 2 instances (dev and quality/test). The transports between these instances are managed with the TMS, aren't they?? But my real problem is that I don't know how to d