Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Performance problem using local view in a grid (VFP 5.0)
Message
De
02/06/1998 04:17:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
02/06/1998 03:44:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00103893
Message ID:
00103903
Vues:
28
>This the code that is taking so long:
>
>select c_playlist
>go top
>*replace FROM ARRAY ppl_Temp
>idx=1
>do while idx<=reccnt
> replace sequence with ppl_temp(idx,1);
> trt with ppl_temp(idx,2);
> for play_list_no=ppl_temp(idx,3)
>
> idx=idx+1
> select c_playlist
> go top
>enddo
>
>Play_list_no is a sequential key field. TRT is 'total running time'.
>
>Immediately after the code shown is extensive code that includes the tableupdate(). I have tried table buffering, but the updates seem to be taking place here, not at tableupdate(). I apologize if I am making some basic blunder.
>
>I am bowled over by your rapid response. Thank you!
This is w/o (or with) index (using SQL way) :
select c_playlist
*replace FROM ARRAY ppl_Temp
for ix = 1 to alen(ppl_temp,1)   && We only need ppl_temp rowcount updates
	update c_playlist ;
		set sequence = ppl_temp(ix,1)	;
			trt = ppl_temp(ix,2) ;
		where play_list_no=ppl_temp(ix,3)
endfor
This is with index :
select c_playlist
* If not an already existing tag on play_list_no create it
* Views can be indexed too.
index on play_list_no tag plylstno && Tags are max 10 char
*replace FROM ARRAY ppl_Temp
for ix = 1 to alen(ppl_temp,1)   && We only need ppl_temp rowcount updates
	if seek(ppl_temp(idx,3),"c_playlist","plylstno")
		replace sequence with ppl_temp(ix,1);
				trt with ppl_temp(ix,2) ;
				while play_list_no=ppl_temp(ix,3)
	endif
endfor
In your code go top is useless because a *for* forces it. And seeing do while expression I wonder if array rowcount is same as reccount. Anyway check new code timing. First w/o index and then with index. There are still many different ways to do it.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform