MySQL Forums
Forum List  »  Optimizer & Parser

Log Query not using indexes
Posted by: benoit plessis
Date: April 09, 2008 10:07AM

Hi,

I started using this function to help optimize ours databases servers.
While doing so i found some potentially mis written query, as i expected but
i found queries that could be optimized, expect using un-logical statement.

Example:
a simple table famille:
+-----------------------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+-----------------------+------+-----+---------+-------+
| Num_famille | mediumint(8) unsigned | NO | PRI | 0 | |
| Nom_famille | varchar(255) | NO | MUL | | |
+-----------------------+-----------------------+------+-----+---------+-------+

mysql> explain select * from famille;
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
| 1 | SIMPLE | famille | ALL | NULL | NULL | NULL | NULL | 3 | |
+----+-------------+---------+------+---------------+------+---------+------+------+-------+

and running the "select * from famille;" add an entry to the slow log
to get rid of it: "select * from famille where num_famille" or 'num_famille > 0'
but well, it's weird isn't it ?

Options: ReplyQuote


Subject
Views
Written By
Posted
Log Query not using indexes
6080
April 09, 2008 10:07AM
2544
September 27, 2008 10:24PM
2854
September 28, 2008 04:49AM
2549
September 28, 2008 03:02PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.