Author: mbsoftwaresolutions@mbsoftwaresolutions.com
Posted: 2018-01-24 at 16:57:48
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!
_______________________________________________
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/5d9cee85aa2f46822511932265fab73e@mbsoftwaresolutions.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.