Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why do UNIONs in SQL statements take a long time?
Message
De
16/09/1999 08:16:16
 
 
À
15/09/1999 19:28:13
Ernie Veniegas
Micro System Solutions, Inc.
Calistoga, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00265270
Message ID:
00265398
Vues:
15
>Anybody know whether an SQL statement that uses multiple UNIONS is supposed to take a lot more time to execute versus issuing two or three separate SQL statement and manually joining the results?
>
>I have an SQL statement that's basically 4 separate SQL's. On their own, each SQL statement takes about 3 seconds to run. But when I put them all together with the UNION clause, it takes about 2+ minutes to run instead. The output is the same whether I use the single SQL statement with UNIONS or run each of the 4 SQL statements separately and put them into a single table using something like APPEND FROM DBF("OneofMytables").

Ernie,

Anytime you join more than two tables, as with a union, the SQL SELECT will not be fully optimized. In fact, with a UNION like you are doing will be worse. Each individual SELECT may be fully optimized. This results in three cursors, neither of which is optimizable. If you need more information, see the KB article about Rushmore on my web site.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform