Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Very slow SQL Update even when index exists
Message
De
05/12/2006 11:35:52
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
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 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01174680
Message ID:
01174959
Vues:
9
>I am having a problem with the SQL Update below. From the amount of time it takes to run with only 1 or 2 records in the cursor c_chng I believe it is ignoring the index on k_ivinvt and scanning all 186K recs in the inventory table IVINVT. The last time I had this problem was on updating invoice lines and I fixed it by adding a 2nd line to the where clause to include the invoice key. This time there is no other index I can use. The two tables are tied only by the ivinvt.k_ivinvt = c_chng.k_ivinvt. This has got to be a really common event so I know I am missing something here.
>
>I added set enginebehavior 90 but it made no difference
>
>
set enginebehavior 90
>
>* Update inventory allocated amounts
>TEXT TO mSqlCommand noshow pretext 15
>  update ivinvt
>  set allocated = allocated + c_chng.chng
>  from c_chng
>  where ivinvt.k_ivinvt = c_chng.k_ivinvt
>ENDTEXT
>&mSqlCommand
John,
Doing it old style help? ie:
select c_chng
scan
update ivinvt ;
  set allocated = allocated + c_chng.chng
  where ivinvt.k_ivinvt == c_chng.k_ivinvt
endscan
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