When the index is evaluated initially, VFP knows exactly what fields affect
what index, so really just affected indexes are updated.

It's easy to test it. just make an old index (IDX) on two different fields:

CREATE TABLE test (field1 C(10), field2 I)
INDEX on field1 TO test_f1 additive
INDEX on field2 TO test_f2 additive

Add some data, wait a minute, replace one of the fields and do a FLUSH
FORCE, and you will see that only the affected index changes his timestamp.




2018-01-24 23:57 GMT+01:00 <mbsoftwaresoluti...@mbsoftwaresolutions.com>:

> On 2018-01-24 15:21, Ted Roche wrote:
>
>> First off, don't do that. REPLACE (or better, UPDATE) once. Especially
>> in high network traffic situations, the amount of time it takes to
>> assemble a field and value list to issue one:
>>
>> UPDATE TableName SET &lcSetFieldsToValues WHERE FilterCriteria
>>
>> saves an enormous amount of I/O and CPU cycles: one lock, one
>> transaction, one row re-write, one set of reindexes.
>>
>
>
> Yes, I retooled some code to replace (pun not intended) a whole bunch of
> REPLACE commands in the same area with a SCATTER to object, do the voodoo,
> then just ONE REPLACE afterwards for that very purpose.  I specifically
> listed that "multiple conditions" example thinking if I didn't, someone
> would say as you did to avoid the multiple REPLACEs.  :-)
>
>
>
>> Second, in VFP, all indexes have to be evaluated, as there's no
>> backlink to which fields are used in which expressions. Indexes are
>> defined at the table level, not the row, so can have multiple field
>> names, functions (UPPER() or DELETED(), for example), concatentations
>> or just random stuff.
>>
>
>
> So you're contending that ALL of the indexes--not just those affected by
> the field that was changed--would have to be reevaluated?
>
>
>
>> <OldWarStory>
>> I once worked on an app where the original developer thought it would
>> be a "clever" idea to define index expressions as UDFs. Yes, it's
>> possible. In his UDFs, he would switch work areas, open tables if not
>> already opened, look up values, and then return the value, cleaning up
>> work areas and tables as he went. For every index definition for every
>> record. A reindex with more than a couple hundred records brought the
>> entire system to its knees.
>> </OldWarStory>
>>
>
>
> YIKES!!!!  Thanks for sharing that one!
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CAGQ_Ju=4VNPRZZ5QXsK2iY9eY55thp4vpiO=vyrhthxwdeu...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to