Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update SQL performance
Message
 
 
À
17/01/2005 12:37:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00977787
Message ID:
00977791
Vues:
31
Try
Select bom  &&&& TABLE to be UPDATED
Set Order To bom_pk    &&& UNIQUE INDEX that drives the update

SELECT TBOMUPDATE 
SCAN
	IF SEEK(bom_pk, "bom")
		REPLACE bom.itemvalue WITH  TBOMUPDATE.itemvalue, ;
				...
                        bom.itemcost = TBOMUPDATE.itemcost ;
		  WHILE bom.bom_pk = TBOMUPDATE.bom_pk ;
		  IN bom
	ENDIF
ENDSCAN
You can also use SET RELATION instead of SEEK

>I'm hitting a very "interesting" performance problem...
>I am trying to update records in a table based on records from another table ( or array ) and it takes forever.
>
>The variation displayed below is inspired by code that runs lightning fast on ORACLE... ho
>
>
>         Select bom  &&&& TABLE to be UPDATED
>         Set Order To bom_pk    &&& UNIQUE INDEX that drives the update
>
>*!* CREATE driving array with data
>
>         Select bom_pk, itemvalue, vpc_pk, xinv_pk, itemcost ;
From TBOMUPDATE Into Array atbomupdate Order By bom_pk
>         lalen=_Tally
>
>*!* Process UPDATE's
>        For iup = 1 To lalen
>            Update bom ;
>               set  itemvalue = atbomupdate[iup,2], ;
>               vpc_pk = atbomupdate[iup,3], ;
>               xinv_pk = atbomupdate[iup,4], ;
>               itemcost = atbomupdate[iup,5] ;
>               where bom.bom_pk = atbomupdate[iup,1]
>
>         Endfor
>
>
>The BOM table is not that big... approx 600K records, and for the above snippet ( updating about 30 records... ) it takes 20 seconds...
>
>I have tried REPLACE... and it's WAY.. worse.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform