How to Optimize the USE Command for Speed

ID: Q129924

The information in this article applies to:

SUMMARY

The speed of the USE command in opening a table depends on whether the table is opened in exclusive or shared mode.

MORE INFORMATION

When a table is opened with the USE command, a certain amount of data is read into FoxPro's internal buffers from the physical .DBF file. The amount of this data is influenced by the mode in which the file is opened. If the file is opened for exclusive use, more data is read into the buffers than if the file is opened for shared use.

A table is opened for exclusive use when the USE command is used to open the table without the optional SHARE clause and when SET EXCLUSIVE is ON. A table is opened for shared use when the SHARE clause of the USE command is included or when SET EXCLUSIVE is OFF.

As the amount of time required to open a table is partly a function of the amount of data read into FoxPro's buffers, it usually takes less time to open a table for shared use and more time to open a table for exclusive use.

Under normal circumstances, the time difference is not discernible. Under certain circumstances, however, this distinction may produce a discernible difference in performance. For example, if the table resides on a remote computer that is connected to the client computer through a slow WAN (wide area network) or modem connection and a large number of tables are opened with the USE command, the time required to open the files for shared use is likely to be discernibly shorter than the time required to open the files for exclusive use.

Additional reference words: FoxWin 2.60a KBCategory: kbprg KBSubcategory: FxprgGeneral

Last Reviewed: June 27, 1995