Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use select... where EXISTS ... ?
Message
De
28/05/2003 11:27:28
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00793069
Message ID:
00793539
Vues:
40
Hi Sergey,

Normal IN and EXISTS they are practically equal.

IF you clone pivot table records:

SELECT * FROM ...

IN is faster,

but

SELECT *,1 FROM ...

can do EXISTS faster 5%.

The problem is an other:

IN support correlate expression ( it build one Index on fly )

but

EXISTS not support correlate expression !

Example:

create cursor x1 ( i1 i, c1 c(10) )
for i = 1 to 100000
insert into x1 values ( i, STR( i ) )
endfor

create cursor x2 ( i1 i, c1 c(10) )
for i = 1 to 100000 step 2
insert into x2 values ( i, STR( i ) )
endfor
select * from x1 where i1 IN (SELECT MOD(i1,50000) FROM x2) into cursor x3
select * from x1 where exists (select * from x2 where MOD(x2.i1,50000) = x1.i1) into cursor x3

USE IN x3
USE IN x2
USE IN x1

Then, i can ignore EXISTS and uses only IN on select command ?

Fabio
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform