Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update SQL performance
Message
From
18/01/2005 12:24:37
 
 
To
17/01/2005 12:37:13
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00977787
Message ID:
00978164
Views:
20
>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.
>Any ideea would be appreciated... thanks in advance, alex

If bom_pk is PRIMARY()
Select bom  &&&& TABLE to be UPDATED
Set Order To bom_pk    &&& UNIQUE INDEX that drives the update

REPLACE NOOPTIMIZE FOR SEEK(bom_pk, "bom"); 
     bom.itemvalue WITH itemvalue ;
,    bom.vpc_pk    WITH vpc_pk    ;
,    bom.xinv_pk   WITH xinv_pk   ;
,    bom.itemcost  WITH itemcost  ;
     IN TBOMUPDATE
Fabio
Previous
Reply
Map
View

Click here to load this message in the networking platform