Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any way to speed this up
Message
 
 
À
25/01/2005 13:41:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
00980402
Message ID:
00980475
Vues:
44
>The first join/where should narrow down the search maximally
>
>It may help to draw an entity (table) diagram with the relations. That helps to navigate
>
>I bet you can get it well below 1 sec

The code bellow now takes 0.609 sec. for 85 records. I may take out the other view as well.
*---------------------- Location Section ------------------------
*   Library: 	Aquicksearchbiz.vcx
*   Class: 		Quicksearchobject
*   Method: 	Createfinalresult()
*----------------------- Usage Section --------------------------
*)  Description:
*)

*   Scope:      Public
*   Parameters:
*$  Usage:
*$
*   Returns:
*--------------------- Maintenance Section ----------------------
*   Change Log:
*       CREATED 	01/24/2005 - NN
*		MODIFIED
*----------------------------------------------------------------
LOCAL lnReccount, loSelect, cStatus, cUserID, lnSeconds
lnSeconds = SECONDS()
SET TALK OFF
SET NOTIFY OFF

STORE "" TO cStatus, cUserID

IF VARTYPE(m.plStop) <> "L"
	LOCAL plStop
	plStop = .F.
ENDIF

SELECT v_QuickSearch.*, ;
  Employee_queue_schedules.cemployee_queue_schedules_pk, Users.cuserid ;
 FROM v_QuickSearch ;
    INNER JOIN mmVisCollect!Trans_employees_queues ;
    ON v_QuickSearch.cTrans_PK = Trans_employees_queues.ctrans_fk ;     
    INNER JOIN mmviscollect!usgrlink ;
   ON  Trans_employees_queues.ccommission_owner_usgrlink_fk = Usgrlink.cusgrlink_pk ;
    INNER JOIN mmviscollect!employee_queue_schedules ;
   ON  Trans_employees_queues.ctrans_employees_queues_pk = Employee_queue_schedules.ctrans_employees_queues_fk ;
    INNER JOIN mmviscollect!users ;
   ON  Users.iid = Usgrlink.iuserid;
 WHERE Trans_employees_queues.iactive_flag =  1 ;
 	   AND  Employee_queue_schedules.iactive_flag =  1 ;
 	   INTO CURSOR cTempResult

SELECT cTempResult

WITH THIS
	*loSelect = .SelectAlias() && selects v_QuickSearch

	SCAN WHILE NOT m.plStop

** Let's do by VFP commands to avoid overhead

*!*				vp_cTrans_FK = cTrans_Pk
*!*				REQUERY("v_Commissioned_Owner")

*!*			.cTrans_FK = v_QuickSearch.cTrans_PK

*!*			.REQUERY(.T.,"v_Commissioned_Owner")
*!*			cUserID = v_Commissioned_Owner.cUserID

* cStatus field is either status description or resolution description if the resolution code is not empty
		IF EMPTY(v_QuickSearch.cResolution_Codes_Fk) && OR ISNULL(v_QuickSearch.cResolution_Codes_Fk)
			.cViscodes_pk = cTempResult.cStatus_Codes_FK
*				vp_cViscodes_pk = cStatus_Codes_FK
		ELSE
			.cViscodes_pk = cTempResult.cResolution_Codes_Fk
*				vp_cViscodes_pk = cResolution_Codes_Fk
		ENDIF

		.REQUERY(.T.,"v_VisCodes_Lookup")
*            REQUERY("v_VisCodes_Lookup")
		cStatus = v_VisCodes_Lookup.cCode_Description

		SCATTER MEMVAR

		SELECT c_QuickSearch

		INSERT INTO c_QuickSearch FROM MEMVAR

	ENDSCAN
	GO TOP IN c_QuickSearch
	
	IF m.plStop
		.EmptySearchResult() && Search was cancelled		
	ENDIF
ENDWITH

lnReccount = RECCOUNT("c_QuickSearch")

=MESSAGEBOX("Populating cursor took " + TRANSFORM(SECONDS() - m.lnSeconds) + " seconds")

RETURN m.lnReccount
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