Need help optimizing a merge query
Hi all, I hope someone can give me some assistance with this. I don't have a lot of experience with Oracle, so any help would be greatly appreciated. I have a MERGE query that I need to optimize as much as possible. I will give as much information as I can in this post.
Here is the actual query:
MERGE INTO quick_scene_lookup qsl
USING (
SELECT scene.*,
CASE
WHEN scene.data_category LIKE 'NOM%'
THEN 'NOM'
WHEN scene.data_category LIKE 'ENG%'
THEN 'ENG'
WHEN scene.data_category LIKE 'VAL%'
THEN 'VAL'
ELSE scene.data_category
END scn_data_category,
CASE
WHEN scene.data_category_original LIKE 'NOM%'
THEN 'NOM'
WHEN scene.data_category_original LIKE 'ENG%'
THEN 'ENG'
WHEN scene.data_category_original LIKE 'VAL%'
THEN 'VAL'
ELSE scene.data_category_original
END data_category_orig,
CASE
WHEN scene.full_partial_scene LIKE 'F%'
THEN 'F'
WHEN scene.full_partial_scene LIKE 'P%'
THEN 'P'
ELSE scene.full_partial_scene
END scn_full_partial_scene,
CASE
WHEN scene.date_entered_lam IS NULL
OR scene.deleted = 1
THEN 0
ELSE 1
END in_lam,
CASE
WHEN scene.in_uis LIKE 'Y%'
THEN 1
ELSE 0
END scn_in_uis,
CASE
WHEN scene.data_category LIKE 'NOM%'
AND scene.full_partial_scene LIKE 'F%'
THEN 1
ELSE 0
END monitor,
CASE
WHEN scene.date_updated_lam IS NOT NULL
AND scene.satellite_sensor_key = 8 -- L7 ETM
THEN
CASE
WHEN intv.match_in_tolerance = 'Y'
OR intv.match_in_tolerance = 'N'
THEN 0
ELSE 1
END
ELSE 0
END lam_orphan,
sat.satellite,
sat.sensor_id,
station.station_id,
intv.match_in_tolerance,
wrs.wrs_path,
wrs.wrs_row,
TO_DATE(SUBSTR(scene.scene_start_time, 0, 17),
'YYYY:DDD:HH24:MI:SS') scn_scene_start_time,
CASE
WHEN qsl.date_downlinked IS NOT NULL
AND scene.date_standing_request IS NOT NULL
THEN (qsl.date_downlinked - scene.date_standing_request) * 1440
ELSE NULL
END dd_downlinked_marketable
FROM all_scenes scene
INNER JOIN lu_satellite sat
ON (scene.satellite_sensor_key = sat.satellite_sensor_key)
INNER JOIN ground_stations station
ON (scene.station_key = station.station_key)
INNER JOIN all_intervals intv
ON (scene.landsat_interval_id = intv.landsat_interval_id)
INNER JOIN worldwide_reference_system wrs
ON (scene.wrs_key = wrs.wrs_key)
LEFT OUTER JOIN quick_scene_lookup qsl
ON (scene.landsat_scene_id = qsl.landsat_scene_id)
WHERE (scene.job_sequence_key IN (
SELECT job_sequence_key FROM jobs_subscript_execution_fact
WHERE job_key = 109)
OR qsl.landsat_scene_id IS NULL)
AND scene.scene_version = (
SELECT MAX(scene_version) FROM all_scenes
WHERE SUBSTR(landsat_scene_id, 1, 19) =
SUBSTR(scene.landsat_scene_id, 1, 19))) scenes
ON (qsl.landsat_scene_id = scenes.landsat_scene_id
OR (qsl.satellite = scenes.satellite
AND qsl.station_id = scenes.station_id
AND qsl.wrs_path = scenes.wrs_path
AND qsl.wrs_row = scenes.wrs_row
AND TRUNC(qsl.date_acquired) = TRUNC(scenes.date_acquired)
AND SUBSTR(qsl.sensor_id, 1, 3) = SUBSTR(scenes.sensor_id, 1, 3)))
WHEN MATCHED THEN
UPDATE SET
data_category = scenes.scn_data_category,
data_category_original = scenes.data_category_orig,
date_acquired = scenes.date_acquired,
date_entered = scenes.date_entered,
date_standing_request = scenes.date_standing_request,
date_updated = scenes.date_updated,
dd_downlinked_marketable = scenes.dd_downlinked_marketable,
full_partial_scene = scenes.scn_full_partial_scene,
in_lam = scenes.in_lam,
in_uis = scenes.scn_in_uis,
lam_orphan = scenes.lam_orphan,
monitor = scenes.monitor,
satellite = scenes.satellite,
scene_start_time_date = scenes.scn_scene_start_time,
sensor_id = scenes.sensor_id,
station_id = scenes.station_id,
wrs_path = scenes.wrs_path,
wrs_row = scenes.wrs_row,
cloud_cover = scenes.cloud_cover
WHEN NOT MATCHED THEN INSERT(
qsl_scene_id,
data_category,
data_category_original,
date_acquired,
date_entered,
date_standing_request,
date_updated,
full_partial_scene,
in_lam,
in_moc,
in_uis,
lam_orphan,
landsat_interval_id,
landsat_scene_id,
monitor,
satellite,
scene_start_time_date,
sensor_id,
station_id,
wrs_path,
wrs_row,
cloud_cover)
VALUES(
seq_qsl_scene_id.nextval,
scenes.scn_data_category,
scenes.data_category_orig,
scenes.date_acquired,
scenes.date_entered,
scenes.date_standing_request,
scenes.date_updated,
scenes.scn_full_partial_scene,
scenes.in_lam,
0, -- in_moc will always be 0 for archive inserts
scenes.scn_in_uis,
scenes.lam_orphan,
scenes.landsat_interval_id,
scenes.landsat_scene_id,
scenes.monitor,
scenes.satellite,
scenes.scn_scene_start_time,
scenes.sensor_id,
scenes.station_id,
scenes.wrs_path,
scenes.wrs_row,
scenes.cloud_cover)
LOG ERRORS INTO ingest_errors('Intervals error')
REJECT LIMIT 500;All of the columns used in the joins have indexes. Also, all columns referenced in the WHERE clause also have indexes. I have function based indexes on the two columns that are using a function.
The cost from the explain plan is at 14 million, and this query takes far too long to run. I can post the explain plan if anybody wants it. We are running Oracle 10.2g, and are a data warehouse. Any help I can get on this would be greatly appreciated, I and my dba's are unable to come up with any more ideas. Thanks in advance.
Well, just in case this might help someone else out, I was able to resolve my issue with the code. It turns out that in the secondary condition of the ON clause for the merge, I had columns that were also being updated. By removing the those columns from the UPDATE clause. It dropped my cost down to 456,000. I was further able to reduce the cost of the query by removing the primary conditional completely. I am a C++ programmer and was counting on a short-circuit OR to speed up the process. Anyway, my cost is now down to 215,000, and all is good here.
Thanks.
Similar Messages
-
Need help in insert statment query
Hi,
I have a table T1 with values like
col1
1
2
3
4
I need to write insert statment for t2 as
insert into t2(col1,col2) values ('AA',select col1 from t1);
The output of T2 should be
col1 col2
AA 1
AA 2
AA 3
AA 4
Any help in modifying the query.
AshishWhat is wrong with this?
INSERT INTO id_own_dw.id_t_dw_org_dq_tgt
(cost_center_cod_vc_old,
cost_center_cod_vc_new
SELECT '3016052',<<<_-- this you can replace with your varibale in pl/sql block
cost_center_cod_vc
FROM id_own_dw.id_t_dw_msl_org_cctr2mkdiv
WHERE busi_unit_cod_vc = '3016496' -
Need help in refining the query
Hello Experts,
Need your help in refining the query further more.
table structure
Mskey Col A Col B
1 empno [20141127-20151128]1234
1 empno [20151201-99991231]232544
1 salutation [20141127-99991231]Mrs
1 salutation [20151127-99991231]Mr
2 empno [20141127-20151128]1234
2 empno [20151201-99991231]232544
2 salutation [20141127-99991231]Mrs
2 salutation [20151127-99991231]Mr
My requirement is to find the list of overlapping records based on the dates
user details may be varying from time to time as new data would be pushed through HR systems to identity store via an interface.
The job is getting failed whenever there is any overlapping with dates. So we proactively decided to schedule a job in this regards which runs weekly and would let us know for which and all the users there is overlapping dates are there, so that we can send the list to HR team for pushing new data.
Overlapping Issue Example:
The users employee id for an year it is 1234 and later he moved to another department and his employee id got changed and it became 2345 remaining all details are same. So the HR systems send the data for this user as empno - [20141127-20151128]1234 and empno - [20151201-99991231]232544
it means from 20141127 to 20151128 his employee no is 1234 and from 20151201 to 99991231 his employee would be 2345.
This is a correct case and the tool would accept this data.
the below cases are invald
Case 1: 1 salutation [20141127-99991231]Mrs 1 salutation [20151127-99991231]Mr
Case 2: 2 salutation [20141127-99991231]Mrs 2 salutation [20141127-99991231]Mr
So we wanted to find these overlapping records from tables.
My Query:
I am able to successfully write query for the case 2 type but unable to write for case1.
select id,colA
count(left(ColB,CHARINDEX(']',ColB))) as 'Count'
from tblA with (nolock)
where id in (Select distinct id from tblb with (nolock))
group by id, cola,left(ColB,CHARINDEX(']',ColB))
having count(left(ColB,CHARINDEX(']',ColB)))>1Finally got the required answer with the below query
WITH Cte AS
SELECT ID,ColA,ColB,ROW_NUMBER() OVER(ORDER BY (SELECT 1)) AS RN,
CAST(SUBSTRING(ColB,2,CHARINDEX('-',ColB)-2) AS DATE) AS StartDT,
CAST(SUBSTRING(ColB,CHARINDEX('-',ColB)+1,8) AS DATE) AS EndDT FROM TblA
SELECT c1.ID, c1.ColA,c1.ColB
FROM Cte c1 JOIN Cte c2
ON c1.RN != c2.RN
AND c1.ID=c2.ID
AND c1.ColA=c2.ColA
AND (c1.StartDT BETWEEN c2.StartDT AND c2.EndDT OR c2.StartDT BETWEEN c1.StartDT AND c1.EndDT ) -
Experts,
Plz help in tuning this query
SELECT
DECODE(WSH_DELIVERY_DETAILS.LOT_NUMBER,'5I27164/1U',1, TO_NUMBER(SUBSTR(WSH_DELIVERY_DETAILS.LOT_NUMBER, (LENGTH(WSH_DELIVERY_DETAILS.LOT_NUMBER) - INSTR(REVERSE(WSH_DELIVERY_DETAILS.LOT_NUMBER),'/') + 2), (INSTR(REVERSE(WSH_DELIVERY_DETAILS.LOT_NUMBER),'/')-1))) ) AS NO_OF_PLATES,
P_FORM.DESCRIPTION FORMOFPRODUCT,
HZ_PARTIES.PARTY_NAME CUSTOMER, HZ_CUST_ACCOUNTS.ACCOUNT_NUMBER ACCT_NUM,
NVL(OE_ORDER_HEADERS_ALL.CUST_PO_NUMBER,'XXXX') CUST_PO,
INITCAP(HZ_PARTIES.ADDRESS1) BILL_ADD1,
INITCAP(HZ_PARTIES.ADDRESS2) BILL_ADD2,
INITCAP(HZ_PARTIES.ADDRESS3) BILL_ADD3,
INITCAP(HZ_PARTIES.ADDRESS4) BILL_ADD4,
INITCAP(HZ_PARTIES.CITY) BILL_CITY,
INITCAP(HZ_PARTIES.STATE) BILL_STATE,
HZ_PARTIES.POSTAL_CODE BILL_PC,
INITCAP(HZ_LOCATIONS.ADDRESS1) SHIP_ADD1,
INITCAP(HZ_LOCATIONS.ADDRESS2) SHIP_ADD2,
INITCAP(HZ_LOCATIONS.ADDRESS3) SHIP_ADD3,
INITCAP(HZ_LOCATIONS.ADDRESS4) SHIP_ADD4,
INITCAP(HZ_LOCATIONS.CITY) SHIP_CITY,
INITCAP(HZ_LOCATIONS.STATE) SHIP_STATE,
HZ_LOCATIONS.POSTAL_CODE SHIP_PC,
OE_TRANSACTION_TYPES_TL.NAME CATEGORY ,
OE_ORDER_HEADERS_ALL.ORDER_NUMBER,
OE_ORDER_HEADERS_ALL.SOURCE_DOCUMENT_ID,
OE_ORDER_HEADERS_ALL.HEADER_ID,
OE_ORDER_HEADERS_ALL.FREIGHT_TERMS_CODE,
/* to_char(oe_order_headers_all.ORDERED_DATE,'DD-MON-RR HH24:MI:SS') ORDER_DATE,*/
to_char(sysdate,'DD/MM/RRRR HH24:MI:SS') ORDERED_DATE,
ROWNUM,
OE_ORDER_LINES_ALL.INVENTORY_ITEM_ID,
OE_ORDER_LINES_ALL.ORDERED_ITEM,
OE_ORDER_LINES_ALL.ORDERED_QUANTITY,
WSH_DELIVERY_DETAILS.SHIPPED_QUANTITY+DECODE(WSH_DELIVERY_DETAILS.DELIVERY_DETAIL_ID,129881,.22,0) AS SHIPPED_QUANTITY1, (WSH_DELIVERY_DETAILS.SHIPPED_QUANTITY+DECODE(WSH_DELIVERY_DETAILS.DELIVERY_DETAIL_ID,129881,.22,0))*OE_ORDER_LINES_ALL.UNIT_SELLING_PRICE AS LINE_PRICE,
OE_ORDER_LINES_ALL.UNIT_SELLING_PRICE,
JA_IN_RG_I.FOR_HOME_USE_PAY_ED_VAL,
---- SUBSTR(JA_IN_RG_I.EXCISE_INVOICE_NUMBER,1,2)|| SUBSTR(JA_IN_RG_I.EXCISE_INVOICE_NUMBER,4,8) INVOICE_NO,
JA_IN_RG_I.EXCISE_INVOICE_NUMBER INVOICE_NO,
to_char(JA_IN_RG_I.CREATION_DATE,'DD/MM/RRRR') INVOICE_DATE1,
to_char(JA_IN_RG_I.EXCISE_INVOICE_DATE,'DD-MON-RR HH24:MI:SS') INV_DATE,
to_char(JA_IN_RG_I.CREATION_DATE,'DD/MM/RRRR HH24:MI:SS') INVOICE_DATE,
JA_IN_RG_I.EXCISE_DUTY_RATE,
JA_IN_RG_I.EXCISE_DUTY_AMOUNT,
WSH_DELIVERY_DETAILS.LOT_NUMBER,
WSH_TRIPS.CARRIER_ID CARRIER_ID,
WSH_TRIPS.VEHICLE_NUM_PREFIX,
WSH_TRIPS.SEAL_CODE,
WSH_TRIPS.ROUTING_INSTRUCTIONS,
WSH_TRIPS.OPERATOR, WSH_NEW_DELIVERIES. DELIVERY_ID,
WSH_NEW_DELIVERIES. ADDITIONAL_SHIPMENT_INFO TRUCK_NO,
WSH_TRIPS.MODE_OF_TRANSPORT VEHICLE_TYPE,
WSH_TRIPS.ATTRIBUTE6||' '|| WSH_TRIPS.ATTRIBUTE7||' '|| WSH_TRIPS.ATTRIBUTE8 REMARKS,
WSH_TRIPS.ATTRIBUTE1 LR_NO, WSH_TRIPS.ATTRIBUTE7,
WSH_TRIPS.ATTRIBUTE2 LR_DATE,
DECODE(WSH_TRIPS.ATTRIBUTE3, '', '', 'ARE NO '||WSH_TRIPS.ATTRIBUTE3) AS ARE_NO,
DECODE(WSH_TRIPS.ATTRIBUTE6, '', '', WSH_TRIPS.ATTRIBUTE6) AS REMARK1,
DECODE(WSH_TRIPS.ATTRIBUTE4, '', '', 'R.P. NO. ' ||WSH_TRIPS.ATTRIBUTE4) AS PERMIT,
DECODE(WSH_TRIPS.ATTRIBUTE5, '', '', 'Export Under '||WSH_TRIPS.ATTRIBUTE5) AS EXPORT_UNDER,
DECODE(WSH_NEW_DELIVERIES.PORT_OF_DISCHARGE,'','', 'Seal No : '||WSH_NEW_DELIVERIES.PORT_OF_DISCHARGE) AS SEAL_NO,
DECODE(WSH_NEW_DELIVERIES.DESCRIPTION, '', '', 'Container No : ' ||WSH_NEW_DELIVERIES.DESCRIPTION) AS CONTAINER_NO,
MTL_SYSTEM_ITEMS_B.ATTRIBUTE4 AS EXCISE_TARIFF_NO,
--MTL_SYSTEM_ITEMS_B.DESCRIPTION,
HZ_CUST_ACCOUNTS.ACCOUNT_NUMBER,
JSW_LOT_PACKSLIP.PACKSLIP_NO PACKSLIP,
PR_TYPE.DESCRIPTION ||' ,'||
P_FORM.DESCRIPTION || ' ,'||
PR_GRADE.DESCRIPTION ||' ,'||
PR_QTY.DESCRIPTION || ' ,'||
DECODE(SUBSTR(PR_STL.DESCRIPTION,1,3),'Not','', PR_STL.DESCRIPTION) DESCRIPTION ,
HZ_CUST_ACCT_SITES_ALL.ATTRIBUTE7 S_CST_NO,
HZ_CUST_ACCT_SITES_ALL.ATTRIBUTE6 S_LST_NO,
HZ_CUST_ACCT_SITES_ALL.ATTRIBUTE5 S_ECC_NO,
A.ATTRIBUTE7 B_CST_NO,
A.ATTRIBUTE6 B_LST_NO,
INTERFACECRM.JSW_MES_COMMON_TNGL_T.JSW_ADDMINUTES(WSH_TRIPS.VEHICLE_NUM_PREFIX) POSTFIX_NUM
FROM -- jsw_vat_slno,
MTL_PARAMETERS,
HZ_PARTIES,
HZ_CUST_ACCOUNTS,
HZ_LOCATIONS,
HZ_PARTY_SITES,
HZ_CUST_ACCT_SITES_ALL,
HZ_CUST_SITE_USES_ALL,
HZ_CUST_ACCT_SITES_ALL A,
HZ_CUST_SITE_USES_ALL B,
OE_TRANSACTION_TYPES_TL,
JA_IN_RG_I,
WSH_DELIVERY_DETAILS,
OE_ORDER_LINES_ALL,
OE_ORDER_HEADERS_ALL,
WSH_DELIVERY_ASSIGNMENTS,
WSH_NEW_DELIVERIES,
WSH_DELIVERY_LEGS,
WSH_TRIP_STOPS,
WSH_TRIPS,
MTL_SYSTEM_ITEMS_B,
JSW_LOT_PACKSLIP,
IC_TRAN_PND,
JSW_ITM_SEARCH_PRD_TYP PR_TYPE,
JSW_ITM_SEARCH_PRD_FRM P_FORM ,
JSW_ITM_SEARCH_PRD_GRD PR_GRADE,
JSW_ITM_SEARCH_QUALITY_LEVEL PR_QTY,
JSW_ITEM_SEARCH_SLITTING PR_STL
WHERE /* jsw_vat_slno.excise_invoice_number=ja_in_rg_i.excise_invoice_number and jsw_vat_slno.organization_id = ja_in_rg_i.organization_id */
HZ_PARTIES.PARTY_ID = HZ_CUST_ACCOUNTS.PARTY_ID
AND HZ_CUST_ACCOUNTS.CUST_ACCOUNT_ID = OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID
AND OE_ORDER_HEADERS_ALL.SHIP_TO_ORG_ID = HZ_CUST_SITE_USES_ALL.SITE_USE_ID
AND HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID = HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID
AND OE_ORDER_HEADERS_ALL.INVOICE_TO_ORG_ID = B.SITE_USE_ID
AND B.CUST_ACCT_SITE_ID = A.CUST_ACCT_SITE_ID
AND HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID = HZ_PARTY_SITES.PARTY_SITE_ID
AND HZ_PARTY_SITES.LOCATION_ID = HZ_LOCATIONS.LOCATION_ID
AND OE_ORDER_LINES_ALL.SHIP_FROM_ORG_ID = MTL_PARAMETERS.ORGANIZATION_ID
AND OE_ORDER_HEADERS_ALL.ORDER_TYPE_ID = OE_TRANSACTION_TYPES_TL.TRANSACTION_TYPE_ID
and upper(oe_transaction_types_tl.description) not like '%SUP%'
AND OE_ORDER_HEADERS_ALL.HEADER_ID = WSH_DELIVERY_DETAILS.SOURCE_HEADER_ID
AND OE_ORDER_HEADERS_ALL.HEADER_ID = OE_ORDER_LINES_ALL.HEADER_ID
AND OE_ORDER_LINES_ALL.LINE_ID = WSH_DELIVERY_DETAILS.SOURCE_LINE_ID
AND TO_CHAR(WSH_DELIVERY_DETAILS.DELIVERY_DETAIL_ID ) = JA_IN_RG_I.REF_DOC_ID
AND WSH_DELIVERY_DETAILS.DELIVERY_DETAIL_ID = WSH_DELIVERY_ASSIGNMENTS.DELIVERY_DETAIL_ID
AND WSH_DELIVERY_ASSIGNMENTS.DELIVERY_ID = WSH_NEW_DELIVERIES.DELIVERY_ID
AND WSH_NEW_DELIVERIES.DELIVERY_ID = WSH_DELIVERY_LEGS.DELIVERY_ID
AND WSH_DELIVERY_LEGS.PICK_UP_STOP_ID = WSH_TRIP_STOPS.STOP_ID
AND WSH_TRIP_STOPS.TRIP_ID = WSH_TRIPS.TRIP_ID
/* Input parameter can be either Invoice number or Delivery Id */
AND (WSH_NEW_DELIVERIES.DELIVERY_ID = :DEL_ID OR JA_IN_RG_I.EXCISE_INVOICE_NUMBER = :INVOICE_NUMBER)
AND NVL(WSH_DELIVERY_DETAILS.SHIPPED_QUANTITY,0) <>0
AND MTL_SYSTEM_ITEMS_B.ORGANIZATION_ID = WSH_DELIVERY_DETAILS.ORGANIZATION_ID
AND MTL_SYSTEM_ITEMS_B.INVENTORY_ITEM_ID = WSH_DELIVERY_DETAILS.INVENTORY_ITEM_ID
AND IC_TRAN_PND.LINE_DETAIL_ID = WSH_DELIVERY_DETAILS.DELIVERY_DETAIL_ID
AND JSW_LOT_PACKSLIP.LOT_ID = IC_TRAN_PND.LOT_ID(+)
AND JSW_LOT_PACKSLIP.DELIVERY_ID = WSH_NEW_DELIVERIES.DELIVERY_ID(+)
AND IC_TRAN_PND.LINE_ID = OE_ORDER_LINES_ALL.LINE_ID
AND IC_TRAN_PND.DELETE_MARK = 0
AND IC_TRAN_PND.COMPLETED_IND = 1
AND IC_TRAN_PND.STAGED_IND = 1
AND P_FORM.CODE(+) = substr(OE_ORDER_LINES_ALL.ORDERED_ITEM,3,2)
AND PR_TYPE.CODE = substr(OE_ORDER_LINES_ALL.ORDERED_ITEM,1,2)
AND PR_TYPE.CODE = P_FORM.PRD_TYPE_CODE
AND P_FORM.CODE = substr(OE_ORDER_LINES_ALL.ORDERED_ITEM,3,2)
AND P_FORM.CODE = PR_GRADE.PRD_FRM_CODE
AND PR_GRADE.CODE = substr(OE_ORDER_LINES_ALL.ORDERED_ITEM,5,2)
AND PR_GRADE.CODE = PR_QTY.PRD_GRD_CODE
AND PR_QTY.CODE = substr(OE_ORDER_LINES_ALL.ORDERED_ITEM,7,2)
AND PR_STL.PROD_CODE = PR_TYPE.CODE
AND PR_STL.QUALITY_LEVEL_CODE = PR_QTY.CODE
AND PR_STL.CODE = substr(OE_ORDER_LINES_ALL.ORDERED_ITEM,9,2)
AND rownum=1
thanks,
baskar.lHere is the explain plan
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1 | 920 | 12628 |
| 1 | COUNT STOPKEY | | | | |
| 2 | NESTED LOOPS | | 1 | 920 | 12628 |
| 3 | NESTED LOOPS | | 1 | 728 | 12627 |
| 4 | NESTED LOOPS | | 1 | 718 | 12626 |
| 5 | NESTED LOOPS | | 1 | 684 | 12625 |
| 6 | NESTED LOOPS | | 1 | 674 | 12624 |
| 7 | NESTED LOOPS | | 1 | 665 | 12623 |
| 8 | NESTED LOOPS | | 1 | 655 | 12622 |
| 9 | NESTED LOOPS | | 1 | 532 | 12621 |
| 10 | NESTED LOOPS | | 1 | 522 | 12620 |
| 11 | FILTER | | | | |
| 12 | NESTED LOOPS OUTER | | | | |
| 13 | NESTED LOOPS | | 1 | 494 | 12617 |
| 14 | NESTED LOOPS | | 1 | 477 | 12614 |
| 15 | NESTED LOOPS | | 1 | 467 | 12611 |
| 16 | NESTED LOOPS | | 1 | 382 | 12610 |
| 17 | NESTED LOOPS | | 1 | 366 | 12609 |
| 18 | NESTED LOOPS | | 1 | 321 | 12606 |
| 19 | FILTER | | | | |
| 20 | HASH JOIN OUTER | | | | |
| 21 | TABLE ACCESS BY INDEX ROWID| IC_TRAN_PND | 1 | 22 | 3 |
| 22 | NESTED LOOPS | | 1 | 292 | 12601 |
| 23 | HASH JOIN | | 1 | 270 | 12598 |
| 24 | NESTED LOOPS | | 4011 | 908K| 6272 |
| 25 | HASH JOIN | | 4012 | 893K| 6272 |
| 26 | TABLE ACCESS FULL | JSW_ITM_SEARCH_PRD_GRD | 33 | 759 | 2 |
| 27 | HASH JOIN | | 20547 | 4113K| 6269 |
| 28 | TABLE ACCESS FULL | JSW_ITM_SEARCH_QUALITY_LEVEL | 54 | 1296 | 2 |
| 29 | HASH JOIN | | 24352 | 4304K| 6266 |
| 30 | TABLE ACCESS FULL | JSW_ITM_SEARCH_PRD_TYP | 7 | 154 | 2 |
| 31 | HASH JOIN | | 170K| 25M| 6260 |
| 32 | TABLE ACCESS FULL | JSW_ITEM_SEARCH_SLITTING | 73 | 1971 | 2 |
| 33 | HASH JOIN | | 44367 | 5719K| 6257 |
| 34 | HASH JOIN | | 4469 | 410K| 367 |
| 35 | TABLE ACCESS FULL| OE_TRANSACTION_TYPES_TL | 18 | 846 | 4 |
| 36 | TABLE ACCESS FULL| OE_ORDER_HEADERS_ALL | 38240 | 1755K| 362 |
| 37 | TABLE ACCESS FULL | OE_ORDER_LINES_ALL | 379K| 13M| 5761 |
| 38 | INDEX UNIQUE SCAN | MTL_PARAMETERS_U1 | 1 | 4 | |
| 39 | TABLE ACCESS FULL | WSH_DELIVERY_DETAILS | 579K| 21M| 5926 |
| 40 | INDEX RANGE SCAN | IC_TRAN_PND_N1 | 2 | | 2 |
| 41 | TABLE ACCESS FULL | JSW_ITM_SEARCH_PRD_FRM | 16 | 272 | 2 |
| 42 | TABLE ACCESS BY INDEX ROWID | MTL_SYSTEM_ITEMS_B | 1 | 12 | 2 |
| 43 | INDEX UNIQUE SCAN | MTL_SYSTEM_ITEMS_B_U1 | 1 | | 1 |
| 44 | TABLE ACCESS BY INDEX ROWID | JA_IN_RG_I | 1 | 45 | 3 |
| 45 | INDEX RANGE SCAN | JA_IN_RG_I_N3 | 1 | | 2 |
| 46 | TABLE ACCESS BY INDEX ROWID | HZ_CUST_ACCOUNTS | 1 | 16 | 1 |
| 47 | INDEX UNIQUE SCAN | HZ_CUST_ACCOUNTS_U1 | 1 | | |
| 48 | TABLE ACCESS BY INDEX ROWID | HZ_PARTIES | 1 | 85 | 1 |
| 49 | INDEX UNIQUE SCAN | HZ_PARTIES_U1 | 1 | | |
| 50 | TABLE ACCESS BY INDEX ROWID | WSH_DELIVERY_ASSIGNMENTS | 1 | 10 | 3 |
| 51 | INDEX RANGE SCAN | WSH_DELIVERY_ASSIGNMENTS_N3 | 1 | | 2 |
| 52 | TABLE ACCESS BY INDEX ROWID | JSW_LOT_PACKSLIP | 1 | 17 | 3 |
| 53 | INDEX RANGE SCAN | JSW_LOT_PACKSLIP_N1 | 1 | | 2 |
| 54 | TABLE ACCESS BY INDEX ROWID | WSH_NEW_DELIVERIES | 1 | 18 | 1 |
| 55 | INDEX UNIQUE SCAN | WSH_NEW_DELIVERIES_U1 | 1 | | |
| 56 | TABLE ACCESS BY INDEX ROWID | WSH_DELIVERY_LEGS | 1 | 10 | 2 |
| 57 | INDEX RANGE SCAN | WSH_DELIVERY_LEGS_N1 | 1 | | 1 |
| 58 | TABLE ACCESS BY INDEX ROWID | WSH_TRIP_STOPS | 1 | 10 | 1 |
| 59 | INDEX UNIQUE SCAN | WSH_TRIP_STOPS_U1 | 1 | | |
| 60 | TABLE ACCESS BY INDEX ROWID | WSH_TRIPS | 1 | 123 | 1 |
| 61 | INDEX UNIQUE SCAN | WSH_TRIPS_U1 | 1 | | |
| 62 | TABLE ACCESS BY INDEX ROWID | HZ_CUST_SITE_USES_ALL | 1 | 10 | 1 |
| 63 | INDEX UNIQUE SCAN | HZ_CUST_SITE_USES_U1 | 1 | | |
| 64 | TABLE ACCESS BY INDEX ROWID | HZ_CUST_ACCT_SITES_ALL | 1 | 9 | 1 |
| 65 | INDEX UNIQUE SCAN | HZ_CUST_ACCT_SITES_U1 | 1 | | |
| 66 | TABLE ACCESS BY INDEX ROWID | HZ_CUST_SITE_USES_ALL | 1 | 10 | 1 |
| 67 | INDEX UNIQUE SCAN | HZ_CUST_SITE_USES_U1 | 1 | | |
| 68 | TABLE ACCESS BY INDEX ROWID | HZ_CUST_ACCT_SITES_ALL | 1 | 34 | 1 |
| 69 | INDEX UNIQUE SCAN | HZ_CUST_ACCT_SITES_U1 | 1 | | |
| 70 | TABLE ACCESS BY INDEX ROWID | HZ_PARTY_SITES | 1 | 10 | 1 |
| 71 | INDEX UNIQUE SCAN | HZ_PARTY_SITES_U1 | 1 | | |
| 72 | TABLE ACCESS BY INDEX ROWID | HZ_LOCATIONS | 1 | 192 | 1 |
| 73 | INDEX UNIQUE SCAN | HZ_LOCATIONS_U1 | 1 | | |
we need to tune this query to reduce it time of execution as our users are very much affected in running requests.
thanks,
baskar.l -
I need help with a SELECT query - help!
Hello, I need help with a select statement.
I have a table with 2 fields as shown below
Name | Type
John | 1
John | 2
John | 3
Paul | 1
Paul | 2
Paul | 3
Mark | 1
Mark | 2
I need a query that returns everything where the name has type 1 or 2 but not type 3. So in the example above the qery should bring back all the "Mark" records.
Thanks,
IanOr, if the types are sequential from 1 upwards you could simply do:-
SQL> create table t as
2 select 'John' as name, 1 as type from dual union
3 select 'John',2 from dual union
4 select 'John',3 from dual union
5 select 'Paul',1 from dual union
6 select 'Paul',2 from dual union
7 select 'Paul',3 from dual union
8 select 'Paul',4 from dual union
9 select 'Mark',1 from dual union
10 select 'Mark',2 from dual;
Table created.
SQL> select name
2 from t
3 group by name
4 having count(*) <= 2;
NAME
Mark
SQL>Or another alternative if they aren't sequential:
SQL> ed
Wrote file afiedt.buf
1 select name from (
2 select name, max(type) t
3 from t
4 group by name
5 )
6* where t < 3
SQL> /
NAME
Mark
SQL>Message was edited by:
blushadow -
Need Help! Ad Hoc Query in HR Tables
Dear Friends,
I need to create a adhoc query for the following tables.
PA*
HRP1000
HRP1001
But I could select only PNPCE LDB... I do not know how to define one and get the information out from PA* and HRP1000 and HRP1001 info types....
Please help.
Thanks,
JoyHi Joydip,
Go to transaction SQ02, from the Edit menu go to "Change Infotype Selection" step. Go to the end of the tree structure. From "Infotypes of related objects" select the respective organizational object (e.g. org unit, position) & respective relationship. When you click on these items & confirm your selection, they all apeear in the infotype tree structure at the left part of the SQ02 screen. You can use them just like other info types of PNPCE logical DB.
Regards,
Dilek -
Need help with writing a query with dynamic FROM clause
Hi Folks,
I need help with an query that should generate the "FROM" clause dynamically.
My main query is as follows
select DT_SKEY, count(*)
from *???*
where DT_SKEY between 20110601 and 20110719
group by DT_SKEY
having count(*) = 0
order by 1; The "from" clause of the above query should be generated as below
select 'Schema_Name'||'.'||TABLE_NAME
from dba_tables
where OWNER = 'Schema_Name'Simply sticking the later query in the first query does not work.
Any pointers will be appreciated.
Thanks
rogers42Hi,
rogers42 wrote:
Hi Folks,
I need help with an query that should generate the "FROM" clause dynamically.
My main query is as follows
select DT_SKEY, count(*)
from *???*
where DT_SKEY between 20110601 and 20110719
group by DT_SKEY
having count(*) = 0
order by 1; The "from" clause of the above query should be generated as below
select 'Schema_Name'||'.'||TABLE_NAME
from dba_tables
where OWNER = 'Schema_Name'
Remember that anything inside quotes is case-sensitive. Is the owner really "Schema_Name" with a capital S and a capital N, and 8 lower-case letters?
Simply sticking the later query in the first query does not work.Right; the table name must be given when you compile the query. It's not an expression that you can generate in the query itself.
Any pointers will be appreciated.In SQL*Plus, you can do something like the query bleow.
Say you want to count the rows in scott.emp, but you're not certain that the name is emp; it could be emp_2011 or emp_august, or anything else that starts with e. (And the name could change every day, so you can't just look it up now and hard-code it in a query that you want to run in the future.)
Typically, how dynamic SQL works is that some code (such as a preliminary query) gets some of the information you need to write the query first, and you use that information in a SQL statement that is compiled and run after that. For example:
-- Preliminary Query:
COLUMN my_table_name_col NEW_VALUE my_table_name
SELECT table_name AS my_table_name_col
FROM all_tables
WHERE owner = 'SCOTT'
AND table_name LIKE 'E%';
-- Main Query:
SELECT COUNT (*) AS cnt
FROM scott.&my_table_name
;This assumes that the preliminary query will find exactly one row; that is, it assumes that SCOTT has exactly one table whose name starts with E. Could you have 0 tables in the schema, or more than 1? If so, what results would you want? Give a concrete example, preferably suing commonly available tables (like those in the SCOTT schema) so that the poepl who want to help you can re-create the problem and test their ideas.
Edited by: Frank Kulash on Aug 11, 2011 2:30 PM -
Need help on the below query.
Hi All,
I've a query given below..
SELECT W.WONUM,
W.STATUS,
WS.CHANGEDATE,
EH.OLD_RATE
FROM
WORKORDER W,
WOSTATUS WS,
ESTIMATE_HEADER@GQMFOF EH
WHERE WS.CHANGEDATE BETWEEN '01-Oct-2009' AND '1-Nov-2009'
AND W.WONUM = WS.WONUM
AND EH.OLD_RATE = 'N'
AND WS.WOSTATUS = 'CLOSE';
I would like to get All the data which status =closed in the month of Oct for Old rate,
So for this i am writing the query above. But not getting the o/p.
It is giving me that " Table/View doesn't exist.
There 2 schemas MAXIMO,GQMMGR..
DBlinks are GQMFOF,MAXFOFNC..
Can anyone help me while writing the above query...
Regards,
gr.A question was asked in your other thread. But the problem was you dint care to give an answer.
Dont open duplicate post.
I need help on the below problem.. -
What is the "Live" page and need help in data merge
Hello,
Im very new to indesign so bare with me. Im trying to data merge (Need to create a merge template?) and from what I understand is that I need it to be on the "Live" page. Someone on the forum suggested this.....
There are two ways to set up the merge template. You can put your placholders on the master page or on the live page. If the placehlders are on the master page, only the frame(s) with the placeholders, along with any other grouped objects, will be duplicated. On the live page, ID will try to duplictate EVERYTHING on the page, so you must be very careful about the setup and sizing of objects.
I would like to be on the LIVE page...how do I do this? I got everything else sorted but cannot get multiple records for the life of me to come up.
Thanks in adavance for your helpThanks for all your help, Peter. I will do the step and repeat method like you said. I dont know why I cant get this camera for the images to work but I did what you said with Word paint after capturing the page using the keyboard. Unfortunately I cant copy and paste the indesign screen to this page.
Thanks again for your patience and good help.
With kind Regards,
John
P.S Im sure you will see more questions as I make my way through indesign. LOL -
Hi Friends,
I am trying to load Employees and their Assignments using APIs.
I have various columns in my staging table like Last Name, First Name, etc., but I need help in writing query in the cursor especially for columns Emp Number and Supervisor Number.
I have data as below
Emp_Number Supervisor_Number
GE0002 GE0064
GE0064 EG0009
EG0009 EG0001
100009 EG0001
EG0001 TU0001
Cursor I write will process the data in the same order as above, but here the problem is...
When it processes first row, it checks for supervisor GE0064 which do not exist and so it errors out.
Similarly for second row, it checks for supervisor EG0009 which again do not exist and so it errors out.
So in order to prevent this, the cursor should process the rows as below
Emp_Number Supervisor_Number
EG0001 TU0001
EG0009 EG0001
GE0064 EG0009
GE0002 GE0064
100009 EG0001
By this way, Supervisor should be defined first as an employee and then it can be used as a supervisor for other employees
is there a way that I can get the output as above(second set of data), when the table has records randomly as above(first set of data)
Appreciate your help!
Thanks,
SrikanthSrikanth wrote:
... but the number of records returned by above query are lot more than number of records in the table.
Why did the number go up?
It's something only you can find out
Maybe some Emp have several Supervisor(s) like
with
t as
(select 'GE0002' Emp,'GE0064' Supervisor from dual union all
select 'GE0064','EG0009' from dual union all
select 'EG0009','EG0001' from dual union all
select 'GE0064','100009' from dual union all
select '100009','EG0001' from dual union all
select 'EG0001','TU0001' from dual
select Emp,Supervisor,lpad('_',3 * (level - 1),'_')||Emp indent
from (select Emp,Supervisor
from t
union all
select supervisor,null
from t tt
where not exists(select null
from t
where emp = tt.supervisor
start with Supervisor is null
connect by prior Emp = Supervisor
EMP
SUPERVISOR
INDENT
TU0001
TU0001
EG0001
TU0001
___EG0001
100009
EG0001
______100009
GE0064
100009
_________GE0064
GE0002
GE0064
____________GE0002
EG0009
EG0001
______EG0009
GE0064
EG0009
_________GE0064
GE0002
GE0064
____________GE0002
Regards
Etbin -
Need help tuning slow running query
Need help tuning below two Oracle queries:
Query #1:
======================
SELECT "WORK_ORDER_FACT_ALL_YESTERDAY"."WORK_ORDER_HISTORY_ID",
"WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_NUMBER",
"ACCOUNT_DIM"."ACCOUNT_NUMBER", "ACCOUNT_DIM"."ACCOUNT_WS_DISC_DATE"
FROM "CDWD"."WORK_ORDER_FACT_ALL_YESTERDAY" "WORK_ORDER_FACT_ALL_YESTERDAY",
"CDWD"."ACCOUNT_DIM" "ACCOUNT_DIM"
WHERE (SUBSTR ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_FIRST_NAME", 1, 1) =
SUBSTR ("ACCOUNT_DIM"."ACCOUNT_FIRST_NAME", 1, 1)
AND (SUBSTR ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_LAST_NAME", 1, 4) =
SUBSTR ("ACCOUNT_DIM"."ACCOUNT_LAST_NAME", 1, 4)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_DL_NUMBER" =
"ACCOUNT_DIM"."ACCOUNT_DL_NUMBER"
AND "WORK_ORDER_FACT_ALL_YESTERDAY"."WO_TYPE_CODE" IN ('25', '27')
AND ("ACCOUNT_DIM"."REVENUE_TYPE_ID" = 1)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."TRANSFER_COUNT" = 0)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."WINBACK_ADD_COUNT" = 0)
AND ("ACCOUNT_DIM"."ACCOUNT_WS_ENTRY_DATE" <
(TO_DATE ('2006.05.02', 'yyyy.mm.dd') - 11
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."IS_DERIVED" = 0)
AND ("ACCOUNT_DIM"."EXPIRATION_DATE" IS NULL)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACT_ACCOUNT_TYPE_CD" <> '50');
Query #2
==================
UPDATE work_order_fact_all_yesterday g
SET returns_count = 1
WHERE EXISTS (SELECT 1
FROM (SELECT a.phone_dim_key AS transactional_phone_dim_key,
b.mdn_number AS transactional_mdn_number,
b.account_number AS transactional_account_number
FROM work_order_fact_all_yesterday a INNER JOIN phone_dim b ON a.phone_dim_key = b.phone_dim_key
WHERE a.gross_deactivations_count = 1) e
INNER JOIN (SELECT c.phone_dim_key AS historical_phone_dim_key,
d.mdn_number AS historical_mdn_number,
d.account_number AS historical_account_number
FROM (SELECT phone_dim_key
FROM work_order_activity_fact
WHERE gross_adds_count = 1
AND report_date >= :b1 - 66
AND NVL (is_derived, 0 ) = 0
UNION
SELECT phone_dim_key
FROM work_order_fact_all_yesterday
WHERE gross_adds_count = 1
AND is_derived = 0) c
INNER JOIN phone_dim d ON c.phone_dim_key = d.phone_dim_key ) f
ON e.transactional_mdn_number = f.historical_mdn_number
AND e.transactional_account_number = f.historical_account_number
WHERE e.transactional_phone_dim_key = g.phone_dim_key)
AND g.gross_deactivations_count = 1
AND g.account_revenue_type_id = 1;
I ran the DBMS_SQLTUNE on it for 10g and did not get any advice. How can I tune the above queries? Thanks!Tune the SQL? Looking at the join criteria of SUBSTR("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_FIRST_NAME", 1, 1) = SUBSTR ("ACCOUNT_DIM"."ACCOUNT_FIRST_NAME", 1, 1) and other substrings, it seems to me that you have basic flaws in your relation design.
Column must be atomic values. Having to extract a sub-set value from a column to create the intelligence needed to join to another table - that is just plain wrong in relation design. Never mind the performance impact and overheads it causes in the database. -
[Athlon64] Noob needs help optimizing new system
Sorry to post yet another thread, but I've been lurking for the past few days and I only get bits and pieces of what I need. I'm pretty clueless about this stuff as it's my first home-built system
See my sig for system info...
I'm needing help with bios settings. The pertinent stuff (I think - hopefully I got it all down):
CELL MENU
CPU Clock speed: 2200
DDR Memory Freq: 100.0 MHz
High performance mode: Manual
Cool n quiet: Disable
HT Freq: 800 MHz
Dynamic overclocking: Disable
Adjust CPU Ratio: Auto
AGP Freq: By Default
HT Voltage: Auto
Mem voltage: Auto
CPU voltage: Auto
AGP Voltage: Auto
Spread sectrum: Disable
DRAM
DRAM Clock Mode: Manual
Mem clock value: DDR200
CAS Latency: SPD
Burst Length: 8 Beat
Bank Interleaving: Auto
Active to CMD (Trcd): SPD
Active to precharge (Tras): SPD
Precharge to active (Tvp): SPD
DRAM IT Timing: Disable
ADVANCED CHIPSET FEATURES
AGP Mode: Auto (this is "greyed out")
AGP Fast write: Enabled
AGP Aperture size: 128
VLink 8X supported: Enabled
My questions mainly concern memory. I bought all this stuff at the Tiger Direct outlet store in Naperville, Illinois. I had intended to buy the K8T Neo-FSR (754 pin), but they were supposedly out of the 754 pin 3400+, and this board/CPU combo had a $100 rebate. Yeah, it's one of those deals with the odd 939 pin 3400+ that everyone has been talking about.
In any case, I already had the Corsair CMX512-3200C2PT picked out, as Corsair said it was compatible with the board. I wasn't aware of the MSI compitibility chart until I came here later that night. I STILL can't find that chart off of the MSI web site.
Anyway, I got it all hooked up and got the standard 4 red LEDs. Not knowing what to do, I took it back to Tiger Direct and the tech played around with it until he stuck an el-cheapo stick (Corsair VS512MB400) in there and it worked. But it only works in slot 2. So here I am.
I started to run memtest86, but it took too long to run and I aborted it for now. For what it's worth, it said the RAM CAS value is 2.5-2-2-5. I don't know what the hell that means, but I know it's important.
My questions:
1. I assume I need manually to set my memory clock value to DDR400?
2. Now that I can get the thing to post, is there any chance I could get the "good" Corsair memory to work by setting the correct latency/CAS values? Again, I don't know what I'm talking about, so forgive my ignorance. What I'm wondering is if I can set everything to what Corsair recommends while I have the cheap memory in there and then replace it with the good stuff?
3. With this board, am I better off with double-sided or single-sided sticks? As I said, I went into the store intending to buy the Neo 754-pin board, but they were out of the Athlon 3400+ in 754 and only had the 939 pin.
4. Anything else in my bios settings that stand out and need to be addressed? I want to make sure everything is optimized.
EDIT: I almost forgot: My CPU temp is runing around 42-49 degrees. Am I in the danger zone? I just bought a generic cooler for now and intend to get a Thermalright XP-120, but I can't find it locally, so it will have to wait.
AND FINALLY...
I don't know if this is related to anything above, but I have been having a hell of a time getting the 6600GT to run DirectX9+ games. The latest drivers for Windows 98SE was 66.94. Yes, XP will be installed soon, but for now... It was failing on dxdiag test for Direct3d 9 and also the third DirectDraw test. I was about to give up and take it back when I discovered that a new beta driver came out today (71.84). I installed it and it passed all of the dxdiag tests. I thought I was in hawg-heaven, but when I run Call of Duty (the only DX9 game I have besides HL2), it slows to an absolute clawl. The level starts out somewhat normal at first, but quickly slows down to the point that performance can only be measured in seconds per frame! All of the patches 1.5 and 1.51 for UO have been installed, but that shouldn't make a bit of difference.
If I don't get my CoD fix soon I'm gonna reinstall that Geforce3.
Thanks much and sorry again for such a long post.Thanks everyone for the recent replies, but I started this thread almost a month ago (March 3rd), and much has changed since then.
New PSU (see sig).
Replaced the PNY Geforce6600GT with a eVGA 6800
Added another stick of the Corsair Value Select 512 RAM. I didn't even bother trying to get the "primo" CMX stick to work. I just returned it.
Went from Windows 98SE to XP Home.
The PSU did nothing for me at all, but I suppose it's better to have some headroom in the amperage.
The biggest performance booster was the additional 512MB of RAM. It wouldn't have done me any good in 98SE, but I was shocked at how much it helps XP. Quitting a game is almost instant now, where before it would take a good two minutes or so for XP to recover itself.
As for games running slow, the 6800 fixed it right up. CoD absolutely screams now, as does everything else I've thrown at it (HL2, Doom 3, Far Cry). I think the 6600GT was just bad or there is a serious driver problem with the 6600GT's. Went from 3DMark03 score of around 5000 (when it didn't crash) to above 9000 now. And this was all before adding the additional RAM.
Oh yeah, I bought a 74GB Raptor. No RAID for now though. So far I'm not real impressed with the performance. I'm running off of the VIA controller, since my board doesn't have the Promise controller. I don't see much improvement in loading times as compared to the 40GB 7200rpm Maxtor I have running on IDE1. The only time it beats the pants off the Maxtor is defragging. But there's only so much entertainment value in that. The Sandra "file system benchmark" gave me 57 MB/s, which seems pathetic, but I've read some posts here where others are getting an identical rate.
And I'm not too happy to discover, too late, that my overclocking capabilities are severely limited while using SATA.
I do have one more question for now:
When I installed the second 512MB stick, I originally had both sticks in slot 1 and 2. I ran Sandra's memory bandwidth benchmark and got a much lower score than with the single stick (around 3500 MB/s). WHen I had the sticks in 1 and 3, it jumped up to close to 6000 MB/s. Why is that? Just curious. -
Need help in writing the query
The initial data is as follows:
ID PARENT_ID
=============
1 NULL
2 NULL
3 2
4 6
5 3
6 7
7 4
8 NULL
but output is as follows in such way that Parent_Id should be displayed in ID place
ID PARENT_ID
=============
1 NULL
2 NULL
3 2
8 NULL
6 8
4 6
5 3
7 4
Can any one help how resolve this query?
Thanks in advanceYour output is inconsistent with initial data :) But
select * from t start with parent_id is null connect by parent_id = prior id; -
Need help in the following query
Hi ,
I have the following query to pull out data for a particular timeperiod( campaign)
select
da.acct_nr,smas.mrkt_id,smas.fld_sls_cmpgn_perd_id,smas.acct_key,smas.upln_acct_key,smas.awrd_sls_amt,smas.fld_net_sls_amt
,smas.stf_ind,da1.acct_nr,
smas.fld_sls_cmpgn_perd_id,smas.acct_key,smas.upln_acct_key,smas.awrd_sls_amt,smas.fld_net_sls_amt
,smas.stf_ind,da1.acct_nr,prev.*
From cdw.sum_mrkt_acct_sls smas
join codi.dim_acct da
on (smas.mrkt_id = da.mrkt_id and smas.acct_key = da.acct_key)
join codi.dim_acct da1
on (smas.mrkt_id = da1.mrkt_id and smas.UPLN_acct_key = da1.ACCT_KEY)
where smas.acct_key in
select dwnln_acct_key from codi.dim_ldrshp_genlgy
where mrkt_id = 66 and fld_sls_cmpgn_perd_id = 20100304
and root_upln_acct_key = (select acct_key from codi.dim_acct where acct_nr = '0032622' and mrkt_id = 66)
and
smas.mrkt_id = 66
and smas.fld_sls_cmpgn_perd_id = 20100304
and smas.sls_org_key <> -100
order by 1
So this query will pull out data for campaign 20100304
No i want to modify the query to pull out data for 3 such campaigns.
for a smas.acct_key
so data will
smas.acct_key all the data for 1st campaign , all the data for 2nd campaign. all the data for 3rd campaign
Could you please help in modifying this query.
ThanksHow about this ??
select da.acct_nr,
smas.mrkt_id,
smas.fld_sls_cmpgn_perd_id,
smas.acct_key,
smas.upln_acct_key,
smas.awrd_sls_amt,
smas.fld_net_sls_amt,
smas.stf_ind,
da1.acct_nr,
smas.fld_sls_cmpgn_perd_id,
smas.acct_key,
smas.upln_acct_key,
smas.awrd_sls_amt,
smas.fld_net_sls_amt,
smas.stf_ind,
da1.acct_nr,
prev.*
From cdw.sum_mrkt_acct_sls smas
join codi.dim_acct da on (smas.mrkt_id = da.mrkt_id and
smas.acct_key = da.acct_key)
join codi.dim_acct da1 on (smas.mrkt_id = da1.mrkt_id and
smas.UPLN_acct_key = da1.ACCT_KEY)
where smas.acct_key in (select dwnln_acct_key
from codi.dim_ldrshp_genlgy
where mrkt_id = 66
and fld_sls_cmpgn_perd_id in( 20100304,20100305,20100306)
and root_upln_acct_key =
(select acct_key
from codi.dim_acct
where acct_nr = '0032622'
and mrkt_id = 66))
and smas.mrkt_id = 66
and smas.fld_sls_cmpgn_perd_id in( 20100304,20100305,20100306)
and smas.sls_org_key - 100
order by 1 -
Hi team,
Please help me on below query,
I have table like given below
Tran_Id tran_date amount. Actorid
1. 10-apr-15. 100. 1
2. 11-apr-15. 100. 1
3. 11-apr-15. 900. 1
4. 12-apr-15. 100. 1
5. 13-apr-15. 350. 1
6. 14-apr-15. 400. 1
Now please find the query,
I want all the actor ids whos tran amount
>1500 and the date when the tran amount
Has breached
Ex:
Actor-id. Breached-date. Total
1. 13-apr-15. 1900
How can I write a query for above requirement?
Regards,
RajendraYour solution (same as Saubhik's) is incorrect. Look at source data - multiple transactions can occur same day. Therefore, your qury will return wrong results if breached amount is 1000:
with trans as (
select 1 tran_Id, to_date('10-apr-15', 'dd-mon-yy') tran_date, 100 amount, 1 actorid from dual union all
select 2, to_date('11-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
select 3, to_date('11-apr-15', 'dd-mon-yy'), 900, 1 from dual union all
select 4, to_date('12-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
select 5, to_date('13-apr-15', 'dd-mon-yy'), 350, 1 from dual union all
select 6, to_date('14-apr-15', 'dd-mon-yy'), 400, 1 from dual union all
select 7, to_date('12-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
select 8, to_date('13-apr-15', 'dd-mon-yy'), 1200, 2 from dual union all
select 9, to_date('14-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
select 10, to_date('15-apr-15', 'dd-mon-yy'), 300, 2 from dual
trans_running_tot as (
select tran_id, tran_date,
sum(amount) over (partition by actorid order by tran_date) tot_amt, actorid
from trans
trans_ranked as (
select actorid,tran_id, tran_date,
rank() over (partition by actorid order by tot_amt) rk
from trans_running_tot
where tot_amt > 1000
select * from trans_ranked where rk=1
ACTORID TRAN_ID TRAN_DATE RK
1 2 11-APR-15 1 -- here total amount was only 200
1 3 11-APR-15 1
2 8 13-APR-15 1
SQL>
As you can see, 2 rows were returned for actor 1. Why? Default for analytic ORDER BY is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW. Therefore, all rows with same transation_date will fall into same window:
SQL> with trans as (
2 select 1 tran_Id, to_date('10-apr-15', 'dd-mon-yy') tran_date, 100 amount, 1 actorid from dual union all
3 select 2, to_date('11-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
4 select 3, to_date('11-apr-15', 'dd-mon-yy'), 900, 1 from dual union all
5 select 4, to_date('12-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
6 select 5, to_date('13-apr-15', 'dd-mon-yy'), 350, 1 from dual union all
7 select 6, to_date('14-apr-15', 'dd-mon-yy'), 400, 1 from dual union all
8 select 7, to_date('12-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
9 select 8, to_date('13-apr-15', 'dd-mon-yy'), 1200, 2 from dual union all
10 select 9, to_date('14-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
11 select 10, to_date('15-apr-15', 'dd-mon-yy'), 300, 2 from dual
12 )
13 select tran_id, tran_date,
14 sum(amount) over (partition by actorid order by tran_date) tot_amt, actorid
15 from trans
16 /
TRAN_ID TRAN_DATE TOT_AMT ACTORID
1 10-APR-15 100 1
2 11-APR-15 1100 1
3 11-APR-15 1100 1
4 12-APR-15 1200 1
5 13-APR-15 1550 1
6 14-APR-15 1950 1
7 12-APR-15 300 2
8 13-APR-15 1500 2
9 14-APR-15 1800 2
10 15-APR-15 2100 2
10 rows selected.
SQL>
So correct solution is to ORDER BY transation id. Also, just in case if amount can be 0, we should add tranaction id when ordering by sum:
with trans as (
select 1 tran_Id, to_date('10-apr-15', 'dd-mon-yy') tran_date, 100 amount, 1 actorid from dual union all
select 2, to_date('11-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
select 3, to_date('11-apr-15', 'dd-mon-yy'), 900, 1 from dual union all
select 4, to_date('12-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
select 5, to_date('13-apr-15', 'dd-mon-yy'), 350, 1 from dual union all
select 6, to_date('14-apr-15', 'dd-mon-yy'), 400, 1 from dual union all
select 7, to_date('12-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
select 8, to_date('13-apr-15', 'dd-mon-yy'), 1200, 2 from dual union all
select 9, to_date('14-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
select 10, to_date('15-apr-15', 'dd-mon-yy'), 300, 2 from dual
trans_running_tot as (
select tran_id, tran_date,
sum(amount) over (partition by actorid order by tran_id) tot_amt, actorid
from trans
trans_ranked as (
select actorid,tran_id, tran_date,
rank() over (partition by actorid order by tot_amt,tran_id) rk
from trans_running_tot
where tot_amt > 1000
select * from trans_ranked where rk=1
ACTORID TRAN_ID TRAN_DATE RK
1 3 11-APR-15 1
2 8 13-APR-15 1
SQL>
SY.
Maybe you are looking for
-
How can I get a cheap captioning and Voice Over services?
Hey, Causes seek the right information out using this repository and put it to use to create proteins that are new - proteins that make the buildings of the cell up, work the biochemical responses within the cell, and so are occasionally created for
-
Possible to change appearance in iCal, particularly the To Do Items?
Is it possible to change the appearance in iCal? I'm speaking about mostly the background? (I know you can change the "calendar" colors, but I'm looking for something else.) 1. For example, it is extremely difficult, almost impossible for me to deter
-
Airport Express Bigpond USB modem
I just bought the airport express to stream music. I set up the network and it worked great. However when I went to connect to the internet I had lost the connection, I have telstra's Next G modem connected directly to my laptop via USB. I then went
-
Twitter: Can't create an account in control panel
Twitter: I can login to the Twitter website in Safari without problems but can't create an account in the Mail... control panel: Name or password wrong. No, they are correct! They work in Safari! What's wrong?
-
I created an applet in eclipse. It works fine. It had 3 classes. 1 class was the applet. The other 2 were classes that the applet used. I put them all in the same directory and when I uploaded it on the web. It shows up all white. Im new to this appl