Please Help Me !! Performance Yuning Problem
From: Russell Huntley <rhuntley_at_ix.netcom.com>
Date: 1996/03/31
Message-ID: <4jla53$q4n_at_cloner2.ix.netcom.com>#1/1
WHERE
A.NTWK_ACC_TYP IN ('0','1','2','3','4','5','6','7','8','9') AND
A.USOC IN ('ESX','PKQ','NNK','NSD','NSK','NLRX8','ESC','NLRXR', 'ESYBQ','RBE','OAPXX')
AND (
(SUBSTR(A.TEL_NO,1,3) = '515'
(SUBSTR(A.TEL_NO,1,3) = '520'
Date: 1996/03/31
Message-ID: <4jla53$q4n_at_cloner2.ix.netcom.com>#1/1
This is the first time I have posted anything to any newsgroup. I hope this is the appropriate place for this type of thing. If not, I appologize.
I am writing a query which is running much longer than I expect (need). I am hoping that somebody can spot a problem with the query or offer a suggestion as to how to tune it.
- This is a single table query.
- The table is appx 90,000,000 rows
- It is running on a 24 node SP2 machine.
- In order to help decifer the "sum(round((instr" selection I will attempt to put it here in english. The intent is to return a value of 1 from the round function if the value in the A.USOC field matches the quoted string. I have tested this and it works.
- This query runs for 12+ hours (in fact it has never finished). I guess it should run 1-2 hours.
- I am unable to modify the table in any way. No new columns, indexes, etc...
CREATE TABLE GET_COUNT
PCTFREE 0
PCTUSED 90
STORAGE (INITIAL 1M NEXT 1M PCTINCREASE 0)
TABLESPACE XXX
PARALLEL (DEGREE 2 INSTANCES 20)
UNRECOVERABLE
AS
SELECT /*+ FULL(A) */
A.ACCT_ID ,A.ACCT_SEQ_NO ,A.TEL_NO ,A.NTWK_ACC_EXTNSN ,SUM(ROUND((INSTR('ESX PKQ ',A.USOC,1,1)/6)+.4)) AAA ,SUM(ROUND((INSTR('NNK NSD ',A.USOC,1,1)/6)+.4)) BBB ,SUM(ROUND((INSTR('NSK NLRX8',A.USOC,1,1)/6)+.4)) CCC ,SUM(ROUND((INSTR('ESC NLRXR',A.USOC,1,1)/6)+.4)) DDD ,SUM(ROUND(INSTR('ESYBQ',A.USOC,1,1)*2)) EEE,SUM(ROUND(INSTR('RBE ',A.USOC,1,1)*2)) FFF ,SUM(ROUND(INSTR('OAPXX',A.USOC,1,1)*2)) GGG FROM CPROD10V A
WHERE
A.NTWK_ACC_TYP IN ('0','1','2','3','4','5','6','7','8','9') AND
A.USOC IN ('ESX','PKQ','NNK','NSD','NSK','NLRX8','ESC','NLRXR', 'ESYBQ','RBE','OAPXX')
AND (
(SUBSTR(A.TEL_NO,1,3) = '515'
AND SUBSTR(A.TEL_NO,4,3) IN ('233','296','847','292','732','843',
'435','424','228','458','324','454',
'456','232','421','423','923','379'))
OR (SUBSTR(A.TEL_NO,1,3) = '712' AND SUBSTR(A.TEL_NO,4,3) IN ('264','262')) OR
(SUBSTR(A.TEL_NO,1,3) = '520'
AND SUBSTR(A.TEL_NO,4,3) IN ('452','388','427','771','568','442',Received on Sun Mar 31 1996 - 00:00:00 CET
'348','425','638','287','636','472',
'289','364','785','378','384','761',
'457','645','485','689','398','288',
'776','394','632','204','478','683',
'282','723','466','778','533','428',
'635','639','445','424','775','284',
'637','567','634','772','366','286',
'281','426','646','684','459','421',
'474','648','625','476','458','432',
'455','456','836','538','868'))
OR (SUBSTR(A.TEL_NO,1,3) = '602' AND SUBSTR(A.TEL_NO,4,3) IN ('374','675','388','386','671')) OR (SUBSTR(A.TEL_NO,1,3) = '605' AND SUBSTR(A.TEL_NO,4,3) IN ('578','892','787','269','296','563',
'983','347','997','368','648','456',
'255','425','772','256','326','743',
'642','584','987')))
GROUP BY A.ACCT_ID, A.ACCT_SEQ_NO, A.TEL_NO, A.NTWK_ACC_EXTNSN;