Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Both work, which is best
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00782049
Message ID:
00782055
Vues:
11
Hi Sarah,

In my expirience the second quiery is faster in most cases. However, as with all queries, only test on real or close to real data can give you the answer.

>I have a query I'd like to optimise.
>
>I don't have a huge amount of test data but it appears that when the rows returned increases that option 2 is the most efficient. Is that consistent with others?
>
>Table 1 has a 1:M relationship with Table 2. The id's are indexed.
>** The Code:
>lcTest = "Rent"
>*lcTest = "Accounting"
>*lcTest = "Bank Charges"
>
>lnseconds = seconds()
>
>select distinct table1.* ;
>  from table1, table2;
>  where table1.table1id  = entrydet.table1id;
>  and table2.category = lcTest;
>  into cursor q1
>
>? seconds() - lnseconds
>
>lnseconds = seconds()
>select * from table1;
>  where table1id in (select table1id from table2 where category = lcTest);
>  into cursor q2
>
>? seconds() - lnseconds
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform