Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speed in results
Message
De
12/08/2008 13:01:31
Sonny Tabano
Trams Printwork, Inc.
Mabalacat, Philippines
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Speed in results
Divers
Thread ID:
01338372
Message ID:
01338372
Vues:
63
Hi, what do you think on which of the following samples below would produce faster result? Or there's no difference at all?

Total number of records in table is 500,000
There are 10 records whose cv_no is = "00800".
record numbers for the ten (10) cv_no="00800" is from recno(440,000 to 449,000 )

lcDocNumb="00800"
Sample No. 1

Select CVdtl
set order to CVnoacct
=Seek(lcDocNumb)
IF FOUND()
   DO while CV_no=lcDocNumb .and. .not. EOF()
          IIF .not. DELETED()
                lnSLDBAmt  = lnSLDBAmt + SLDebit
                lnSLCRAmt  = lnSLCRAmt + SLCredit
                lnGLDBAmt  = lnGLDBAmt + GLDebit
               lnGLCRAmt  = lnGLCRAmt + GLCredit
         Endif
         skip
    enddo
ENDIF


Sample No. 2

SELECT SUM(A.SLDebit) as lnSLDBAmt, SUM(SLCredit) as lnSLCRAmt, SUM(GLCredit) as lnGLCRAmt, SUM(GLDebit) as lnGLDBAmt;
FROM CVdtl A WHERE A.CV_no=lcDocNumb .and. .not. DELETED() INTO CURSOR Temp1 GROUP BY A.CV_no


Sample No. 3

Select CVdtl
set order to CVnoacct
SCAN FOR CV_no=lcDocNumb 
        IF .not. DELETED()
            lnSLDBAmt  = lnSLDBAmt + SLDebit
            lnSLCRAmt  = lnSLCRAmt + SLCredit
            lnGLDBAmt  = lnGLDBAmt + GLDebit
            lnGLCRAmt  = lnGLCRAmt + GLCredit
      Endif
ENDSCAN
Thanks

Sonny
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform