Dimitar Boiadjiev wrote:
> 
> Hi all,
> I've been working on optimizing my query but no success. Concerning the
> type of query shown by "explain select", about join type "ALL" in the
> manual is written: "This is normally not good if the table is the first
> table not marked const, and usually very bad in all other cases." So, I
> added indexes on all columns involved in join but "explain select" still
> shows the same result. Am I missing something or this is inevitable and
> can't be optimized. Below are some snippets.
+---------+------+----------------+------+---------+------+------+----------------------------------------------+
> | table   | type | possible_keys  | key  | key_len | ref  | rows |
> Extra                                        |
> 
>+---------+------+----------------+------+---------+------+------+----------------------------------------------+
> | firm    | ALL  | fikey,fiuserid | NULL |    NULL | NULL |   11
> |                                              |
> | product | ALL  | prfikey        | NULL |    NULL | NULL |   25 | range
> checked for each record (index map: 2) |
> | users   | ALL  | userid         | NULL |    NULL | NULL |   96 | range
> checked for each record (index map: 1) |
> 
>+---------+------+----------------+------+---------+------+------+----------------------------------------------+
> 3 rows in set (0.00 sec)

If there are so small quantity of rows in table then full scan is faster
than using indexes. I do not remember exact amount but maybe it was 300
rows in table below what MySQL doesn't use indexes. Indexes get used if
there are more rows in table. This is normal and feature and good :)



-- 
MySQL Development Team
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Tonu Samuel <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, http://www.mysql.com/
/_/  /_/\_, /___/\___\_\___/  Tallinn, Estonia
       <___/

---------------------------------------------------------------------
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