FIX: Running JOIN on Three or More Tables is SlowLast reviewed: October 29, 1997Article ID: Q163420 |
The information in this article applies to:
SYMPTOMSRunning a SQL query that joins three or more tables in Visual FoxPro 5.0 is very slow. If Visual FoxPro 3.x is available for testing, this same query performs much faster by comparison. Using the new JOIN syntax with the SQL Select statement is also slow.
CAUSEOne or more of the tables have only one or only a few records that join with the other tables.
RESOLUTIONThe query speed can usually be increased by using the new SQL Select syntax in Visual FoxPro 5.0 for JOINS in conjunction with the FORCE keyword. Using the sample SQL Select statements from step 3 under the Steps to Reproduce Behavior section below, the addition of the FORCE keyword makes the queries run much faster:
SELECT * FROM FORCE test1 ; INNER JOIN test2 ON test2.id = test1.id ; INNER JOIN test3 ON test3.id = test2.id SELECT * FROM FORCE test1 ; INNER JOIN (test2 INNER JOIN test3 ON test3.id = test2.id ); ON test2.id =test1.id STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual FoxPro 5.0a.
MORE INFORMATIONThis problem seems to occur when there is a join of three or more tables when there are only one or two records in one of the tables or there are only one or two records that have related records in the other tables. The tables also have to have a large number of records in them (30,000, 70,000 and 90,000). All of the table join scenarios that can exhibit the problem are not known. If the slow query is allowed to run, it may fill the computer's hard drive with a large temporary file and the following program error message may be received:
There is not enough disk space for c:\temp\12345678.tmp Steps to Reproduce BehaviorThe following steps provide sample code that can be used to reproduce the problem. Press the Escape key to cancel the query in step 2 when desired.
REFERENCES
Microsoft Visual FoxPro "Developer's Guide" version 5.0, pages 214-215Keywords : buglist5.00 FxprgSql FxprgTable vfoxwin vfpfix5.0a kbusage kbbuglist kbfixlist Version : 5.0 Platform : WINDOWS Issue type : kbbug Solution Type : kbfix |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |