Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
242 views
in Technique[技术] by (71.8m points)

sql - Is there any alter way to increase the execution speed. Currently the below query taking 6 seconds to execute

SELECT * 
FROM
    (SELECT  
         PER_CUR.DATEASSTRINGFORCLASS(PER_DATE_FROM,'GB') AS PERDATE,
         PER_NO,
         rangeutil.f_setpcdrangeperiod('M', PER_CUR.DATEASSTRINGFORCLASS(PER_DATE_FROM, 'GB')) AS PERIOD
     FROM   
         PER_W  
     WHERE  
         PERT_CODE = 'YM2' 
         AND PER_NO >= RANGEUTIL.ADDNUMPERIOD('YM2', RANGEUTIL.DATEPERIOD('YM2'), -4) 
         AND per_date_from < '02-JUN-21'
             
     UNION

     SELECT  
         PER_CUR.DATEASSTRINGFORCLASS(PER_DATE_FROM,'GB') AS PERDATE, PER_NO,
         rangeutil.f_setpcdrangeperiod('M', PER_CUR.DATEASSTRINGFORCLASS(PER_DATE_FROM,'GB')) AS PERIOD
     FROM 
         PER_W  
     WHERE  
         PERT_CODE = 'YM' 
         AND per_date_from > '01-JUN-21' 
         AND PER_NO >= RANGEUTIL.ADDNUMPERIOD('YM', RANGEUTIL.DATEPERIOD('YM'), -4))
WHERE
    per_no >= rangeutil.f_defaultPcdRangePeriod('M')
ORDER BY 
    2;
question from:https://stackoverflow.com/questions/65847898/is-there-any-alter-way-to-increase-the-execution-speed-currently-the-below-quer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...