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
Similar Messages
-
Replacement for 'Rule' hint in 10g
Hi,
We have upgraded database from 9i to 10g. We have some sql queries which are using 'RULE' hints, but 10g is not supporting 'RULE' hints, can you please suggest me any replacement hint for 'RULE' hint in 10g or alternative ways to tune the sql query so that it will work same as 9i in 10g also in performance.
Kindly help me.
ThanksQuery:
SELECT HOU.NAME EMPRESA,
PAPF.FULL_NAME COMPRADOR,
NVL(SUBSTR(CAEV.DE_CODE, 1, 10), ' ') DE_COMPRADOR,
NVL(SUBSTR(CAEV.DI_CODE, 1, 10), ' ') DI_COMPRADOR,
NVL(SUBSTR(CAEV.GG_CODE, 1, 10), ' ') GG_COMPRADOR,
NVL(SUBSTR(CAEV.GA_CODE, 1, 10), ' ') GA_COMPRADOR,
PH.SEGMENT1 ORDEM_COMPRA,
PV.VENDOR_NAME FORNECEDOR,
DECODE(PVSA.GLOBAL_ATTRIBUTE9,
1,
PVSA.GLOBAL_ATTRIBUTE10 || '' || PVSA.GLOBAL_ATTRIBUTE12,
2,
PVSA.GLOBAL_ATTRIBUTE10 || '' || PVSA.GLOBAL_ATTRIBUTE11 || '' ||
PVSA.GLOBAL_ATTRIBUTE12,
3,
LPAD(PV.SEGMENT1 || REPLACE(PVSA.VENDOR_SITE_CODE, '-', ''),
15,
'0'),
PVSA.GLOBAL_ATTRIBUTE10 || '' || PVSA.GLOBAL_ATTRIBUTE11 || '' ||
PVSA.GLOBAL_ATTRIBUTE12) CNPJ,
PVSA.VENDOR_SITE_CODE LOCAL,
REPLACE(REPLACE(REPLACE(REPLACE(PH.COMMENTS, CHR(13) || CHR(10) || CHR(9), ' '),
CHR(9), ' '), CHR(10), ' '), '#', '')
DESCRIÇÃO,
(SELECT LAST_NAME
FROM APPS.PER_PEOPLE_F
WHERE EMPLOYEE_NUMBER = PH.ATTRIBUTE1
AND EFFECTIVE_END_DATE >= SYSDATE) GESTOR_DO_CONTRATO,
NVL(SUBSTR(CAEV2.DE_CODE, 1, 10), ' ') DE_GESTOR,
NVL(SUBSTR(CAEV2.DI_CODE, 1, 10), ' ') DI_GESTOR,
NVL(SUBSTR(CAEV2.GG_CODE, 1, 10), ' ') GG_GESTOR,
NVL(SUBSTR(CAEV2.GA_CODE, 1, 10), ' ') GA_GESTOR,
NVL(CAEV2.GA_NOME, ' ') GA_NOME,
PDT.TYPE_NAME TIPO,
TO_CHAR(PH.START_DATE, 'DD/MM/YYYY') DATA_INICIAL_EFETIVAÇÃO,
TO_CHAR(PH.END_DATE, 'DD/MM/YYYY') DATA_FINAL_EFETIVAÇÃO,
NVL(PH.CLOSED_CODE, 'OPEN') STATUS_DO_FECHAMENTO,
PH.BLANKET_TOTAL_AMOUNT VALOR_DO_CONTRATO,
(SELECT EMAIL_ADDRESS
FROM APPS.PER_PEOPLE_F
WHERE EMPLOYEE_NUMBER = PH.ATTRIBUTE1
AND EFFECTIVE_END_DATE >= SYSDATE) EMAIL_GESTOR_DO_CONTRATO
,FLV.MEANING STATUS_DA_APROVAÇÃO
,NVL((SELECT MCB.SEGMENT1 || '.' ||
MCB.SEGMENT2 || '.' ||
MCB.SEGMENT3 || '.' ||
MCB.SEGMENT4 || '.' ||
MCB.SEGMENT5
FROM PO.PO_HEADERS_ALL PAI,
PO.PO_HEADERS_ALL FILHO,
PO.PO_LINES_ALL PLA,
INV.MTL_CATEGORIES_B MCB
WHERE MCB.CATEGORY_ID = PLA.CATEGORY_ID
AND PAI.TYPE_LOOKUP_CODE = 'CONTRACT'
AND PLA.CONTRACT_ID = PAI.PO_HEADER_ID
AND PLA.PO_HEADER_ID = FILHO.PO_HEADER_ID
AND PAI.PO_HEADER_ID = PH.PO_HEADER_ID
AND NVL(PLA.CANCEL_FLAG, 'N') = 'N'
AND MCB.SEGMENT1 = 'SV'
AND ROWNUM = 1) ,
(SELECT MCB.SEGMENT1 || '.' ||
MCB.SEGMENT2 || '.' ||
MCB.SEGMENT3 || '.' ||
MCB.SEGMENT4 || '.' ||
MCB.SEGMENT5
FROM PO.PO_HEADERS_ALL PAI,
PO.PO_HEADERS_ALL FILHO,
PO.PO_LINES_ALL PLA,
INV.MTL_CATEGORIES_B MCB
WHERE MCB.CATEGORY_ID = PLA.CATEGORY_ID
AND PAI.TYPE_LOOKUP_CODE = 'CONTRACT'
AND PLA.CONTRACT_ID = PAI.PO_HEADER_ID
AND PLA.PO_HEADER_ID = FILHO.PO_HEADER_ID
AND PAI.PO_HEADER_ID = PH.PO_HEADER_ID
AND NVL(PLA.CANCEL_FLAG, 'N') = 'N'
AND MCB.SEGMENT1 = 'SE'
AND ROWNUM = 1)) CATEGORIA,
PH.ATTRIBUTE2 TIPO_DE_CONTRATO
FROM ---
(SELECT DISTINCT
PAPF.PERSON_ID,
PAPF.EMPLOYEE_NUMBER,
PAPF.FULL_NAME,
PAPF.EMAIL_ADDRESS,
HAOU_GA.ATTRIBUTE10 GA_CODE,
HAOU_GA.ATTRIBUTE11 GA_NOME,
HAOU_GG.ATTRIBUTE10 GG_CODE,
HAOU_GG.ATTRIBUTE11 GG_NOME,
HAOU_DI.ATTRIBUTE10 DI_CODE,
HAOU_DI.ATTRIBUTE11 DI_NOME,
HAOU_DE.ATTRIBUTE10 DE_CODE,
HAOU_DE.ATTRIBUTE11 DE_NOME
FROM APPS.PER_ALL_PEOPLE_F PAPF,
APPS.PER_ALL_ASSIGNMENTS_F PAAP,
APPS.PER_ALL_POSITIONS PAP,
APPS.HR_ALL_ORGANIZATION_UNITS HAOU_GA,
APPS.HR_ALL_ORGANIZATION_UNITS HAOU_GG,
APPS.HR_ALL_ORGANIZATION_UNITS HAOU_DI,
APPS.HR_ALL_ORGANIZATION_UNITS HAOU_DE
WHERE PAPF.PERSON_ID = PAAP.PERSON_ID
AND PAAP.POSITION_ID = PAP.POSITION_ID(+)
AND PAPF.EFFECTIVE_END_DATE = TO_DATE('31/12/4712', 'DD/MM/YYYY')
AND PAAP.EFFECTIVE_END_DATE = TO_DATE('31/12/4712', 'DD/MM/YYYY')
AND SUBSTR(PAP.NAME, 1, 12) = HAOU_GA.ATTRIBUTE9 (+)
AND SUBSTR(PAP.NAME, 1, 10) = HAOU_GG.ATTRIBUTE9 (+)
AND SUBSTR(PAP.NAME, 1, 8) = HAOU_DI.ATTRIBUTE9 (+)
AND SUBSTR(PAP.NAME, 1, 6) = HAOU_DE.ATTRIBUTE9 (+)) CAEV2,
APPS.PO_VENDORS PV,
APPS.PO_VENDOR_SITES_ALL PVSA,
APPS.PER_ALL_PEOPLE_F PAPF,
APPS.PO_DOCUMENT_TYPES_ALL_TL PDT,
APPS.HR_ALL_ORGANIZATION_UNITS HOU,
(SELECT DISTINCT
PAPF.PERSON_ID,
PAPF.EMPLOYEE_NUMBER,
PAPF.FULL_NAME,
PAPF.EMAIL_ADDRESS,
HAOU_GA.ATTRIBUTE10 GA_CODE,
HAOU_GA.ATTRIBUTE11 GA_NOME,
HAOU_GG.ATTRIBUTE10 GG_CODE,
HAOU_GG.ATTRIBUTE11 GG_NOME,
HAOU_DI.ATTRIBUTE10 DI_CODE,
HAOU_DI.ATTRIBUTE11 DI_NOME,
HAOU_DE.ATTRIBUTE10 DE_CODE,
HAOU_DE.ATTRIBUTE11 DE_NOME
FROM APPS.PER_ALL_PEOPLE_F PAPF,
APPS.PER_ALL_ASSIGNMENTS_F PAAP,
APPS.PER_ALL_POSITIONS PAP,
APPS.HR_ALL_ORGANIZATION_UNITS HAOU_GA,
APPS.HR_ALL_ORGANIZATION_UNITS HAOU_GG,
APPS.HR_ALL_ORGANIZATION_UNITS HAOU_DI,
APPS.HR_ALL_ORGANIZATION_UNITS HAOU_DE
WHERE PAPF.PERSON_ID = PAAP.PERSON_ID
AND PAAP.POSITION_ID = PAP.POSITION_ID(+)
AND PAPF.EFFECTIVE_END_DATE = TO_DATE('31/12/4712', 'DD/MM/YYYY')
AND PAAP.EFFECTIVE_END_DATE = TO_DATE('31/12/4712', 'DD/MM/YYYY')
AND SUBSTR(PAP.NAME, 1, 12) = HAOU_GA.ATTRIBUTE9 (+)
AND SUBSTR(PAP.NAME, 1, 10) = HAOU_GG.ATTRIBUTE9 (+)
AND SUBSTR(PAP.NAME, 1, 8) = HAOU_DI.ATTRIBUTE9 (+)
AND SUBSTR(PAP.NAME, 1, 6) = HAOU_DE.ATTRIBUTE9 (+)) CAEV,
APPS.PO_HEADERS_ALL PH,
APPS.FND_LOOKUP_VALUES FLV
WHERE PV.VENDOR_ID(+) = PH.VENDOR_ID
AND PVSA.VENDOR_ID(+) = PH.VENDOR_ID
AND PVSA.VENDOR_SITE_ID(+) = PH.VENDOR_SITE_ID
AND PVSA.GLOBAL_ATTRIBUTE9 <> 1
AND PAPF.EFFECTIVE_END_DATE > SYSDATE
AND PAPF.PERSON_ID(+) = PH.AGENT_ID
AND PH.AGENT_ID = CAEV.PERSON_ID(+)
AND PH.ATTRIBUTE1 = CAEV2.EMPLOYEE_NUMBER(+)
AND PDT.LANGUAGE = 'PTB'
AND PDT.ORG_ID(+) = PH.ORG_ID
AND PDT.DOCUMENT_TYPE_CODE IN ('PO', 'PA')
AND PDT.DOCUMENT_SUBTYPE(+) = PH.TYPE_LOOKUP_CODE
AND HOU.ORGANIZATION_ID(+) = PH.ORG_ID
AND PH.ORG_ID IN (90, 91, 92, 93, 94, 410, 414, 19626, 19628, 137) CVRD, HISPANOBRAS, KOBRASCO, NIBRASCO, ITABRASCO,CPBS,FGC,FCA,SALOBO,FVRD
AND PH.ORG_ID IN (90,19626) CVRD,FCA
AND NVL(PH.FROZEN_FLAG, 'N') = 'N'
AND NVL(PH.CANCEL_FLAG, 'N') = 'N'
AND NVL(PH.AUTHORIZATION_STATUS, 'INCOMPLETE') IN ('APPROVED', 'PRE-APPROVED', 'IN PROCESS', 'REQUIRES REAPPROVAL')
AND PH.TYPE_LOOKUP_CODE = 'CONTRACT'
AND EXISTS (SELECT 1
FROM PO.PO_HEADERS_ALL PAI,
PO.PO_HEADERS_ALL FILHO,
PO.PO_LINES_ALL PLA,
INV.MTL_CATEGORIES_B MCB
WHERE MCB.CATEGORY_ID = PLA.CATEGORY_ID
AND PAI.TYPE_LOOKUP_CODE = 'CONTRACT'
AND PLA.CONTRACT_ID = PAI.PO_HEADER_ID
AND PLA.PO_HEADER_ID = FILHO.PO_HEADER_ID
AND PAI.PO_HEADER_ID = PH.PO_HEADER_ID
AND NVL(PLA.CANCEL_FLAG, 'N') = 'N'
AND MCB.SEGMENT1 IN ('SE', 'SV'))
-- AND PH.ATTRIBUTE2 IN ('CUSTEIO (SERVIÇO)', 'INVESTIMENTO (SERVIÇO)')
AND ((NVL(PH.CLOSED_CODE, 'OPEN') = 'OPEN') OR
(NVL(PH.CLOSED_CODE, 'OPEN') = 'CLOSED' AND
PH.END_DATE BETWEEN TO_DATE(:DATA_INICIO||' 00:00:00', 'DD/MM/YYYY HH24:MI:SS') AND
TO_DATE(:DATA_FIM||' 23:59:59', 'DD/MM/YYYY HH24:MI:SS')))
and flv.language = 'PTB'
and flv.lookup_type = 'AUTHORIZATION STATUS'
and flv.lookup_code = nvl(ph.authorization_status,'INCOMPLETE') -
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 -
Physical Query in OBIEE 10g vs OBIEE 11g
Hi Everyone,
We're in the middle of an OBIEE 10g to an OBIEE 11.1.1.6.4 upgrade and as part of our assembly testing we were planning on comparing the physical query generated for a report generated in obiee 10g vs the physical query for a report in obiee 11g.
After a couple reports we noticed that the query structure in 11g is completely different than the query structure in 10g. The reports still generated the same data in 10g vs 11g. So my question is:
1) is it worth while (or necessary) to do a physical query comparison for an obiee 10g to 11g upgrade? or is validating the front-end report data & drill down/interactions adequate?
2) what are some general reasons why a query generates differently in obiee 10g vs 11g?Pl post details of OS versions, exact database versions (to 4 digits) and init.ora parameters of the 10g and 11g databases. Have statistics been gathered after the upgrade ?
For posting tuning requests, pl see these threads
HOW TO: Post a SQL statement tuning request - template posting
When your query takes too long ...
Pl see if the SQL Performance Analyzer can help - MOS Doc 562899.1 (TESTING SQL PERFORMANCE IMPACT OF AN ORACLE 9i TO ORACLE DATABASE 10g RELEASE 2 UPGRADE WITH SQL PERFORMANCE ANALYZER)
HTH
Srini -
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 AMYes.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
MMUI'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 -
Extract the "bind" variables for a given query running in 10g.
how can we extract the "bind" variables for a given query running in 10g? The performance of a query may vary based on the parameters supplied to it. For example, a query like the following
SELECT * FROM CUSTOMER_ORDERS WHERE CUSTOMER = :CUST_ID
.might run differently when the :CUST_ID is "123" who may have very few orders versus "456" who may have tens of thousands of orders.
So, if we see a spike in the system due to a query, we need visibility into what the exact query syntax and values are for any database session. We're aware of an Oracle view called V$SQL_BIND_CAPTURE, but what we're finding with this view is that it's only a snapshot of variables that are refreshed on an interval. That view does not give us a live view into what values are being used in the various sessions in realtime.
If someone ould provide us with some SQL (or other means) to do get a realtime view into the SQL and variables currently running in the database, it would be greatly appreciated.In addition to what's been said in the other thread, you could add a layer of logging either in the database or out.
v$sql_bind_capture and the associated ash view dba_hist_sqlbind contain sample data.
You could up the sample rate but it's not advisable - it's still just a sample.
If you're on 11g, this is where adaptive cursor sharing might help.
Not help in finding the values of your binds, but help in using different plans where there is such a skew for different bind values and the plan is perhaps wrong for customer 456.
The problem when you're got such a skew and you're using bind variables is that the two don't really go together.
When the query is next parsed and you've got bind variable peeking enabled, you might get the 123 plan is that is the bind value at parse time and then run into problems for 456 or even vice versa.
See http://jonathanlewis.wordpress.com/2009/05/06/philosophy-1/ for a discussion on binds and histograms which reflects the reasons for using either. -
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 -
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 AMTry
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/ -
Issue with "Select Distinct" query in Oracle 10g against Oracle 9i
Hi,
I would appreciate if some one help me here because it is really urgent.
We are upgrading our database from 9i to 10g.
There are the "Select distinct" queries in the code which populated the grid on the applications screens. We found a difference in 9i and 10g the way the result is populated for these queries. If "Select Distinct" query wihtout a order by clause is executed in 9i then the result is automatically sorted. But Oracle 10g does not do this.
We can change the queries adding order by clause but we are almost at the end of the testing and want to know if there is any way that we can do this from database settings. Would there be any impact of these settings change on overall operation of Oracle 10g?
I would appreciate if some one can help me here.
Thanks,
Dineshthen the result is automatically sorted.No. Oracle may have done a sort operation to perform the distinct, but it still did not guarantee the order of your results.
In 10g and in 9i, if you want your results in a certain order you must use order by. -
Form auto query works in 10g developer, but not when served by forms server
I have a form with a master and two detail blocks on the same canvas. When I run it from the developer tool on my desktop, it works great, the master block populates as expected based on the GO_BLOCK and EXECUTE_QUERY statements, and the detail blocks both populate automatically, firing their POST_QUERY triggers as well. When I run it on the server, I have to execute query manually, and then navigate to each of the detail blocks and then execute their queries manually too. When I do that, their POST_QUERY triggers are not firing.
Desktop is (Windows XP Professional version 5.1 build 2600.xpsp_sp3_gdr.100427-1636 : Service Pack 3)
Developer version is Forms [32 Bit] Version 10.1.2.0.2 (Production)
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Oracle Toolkit Version 10.1.2.0.2 (Production)
PL/SQL Version 10.1.0.4.2 (Production)
Oracle Procedure Builder V10.1.2.0.2 - Production
PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
Oracle Query Builder 10.1.2.0.2 - Production
Oracle Virtual Graphics System Version 10.1.2.0.2 (Production)
Oracle Tools GUI Utilities Version 10.1.2.0.2 (Production)
Oracle Multimedia Version 10.1.2.0.2 (Production)
Oracle Tools Integration Version 10.1.2.0.2 (Production)
Oracle Tools Common Area Version 10.1.2.0.2
Oracle CORE 10.1.0.4.0 Production
Server version is OAS forms/reports install – 10.1.2.3
OS – x86-64bit (Red Hat Enterprise Linux Server release 5.4)hello,
does oracle showing any errors in user_scheduler_job_run_details for this job ? I would advise try inserting some debug statement to identify where exactly its stuck. Also please check sample configurations syntax for user_scheduler_jobs.
Cheers
Sush -
Query Optimization (Oracle 10g)
Hi All,
I have written a query. But It's taking around 15 minutes. Can you please check the query and Explain plan of the query and give me the solution for optimize the query.
Query :
SELECT *
FROM temp.r_view
WHERE cur IN (SELECT p_id_d
FROM temp.pm
WHERE p_id_h = 'CURRENCY' AND p_txt
= 'EUR')
AND rec_amt >= 10
AND r_view.date_exec >
TO_DATE ((SELECT p_txt
FROM temp.pm
WHERE p_id_h = 'MONETARY'
AND p_id_d = 'LAST_DATE'
AND p_id_t = 'S'),
'DD-MON-YYYY'
AND SID NOT IN (
SELECT gl_sid
FROM s_wr.p_smst
WHERE p_gst.p_idc =
(SELECT p_txt
FROM temp.pm
WHERE p_id_h = 'MONETARY'
AND pm_id_d = 'MONETARY_ID'));
OPERATION OPTIONS OBJECT_NAME POSITION
SELECT STATEMENT 199600
FILTER 1
HASH JOIN RIGHT SEMI 1
TABLE ACCESS FULL PM 1
VIEW R_VIEW 2
UNION-ALL 1
TABLE ACCESS FULL IN_CUST_TEMP 1
TABLE ACCESS FULL RC_REG_WORK 2
HASH JOIN 3
VIEW V_SQ_1 1
HASH GROUP BY 1
TABLE ACCESS FULL TP_MAIN_WORK 1
TABLE ACCESS FULL TP_MAIN_WORK 2
TABLE ACCESS FULL IN_SS_RELOAD 4
TABLE ACCESS FULL CTF_AORD_WORK 5
TABLE ACCESS FULL MANXA_RELOAD 6
TABLE ACCESS FULL STX_FR_PURSE 7
TABLE ACCESS BY INDEX ROWID PM 2
INDEX RANGE SCAN K_PRM 1
TABLE ACCESS BY INDEX ROWID P_GST 2
INDEX RANGE SCAN ID1_P_GST 1
TABLE ACCESS BY INDEX ROWID PM 1
INDEX RANGE SCAN K_PM 1Thank youuser636482 wrote:
I have written a query. But It's taking around 15 minutes. Can you please check the query and Explain plan of the query and give me the solution for optimize the query.Since you're already on 10g, please use DBMS_XPLAN.DISPLAY to generate a more meaningful output of the EXPLAIN PLAN command.
Please read this HOW TO: Post a SQL statement tuning request - template posting that explains what you should provide if you have SQL statement tuning question and how to format it here so that the posted information is readable by others.
This accompanying blog post shows step-by-step instructions how to obtain that information.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Query tuning (Oracle 10g)
Hi
We are having one query that is having order by clause. If we run with order by then it takes 70-80 min to execute and without order by it takes 1-2 min.
We cann't remove order by because of business requirements.
Please suggest me any solution except index, hints (already there).
Thanks and regardsWhat is your database version? If you are using an automated PGA memory management then you might want to check your PGA_AGGREGATE_TARGET.
You can use V$PGA_TARGET_ADVICE to set up a proper PGA_AGGREGATE_TARGET.
Read more about PGA Memory management here
http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/memory.htm#i49320
It has a lot to do with Sorting Operations.
Thanks,
Karthick. -
LOV & Query in Forms 10g not working
Hi All,
I have a strange problem with custom forms that i am developing using Dev Suite 10g (10.1.2) for Oracle AS 10g (10.1.2.0.2).
When i test the form in DevSuite the LOVs in the form are working properly, but after i deploy the form on the server and use the default config the LOVs stop showing up.
The same happens with Execute Query. There is no error message displayed either.
Since the jiniitator was downloaded from the same server, so that cannot be the problem.
The version of java used is also the same, 1.4.2.
I have no idea why the forms are behaving like this on the server. Any help would be great.
Thanks in advance,
ArunI was able to get the trace file from the FRD.
Please see below for the trace file of the form.
trace.xml
- <FORMSTRACE>
<CollectionName>/u01/oracle/ias10g/bif/forms/trace/forms_23684.trc</CollectionName>
***TRACE STARTED BY EM***
- <Form>
<FormID>1</FormID>
<Name>TPA_HEADER(1)</Name>
</Form>
- <Form.START Name="TPA_HEADER">
<EventID>3</EventID>
<EventNum>64</EventNum>
<Timestamp>688001334</Timestamp>
- <Details>
<Name>TPA_HEADER</Name>
<FormName>TPA_HEADER(1)</FormName>
</Details>
</Form.START>
- <NETWORK.READ>
<EventID>4</EventID>
<EventNum>133</EventNum>
<Timestamp>688014994</Timestamp>
<EndEvent>7</EndEvent>
<Duration>0</Duration>
- <Details>
<Packets>1</Packets>
<Bytes>0</Bytes>
</Details>
</NETWORK.READ>
- <MENU_SELECT Name="DEFAULT.Query.eXecute">
<EventID>5</EventID>
<EventNum>33</EventNum>
<Timestamp>688014994</Timestamp>
- <Details>
<FormName>TPA_HEADER(1)</FormName>
<Type>DEFAULT</Type>
<Menu>Query</Menu>
<Item>eXecute</Item>
</Details>
</MENU_SELECT>
- <TRIGGER.START Name="TPA_HEADER(1).KEY-EXEQRY">
<EventID>6</EventID>
<EventNum>66</EventNum>
<Timestamp>688014994</Timestamp>
- <Details>
<Block>TPA_HEADER</Block>
<Item>(Null)</Item>
<Name>KEY-EXEQRY</Name>
<FormName>TPA_HEADER(1)</FormName>
</Details>
</TRIGGER.START>
- <NETWORK.WRITE>
<EventID>7</EventID>
<EventNum>133</EventNum>
<Timestamp>688014994</Timestamp>
<StartEvent>4</StartEvent>
<Duration>0</Duration>
- <Details>
<Packets>1</Packets>
<Bytes>0</Bytes>
</Details>
</NETWORK.WRITE>
- <NETWORK.READ>
<EventID>8</EventID>
<EventNum>133</EventNum>
<Timestamp>688019034</Timestamp>
<EndEvent>10</EndEvent>
<Duration>0</Duration>
- <Details>
<Packets>16</Packets>
<Bytes>0</Bytes>
</Details>
</NETWORK.READ>
- <MENU_SELECT Name="DEFAULT.Help.display Error">
<EventID>9</EventID>
<EventNum>33</EventNum>
<Timestamp>688019034</Timestamp>
- <Details>
<FormName>TPA_HEADER(1)</FormName>
<Type>DEFAULT</Type>
<Menu>Help</Menu>
<Item>display Error</Item>
</Details>
</MENU_SELECT>
- <NETWORK.WRITE>
<EventID>10</EventID>
<EventNum>133</EventNum>
<Timestamp>688019034</Timestamp>
<StartEvent>8</StartEvent>
<Duration>0</Duration>
- <Details>
<Packets>1</Packets>
<Bytes>0</Bytes>
</Details>
</NETWORK.WRITE>
</FORMSTRACE>
Message was edited by:
arunm
Maybe you are looking for
-
How to call a SQL function from an XSL expression
Hi In R12, in Payroll Deposit adivce/Check writer, We need to sort the earnings tag <AC_Earnings> in to two different categories as regular and other earnings. In the DB and form level of element defintiion we have a DFF which differentiates between
-
Attributes are not saved in CRM using APD
Hello experts, I have trouble recording the attributes marketing from BW to CRM. APD use to record data, the log of APD ends in green but when I go to transaction BP in CRM data are not. Anyone can help me, thanks! Enrique. Edited by: Enrique Busi on
-
Authorization check in CRM ISA
Dear All, I need some small help. We have SAP CRM ISA MSA 5.0 SP8. We need to create some roles for the end users who access the system via the CRM Webshop. But we are not able to trace what authorization a user requires or lack. Like when I give a r
-
Error message after suspend to RAM on ThinkPad X230i
Hi, I noticed there's alway an 'Unable to dock' error message after suspend to RAM: Arch kernel: ACPI: Low-level resume complete Arch kernel: PM: Restoring platform NVS memory Arch kernel: Enabling non-boot CPUs ... Arch kernel: smpbo
-
This error message recently started popping up periodically on web pages that seem to have graphics or photos. There have been recent Adobe updates, but I can't verify which ones and whether they are the issue. On the other hand a recent Firefox upda