Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Very slow VFP SQL Update
Message
De
10/01/2006 17:19:00
Mike Yearwood
Toronto, Ontario, Canada
 
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
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01085361
Message ID:
01085411
Vues:
14
Hi John

>>>The folowing two table updates where tested with the bsmemo table open at another PC but with no locks.
>>>
>>>The c_memo and bsmemo tables have identical structures of:
>>>k_seqno i(4), k_memo i(4), textln c(65)
>>>and are indexed on k_seqno and k_memo.
>>>(Note that k_memo is not used in the updates.)
>>>
>>>c_memo has 3 records, bsmemo has 9,000 records.
>>>
>>>I tried several ways with the SQL Update and nothing helped. It appears that the SQL Update is not using the index at all. Using the Old Scan/Replace takes .013 seconds. The SQL Update takes 16 seconds.
>>>TIA, John.
>>>
>>>
*
>>>* This Scan/Replace takes .013 seconds
>>>* ---------------------------------
>>>select 0
>>>use bsmemo order k_seqno
>>>select 0
>>>use jmemo alias c_memo exclusive
>>>*
>>>msec = seconds()
>>>*
>>>select c_memo
>>>scan for updtflag = 'U'
>>>  select bsmemo
>>>  if seek(c_memo.k_seqno)
>>>    replace textln with c_memo.textln
>>>  endif
>>>endscan
>>>*
>>>? seconds() - msec
>>>*
>>>*
>>>* This SQL Update takes 16 seconds
>>>* ---------------------------------
>>>msec = seconds()
>>>*
>>>update bsmemo set ;
>>>textln = c_memo.textln ;
>>>from c_memo ;
>>>where c_memo.k_seqno = bsmemo.k_seqno ;
>>>and c_memo.updtflag = 'U'
>>>*
>>>? seconds() - msec
>>
>>try
>>
>>msec = seconds()
>>*
>>update bsmemo set textln = c_memo.textln ;
>>from c_memo join bsmemo on c_memo.k_seqno = bsmemo.k_seqno ;
>>where c_memo.updtflag = 'U'
>>*
>>? seconds() - msec
>>
>
>Fabio,
>Sorry same result. Maybe even a second longer. I do appreciate the help. Thanks.

Are you sure the SCAN is updating all the records? The VFP Help says that update uses record locking which may slow performance. Do you have an index on updtflag?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform