> 
> 
> I have a question regarding the slow queries log, and queries not using 
> index.
> 
> I have a small table, with say 10 entries, like that :
> ID | Element
> -------------
> 1 | One
> 2 | Two
> 3 | Three
> 4 | Four
> 5 | Five
> 6 | Six
> 7 | Seven
> 8 | Eight
> 9 | Nine
> 10 | Ten
> 
> I want to get all those entries:
> SELECT ID, Element FROM tblentries;
> 
> The problem is that this query, even if very fast, is logged in the slow 
> query log because it does not use index (I
> activated this option in the slow query log). Woudln't it be better if 
> such queries would be logged only in case there
> is a WHERE, ORDER or GROUP/HAVING clause ?

  Slow query log, especially with long-long-format turned on, isn't made for 
manual browsing anyway.
You'll have to use mysqldumpslow or some custom-made script to analyze it.
Queries that don't have 'where' are easy to filter then.
 
Also, is it better to do :
> SELECT ID, Element FROM tblentries;
> or
> SELECT ID, Element FROM tblentries WHERE ID > 0;
> 
> (In this last case, it won't be logged in the slow query log beause it 
> uses an index...)

 It won't be logged if it actually will use index. In your example it won't 
use index, full table scan will be used instead, because query optimizer is 
able to determine that all records match where condition. 
   
> -- 
> Alexey Polyakov

Reply via email to