Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The solution is not immediate
Message
De
24/02/2005 07:17:21
 
 
À
24/02/2005 04:26:04
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
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00989998
Message ID:
00990018
Vues:
21
Hi again Fabio,

here's a more complete example of my solution:
Set Talk Off
t1=Seconds()
Clear
Close Databases All
Close Tables All

On Error ? Message()

* put NN = 200000 or even 1000000!
#Define NN 200

Create Cursor data1(fr i)

For K=1 To NN
   Insert Into data1 Values (Rand()*10)
Next
Index On fr Tag TAGJOIN1

Create Cursor data2 (fr i)
For K=1 To NN
   Insert Into data2 Values (Rand()*10)
Next
Index On fr Tag TAGJOIN2

Create Cursor data3 (fr i)
For K=1 To NN
   Insert Into data3 Values (Rand()*10)
Next
Index On fr Tag TAGJOIN3

Create Cursor table1 (f1 i,f2 i,f3 i,f4 i)
For K=1 To NN
   Insert Into table1 Values (Rand()*10,Rand()*10,Rand()*10,Rand()*10)
Next
Index On f1 Tag rushmore
Set Order To

? "preparation:",Seconds()-t1
t1=Seconds()

Select table1
Set Relation To f2 Into data1
Set Relation To f3 Into data2 Additive
Set Relation To f4 Into data3 Additive
Delete For f1=2 And !Eof("data1") And !Eof("data2") And !Eof("data3") In "table1"

? "delete:",Seconds()-t1
Set Talk On

* SQL equivalent (not supported):
*
* DELETE FROM table1 where f1=2;
*    and exist(select top 1 fr from data1 A where A.fr=table1.f2 order by fr);
*    and exist(select top 1 fr from data2 B where B.fr=table1.f3 order by fr);
*    and exist(select top 1 fr from data3 C where C.fr=table1.f4 order by fr)
Rushmore will optimize f1=2 and the set relations optimize the "joins" of data1 to data3.

Bye, Olaf.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform