Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Puzzle
Message
De
28/11/2003 07:42:26
 
 
À
28/11/2003 06:31:53
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00854130
Message ID:
00854172
Vues:
24
Hi Agnes,

Write
T1 INNER JOIN T2 ON joinCondition(T1,T2) WHERE filterCondition(T1,T2)
is equivalent to write
T1 INNER JOIN T2 ON joinCondition(T1,T2) AND filterCondition(T1,T2)

and i use the last form because it is clearer ( for me ), and i'm sure that it
is optimized.

VFP optimize the where clause, and trasform the first on the second;
BUT VFP not optimize the HAVING clause

try this:
CLEAR
SET TALK OFF 
CREATE CURSOR T1 (id I DEFAULT RECNO())
CREATE CURSOR T2 (fid I DEFAULT T1.id,condition I DEFAULT RAND()*100)
FOR K=1 TO 10
	APPEND BLANK IN T1
	FOR j=1 TO 500
		 APPEND BLANK IN T2
	NEXT
NEXT
SYS(3054,11)

tz=SECONDS()
SELECT T1.id, T2.condition FROM T1 ;
	JOIN T2		ON T2.fid =T1.id ;
	JOIN T2 T3	ON T3.fid =T1.id ;
	WHERE T2.condition>90 AND T3.condition<10 ;
	INTO CURSOR dummyWhere
? SECONDS()-tz

tz=SECONDS()
SELECT T1.id, T2.condition FROM T1 ;
	JOIN T2		ON T2.fid =T1.id AND T2.condition>90 ;
	JOIN T2 T3	ON T3.fid =T1.id AND T3.condition<10 ;
	INTO CURSOR dummyJoin
? SECONDS()-tz

tz=SECONDS()
SELECT T1.id, T2.condition FROM T1 ;
	JOIN T2		ON T2.fid =T1.id ;
	JOIN T2 T3	ON T3.fid =T1.id ;
	HAVING T2.condition>90 AND T3.condition<10 ;
	INTO CURSOR dummyHaving
? SECONDS()-tz
Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform