Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How much data returned
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01118142
Message ID:
01118350
Vues:
19
>>>AFAIK, VFP doesn't use indexes to optimize GROUP BY so answer still the same, WS.
>>>
>>In other words, if I want to speed up the lenghty process I need to select all records to cursor first, then do group by on a resulting cursor, correct?
>
>No. In other words adding indexes cannot speed up GRPOUP BY.
>In VFP often spliting complex select into 2 sequentual selects makes it run faster but it's not always the case.

Here is the particular select that is running too slow :( I'm thinking of removing group by and running group by as the second step.
TEXT TO lcSQLStr NOSHOW TEXTMERGE PRETEXT 7
    SELECT COUNT(Trans.cTrans_pk) as iAccounts_Count, ;
           IIF(not IsNull(Trans_Employees_Queues.cCommission_Owner_UsGrLink_fk), ;
               Trans_Employees_Queues.cCommission_Owner_Usgrlink_fk, ;
               Trans_Employees_Queues.cUsGrLink_fk) as cUsGrlink_pk, ;
           SUM(Trans.yCurrent_balance_amount)  as yBalance ;
    FROM TRANS
    INNER JOIN Trans_employees_queues   ;
    ON Trans.cTrans_pk = Trans_employees_queues.cTrans_fk ;
    INNER JOIN Employee_queue_schedules ;
    ON Trans_employees_queues.cTrans_employees_queues_pk = ;
     Employee_queue_schedules.cTrans_employees_queues_fk ;
    WHERE <<m.lcFilter>> AND 
          IIF(not IsNull(Trans_Employees_Queues.cCommission_Owner_UsGrLink_fk), .T., ;
              (Trans_employees_queues.iTemporary_Assignment_Flag = 1    AND ;
               Trans_employees_queues.tStart_Date <= <<m.lcDateTime>>   AND ;
               Trans_employees_queues.tExpire_Date >= <<m.lcDateTime>>))
    GROUP BY 2
ENDTEXT
SET DELETED off
llReturn = RunSQL(m.lcSQLStr, m.tcAlias)
SET DELETED on
As I see, I even tried to play with SET DELETED hoping to optimize it...
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform