Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why sub-select so much slower than CSV list
Message
De
10/12/2009 04:51:11
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
10/12/2009 04:26:25
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Divers
Thread ID:
01438268
Message ID:
01438350
Vues:
53
Hi Walter,

o.k, this is hard to test for a simple SELECT like this one. Maybe I place a UDF in the colum section of the SQL and count.

something like
PUBLIC lnCount
lnCount=0
SELECT * FROM tmpSource WHERE fs1 IN (SELECT t1+MyUDF() FROM tmpFilter) INTO CURSOR tmp
?lnCount

function MyDF
lnCount=lnCount+1
return ''
endfunc
As soon as you place something in the WHERE (especially if related to the outer select) of the inner SELECT this must fail.

But this was not the question.


Agnes
>Hi Agnes,
>
>
>>Sorin,
>>the subselect will be evaluated over and over. In your example for every record in the outer select. So there is a bit of work to do.
>
>AFAIK, that is not correct. The inner select is only executed once and placed in a temp file. Then for each record in the outer select it is searching the temp file for a match. The optimizer in the first approach just does do the opposite: Take each value in the IN clause and search that in the table directly using the index.
>
>AFAICS, the optimizer is not smart enough to see that both cases are equivalent. SQL server might be a bit smarter in this respect.
>
>Walter,
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform