On Fri, 19 Oct 2001 13:03:02 -0500
Eric <[EMAIL PROTECTED]> wrote:

> Well, answering my own email, what I thought was a bug is not one at
> all.  I was mistaken in thinking that MySQL paid any attention to the
> WHERE conditions when optimizing the join order beyond determining
> which keys are used for the join, correct?  
> 
> This is really terrible for queries like mine where the query could be
> sped up by orders of magnitude if the join optimizer would just
> determine which table in the join to scan and which to do the key
> lookup on based on a more intelligent estimation of the number of rows
> from each table.  It would have to go beyond looking at what keys are
> used in the join (since each of the tables in my query can be looked
> up by the same key) and account for the WHERE conditions placed on the
> tables in the join.
> 
> Is there sufficient metadata to estimate rows coming from a table
> based on conditions placed on the attributes of that table?  Where is
> it?  Has anyone ever thought of coding this?  Can anyone give me a
> place to start?
>
> eric.

HI!

At least, with LEFT JOIN you can always specify precisely which table is to be scanned 
and which to be searched by key.

In other joins, you can use STRAIGHT_JOIN with correct order of tables in order to 
achieve the same. 

Yes, the above is little bit harder to be done with dynamically created queries, but 
it is still possible, as you can always get number of rows.

--

Regards,

--
For technical support contracts, go to https://order.mysql.com/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    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