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



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft Visual FoxPro for Windows 6.0
  • Microsoft Visual FoxPro for Windows 7.0
  • Microsoft Visual FoxPro 8.0
  • 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


Modification Type:MajorLast Reviewed:3/10/2005
Keywords:KB136765