How to Optimize the USE Command for Speed

Last reviewed: June 27, 1995
Article ID: Q129924
The information in this article applies to:
  • Microsoft FoxPro for Windows, version 2.6a

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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.