Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal Report is taking time to fetch results Post Reply Post New Topic
Author Message
Anamika
Newbie
Newbie


Joined: 14 May 2009
Online Status: Offline
Posts: 6
Quote Anamika Replybullet Topic: Crystal Report is taking time to fetch results
    Posted: 18 May 2009 at 4:39am
Hello,
 
We have a query which is used as a command object in Crystal reports. This report is execited against IBM DB2 database. It is taking 40 min to getback the results. Here is the Query. Please suggest.
 
 
SELECT
A1.CARR_NUM ,  A1.CST_CTR_NUM ,A1.CLM_CLOSE_STS_CD ,   A1.CLM_RJCT_STS_CD ,A1.CLM_VOID_STS_CD ,  A1.PMT_MTCH_DT , A1.ASC_TRANS_TYP_CD ,  A1.DRUG_DESC ,               
A1.BATCH_NUM ,   T5.TPA_RJCT_CD ,  A1.DIV_NUM , A1.INVC_NUM ,  A1.SERVICE_DT ,  A1.ACTL_REFILL_NUM ,  A1.CLM_DSPSN_CD ,  A1.INVC_RSBMT_CD , A1.TP_TOTAL_DUE_AMT ,   
A1.INTL_BILG_MTHD_CD , A1.CARR_EOB_1_CD ,  T5.CARR_EOB_CD_DESC ,  A1.NTNL_DRUG_CD ,  A1.PTNT_FRST_NM ,  A1.PTNT_MDDL_INTL ,  A1.PTNT_LST_NM ,  A1.PTNT_BIRTH_DT ,
A1.CRDHLDR_ID_NUM   
FROM
 (SELECT DISTINCT
    T1.CARR_NUM ,  T1.CST_CTR_NUM ,  T1.CLM_CLOSE_STS_CD ,  T1.CLM_RJCT_STS_CD ,   T1.CLM_VOID_STS_CD ,  T3.PMT_MTCH_DT ,   
    T3.ASC_TRANS_TYP_CD ,  T2.DRUG_DESC ,  T4.BATCH_NUM , T1.DIV_NUM ,  T1.INVC_NUM ,  T1 . SERVICE_DT ,  T1.ACTL_REFILL_NUM ,                                         
    T1.CLM_DSPSN_CD ,  T1.INVC_RSBMT_CD ,T1.TP_TOTAL_DUE_AMT ,  T1.INTL_BILG_MTHD_CD ,T3.CARR_EOB_1_CD ,T1.NTNL_DRUG_CD ,  T2.PTNT_FRST_NM ,         T2.PTNT_MDDL_INTL , T2.PTNT_LST_NM ,  T2.PTNT_BIRTH_DT ,  T2.CRDHLDR_ID_NUM 
   FROM  
                PDRD2LO.VINVC_CLM T1                             
               , PDRD2LO.VPMNT_DTL T3                             
               , PDRD2LO.VINVC_CLM_2 T2                           
               , PDRD2LO.VINVC_ITM_PHARM  T4                     
                    WHERE  
  T1.CLM_CLOSE_STS_CD ='OP'                     
              AND  T1.CLM_RJCT_STS_CD ='RJ'                       
              AND  T1.CLM_VOID_STS_CD ='NV'                       
              AND  T3.ASC_TRANS_TYP_CD ='40'                      
              AND  T1.CARR_NUM = T3.CARR_NUM                      
           AND   T1.CST_CTR_NUM = T3.CST_CTR_NUM                  
           AND   T1.DIV_NUM = T3.DIV_NUM                          
           AND   T1.INVC_NUM = T3.INVC_NUM                        
           AND   T1.SERVICE_DT = T3.SERVICE_DT                    
           AND   T1.CLM_CTRL_NUM = T3.CLM_CTRL_NUM                
           AND   T1.ACTL_REFILL_NUM = T3.ACTL_REFILL_NUM          
           AND   T1.INVC_ITM_NUM = T3.INVC_ITM_NUM                
           AND   T1.REFILL_TRANS_NUM = T3.REFILL_TRANS_NUM        
           AND   T1.CARR_NUM = T2.CARR_NUM                        
           AND   T1.CST_CTR_NUM = T2.CST_CTR_NUM                  
           AND   T1.DIV_NUM = T2.DIV_NUM                          
           AND   T1.INVC_NUM = T2.INVC_NUM                        
           AND   T1.SERVICE_DT = T2.SERVICE_DT                  
           AND   T1.ACTL_REFILL_NUM = T2.ACTL_REFILL_NUM        
           AND   T1.CLM_CTRL_NUM = T2.CLM_CTRL_NUM              
           AND   T1.INVC_ITM_NUM = T2.INVC_ITM_NUM              
           AND   T1.REFILL_TRANS_NUM = T2.REFILL_TRANS_NUM      
           AND   T1.INVC_CTRL_NUM = T4.INVC_CTRL_NUM) A1        
LEFT OUTER JOIN  PDRD2LO.VCARR_EOB T5                
            ON    A1.CARR_EOB_1_CD = T5.CARR_EOB_CD             
            AND   A1.CARR_NUM = T5.CARR_NUM                     
            AND   A1.DIV_NUM = T5.DIV_NUM        
 
Thanks!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 18 May 2009 at 6:55am
try making a stored proc, would be 1 suggestion, another would be doing inner joins on the tables instead of joining in the where clause (which is slower and older syntax)  perhaps make a view for table t5.
 
and while I can understand the command statement in crystal, I have only used it to return values for parameters...if you are spending 40 minutes to get options for the report, it would seem to me that you should trying something else.  If this is you main data retrieval...make a stored proc and get the data that way.  The command object, I don't believe, was created for that purpose and so is probably not optimized.
 
how long does it take for this query run inside of the database software on the server?  If it takes 40 minutes there...then there is really nothing that is going to improve it, Crystal can only get the data as fast as the server is giving it.  If this only takes a moment on the server, then there are issues, but I would try moving it to the server as it has the software that is optimized to deal the data...ie the database interface.
 
HTH
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.000 seconds.