Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Xbase Fox > Re: faster quer...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 832 of 861
Post > Topic >>

Re: faster query style

by Gene Wirchenko <genew@[EMAIL PROTECTED] > Mar 8, 2008 at 03:35 PM

MollyShark <mollyshark@[EMAIL PROTECTED]
> wrote:

>Is there any noticeable speed difference in these two queries?
>
>select * from table1, table2 where table1.field=table2.field
>blahblahblah
>
>select * from table1 where table1.field in (select field from table2)
>
>Both fields are indexed, of course.

     Probably.  The queries are NOT equivalent.

     Consider:

          table1:
               data  plus1 (c(10))
               1     one
               2     two
               3     three

          table2:
               data  plus2 (c(10))
               1     1-1
               3     3-1
               3     3-2

     The first query will return
          data_a  plus1  data_b  plus2
          1       one    1       1-1
          3       three  3       3-1
          3       three  3       3-2
and the second will return
          data  plus1
          1     one
          3     three

     The first query means to take the cartesian join of table1 and
table2 eliminating any cases where table1.field and table2.field are
not equal.  All columns of both tables are included, and there is the
possibility of duplicates if data is not a key.

    The second query means to return those rows in table1 where data
is in table2 as well.  The columns of table2 will not be included, and
there is no possibility of duplicates.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
     I have preferences.
     You have biases.
     He/She has prejudices.
 




 2 Posts in Topic:
faster query style
MollyShark <mollyshark  2008-03-07 07:38:14 
Re: faster query style
Gene Wirchenko <genew@  2008-03-08 15:35:42 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 10:33:28 CST 2008.