Microsoft KB Archive/136765

= Description of how memory and disk space are used during a SELECT-SQL command in Visual FoxPro =

Article ID: 136765

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 7.0 Professional Edition
 * Microsoft Visual FoxPro 8.0 Professional Edition
 * Microsoft Visual FoxPro 9.0 Professional Edition

-



This article was previously published under Q136765



SUMMARY
This article explains how Visual FoxPro uses memory and disk space during a SELECT-SQL command.



MORE INFORMATION
SELECT-SQL commands uses as much internal memory as it can for file caching (read buffering), sorting (for ORDER BY, GROUP BY, SELECT DISTINCT, and UNION DISTINCT), and performing joins. This memory is limited by the setting of SYS(3050).

When executing complex queries, SELECT-SQL commands sometimes generates intermediate temporary tables. These temporary tables consist of the result of one of the following:


 * A JOIN of two source tables (or previous intermediate results).

-or-
 * A SORT of a source table (or previous intermediate result) to satisfy an ORDER BY, GROUP BY, SELECT DISTINCT, or UNION DISTINCT.

In many cases, a join and a sort or multiple sorts can be combined into one pass, removing an intermediate temporary table result.

In addition, temporary files are used while performing a sort if the entire sort cannot be performed in memory. The size of the temporary sort files for a given sort should be no larger than:

(record length + key length) * (number of records) * 2

In addition, SELECT-SQL creates a temporary index file to perform a join if no index exists. Creating the index may create temporary files also.

For additional information about the SYS(3050) function, click the following article number to view the article in the Microsoft Knowledge Base:

176483 Large amounts of RAM seem to process data slowly

Additional query words: VFoxWin

Keywords: KB136765

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.