Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any way to speed this select?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01125229
Message ID:
01125232
Vues:
22
>>Hi everybody,
>>
>>This is the code in the VFP database stored procedure. It takes ~30+ sec. to execute on the Network database. Do you see ways to make it quicker?
>>
>>
>>select count(trans.cTrans_pk) as iAccounts_Count, ;
>>	step1.cUsGrLink_pk, ;
>>	sum(trans.yCurrent_balance_amount) as yBalance ;
>>	from trans ;
>>	INNER join ;
>>	(select TEQ.cTrans_fk, ;
>>	iif(not isnull(TEQ.cCommission_Owner_UsGrLink_fk), ;
>>	TEQ.cCommission_Owner_UsGrLink_fk, ;
>>	TEQ.cUsGrLink_fk) as cUsGrLink_pk from Employee_Queue_Schedules EQS ;
>>	INNER join Trans_Employees_Queues TEQ ;
>>	on TEQ.cTrans_Employees_Queues_pk = EQS.cTrans_Employees_Queues_fk ;
>>	where EQS.tScheduled_time <= m.ltTime  ;
>>	and TEQ.iActive_Flag = 1 ;
>>	and EQS.iActive_Flag = 1  and ;
>>	iif(not isnull(TEQ.cCommission_Owner_UsGrLink_fk), .t., ;
>>	(TEQ.iTemporary_Assignment_Flag = 1 and ;
>>	TEQ.tStart_Date <= m.ltTime and ;
>>	TEQ.tExpire_Date >= m.tdDate))) step1 ;
>>	on trans.cTrans_pk = step1.cTrans_fk ;
>>	where trans.cResolution_Codes_fk is null ;
>>	group by 2 into cursor (m.tcAlias) readwrite
>>
>>
>>Thanks a lot in advance.
>
>Use NVL() instead of IIF(NOT ISNULL()
>also use SYS(3054) to see optimization.

I'm thinking of trying to set the inner select as UNION again. The probabilty of temp owner is less than 1%. I would put select count(distinct(cTrans_pk)) at the top select.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform