opticalman
Programmer
I am using VFP 8 with MS SQL EXPRESS as a remote backend
I have been troubleshooting a slow TABLEUPDATE(). It is a table of charges, payments, balance, and date. I have reduced the time of the TABLEUPDATE() from 110 seconds to less than 1 second. Here are 4 pseudo-code examples of what I did.
** example one, original code
** new record has been added via grid control and tablebuffering
TABLEUPDATE( .t. , .t. ) && takes .01 seconds
** code modifies 1000 records
TABLEUPDATE( .t. , .t. ) && takes 115.0 seconds
** new record is removed from grid
** must refresh to see new record
** example two, stop updates does not help
** new record has been added via grid control and tablebuffering
TABLEUPDATE( .t. , .t. ) && takes 0.017 seconds
CURSORSETPROP("SendUpdates", .F. )
** code modifies 1000 records
CURSORSETPROP("SendUpdates", .T. )
TABLEUPDATE( .t. , .t. ) && takes 117.0 seconds
** new record is removed from grid
** must refresh to see new record
** example three, success
** new record has been added via grid control and tablebuffering
TABLEUPDATE( .t. , .t. ) && takes 0.017 seconds
CURSORSETPROP("SendUpdates", .F. )
** code modifies 1000 records
TABLEUPDATE( .t. , .t. ) && ?? commits local table ??
CURSORSETPROP("SendUpdates", .T. )
TABLEUPDATE( .t. , .t. ) && takes 0.17 seconds
** new record is visible on grid
** but is last record, even if date is earlier than previous record
** example four, now works fast,
** data is in correct order if "pre-dated"
** new record has been added via grid control and tablebuffering
TABLEUPDATE( .t. , .t. ) && takes 0.017 seconds
REQUERY()
CURSORSETPROP("SendUpdates", .F. )
** code modifies 1000 records
TABLEUPDATE( .t. , .t. )
CURSORSETPROP("SendUpdates", .T. )
TABLEUPDATE( .t. , .t. ) && takes 0.17 seconds
** new record is visible on grid and in correct order
I have not seen this 'work around' addressed in any article. It is such a dramatic change that I think it is worthy of discussion. My concern is that I have been doing something wrong in the past that slows down the original code in example one. I originally thought this was a record-buffering vs table-buffering issue, but my tests said no. I was also surprised that I needed the TABLEUPDATE() before resetting SENDUPDATES to TRUE. I would appreciate some comments, insights, and/or warnings to what I'm doing.
Jim Rumbaugh
I have been troubleshooting a slow TABLEUPDATE(). It is a table of charges, payments, balance, and date. I have reduced the time of the TABLEUPDATE() from 110 seconds to less than 1 second. Here are 4 pseudo-code examples of what I did.
** example one, original code
** new record has been added via grid control and tablebuffering
TABLEUPDATE( .t. , .t. ) && takes .01 seconds
** code modifies 1000 records
TABLEUPDATE( .t. , .t. ) && takes 115.0 seconds
** new record is removed from grid
** must refresh to see new record
** example two, stop updates does not help
** new record has been added via grid control and tablebuffering
TABLEUPDATE( .t. , .t. ) && takes 0.017 seconds
CURSORSETPROP("SendUpdates", .F. )
** code modifies 1000 records
CURSORSETPROP("SendUpdates", .T. )
TABLEUPDATE( .t. , .t. ) && takes 117.0 seconds
** new record is removed from grid
** must refresh to see new record
** example three, success
** new record has been added via grid control and tablebuffering
TABLEUPDATE( .t. , .t. ) && takes 0.017 seconds
CURSORSETPROP("SendUpdates", .F. )
** code modifies 1000 records
TABLEUPDATE( .t. , .t. ) && ?? commits local table ??
CURSORSETPROP("SendUpdates", .T. )
TABLEUPDATE( .t. , .t. ) && takes 0.17 seconds
** new record is visible on grid
** but is last record, even if date is earlier than previous record
** example four, now works fast,
** data is in correct order if "pre-dated"
** new record has been added via grid control and tablebuffering
TABLEUPDATE( .t. , .t. ) && takes 0.017 seconds
REQUERY()
CURSORSETPROP("SendUpdates", .F. )
** code modifies 1000 records
TABLEUPDATE( .t. , .t. )
CURSORSETPROP("SendUpdates", .T. )
TABLEUPDATE( .t. , .t. ) && takes 0.17 seconds
** new record is visible on grid and in correct order
I have not seen this 'work around' addressed in any article. It is such a dramatic change that I think it is worthy of discussion. My concern is that I have been doing something wrong in the past that slows down the original code in example one. I originally thought this was a record-buffering vs table-buffering issue, but my tests said no. I was also surprised that I needed the TABLEUPDATE() before resetting SENDUPDATES to TRUE. I would appreciate some comments, insights, and/or warnings to what I'm doing.
Jim Rumbaugh