Erlend Stromsvik writes:
> Hi
> 
> I having a little trouble with mysql, with the lack of sub-selects.
> 
> Yes, I have read about joins, both the manual and from the MySQL book by
> Paul Dubois, but none of those provide any 'real' info about what to do.
> 
> It's ok to do join on table1, table2 and table3 as long as they are limited
> to 10 records each, as in all of the examples you find on the net. But what
> about my tables. I have one with 1,14 million and one with 136.000 and a
> third with 65.000 records. What I want to do is to check for a match between
> a record from table1 in table2 and from table1 to table3
> 
> ex. from table1 to 2:
> select * from table1 where col1 in (select col2 from table2);
> 

<cut>

> 
> Would be nice to hear from someone who manages good sized databases.
> 
> 
> Regards
> Erlend Stromsvik


Regardless of whether you use join's or subselects, the same number of
rows has to be reviewed. What you have calculated is a Cartesian
product, not join.

But not as much as you think. JOIN's require that common columns are
defined, which is done in ON or in WHERE clause. Make sure that you
have proper indices on those columns and join will be much faster then
corresponding sub-select.

-- 
Regards,
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Mr. Sinisa Milivojevic <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, FullTime Developer
/_/  /_/\_, /___/\___\_\___/   Larnaca, Cyprus
       <___/   www.mysql.com

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to