* Noamn
[...]
> { What does the cardinality mean? There should be three values for matzav,
> three for sug and five for status. Is this zero based? }
It is the expected number of different values in this column. The number is
not accurate. You can run ANALYZE TABLE to update this information.
<URL: http://www.mysql.com/doc/en/ANALYZE_TABLE.html >
> mysql> explain select p.id, p.name, p.schum, s.name, sochnim.name
> -> from projects p, status s, sochnim
> -> where p.matzav = 0
> -> and p.status = s.id
> -> and p.sochen = sochnim.id
> -> order by p.name;
> +---------+--------+----------------------------+----------+------
---+------
> ----+------+---------------------------------+
> | table | type | possible_keys | key | key_len | ref
> | rows | Extra |
> +---------+--------+----------------------------+----------+------
---+------
> ----+------+---------------------------------+
> | p | ref | i_matzav,i_sochen,i_status | i_matzav |
As you can see here, the i_name index is not even considered, and the
i_matzav index is used. This is why it needs to be sorted at the end.
Try creating a compound index on (matzav,name).
--
Roger
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]