Re[2]: Slow Queries Log and Index-less queries

2005-08-30 Thread HMax
Thanks Alexey,

This is enough explanation for me ;)

Cheers,
HMax


AP> I have a question regarding the slow queries log, and queries not using 
index.

AP> I have a small table, with say 10 entries, like that :
AP> ID |  Element
AP> -
AP> 1  |  One
AP> 2  |  Two
AP> 3  |  Three
AP> 4  |  Four
AP> 5  |  Five
AP> 6  |  Six
AP> 7  |  Seven
AP> 8  |  Eight
AP> 9  |  Nine
AP> 10 |  Ten

AP> I want to get all those entries:
AP> SELECT ID, Element FROM tblentries;

AP> The problem is that this query, even if very fast, is logged in the slow 
query log because it does not use index (I
AP> activated this option in the slow query log). Woudln't it be better if such 
queries would be logged only in case there
AP> is a WHERE, ORDER or GROUP/HAVING clause ?

AP>  
AP> Slow query log, especially with long-long-format turned on, isn't made for 
manual browsing anyway.
AP> You'll have to use mysqldumpslow or some custom-made script to analyze it.
AP> Queries that don't have 'where' are easy to filter then.

AP>  


AP> Also, is it better to do :
AP> SELECT ID, Element FROM tblentries;
AP> or
AP> SELECT ID, Element FROM tblentries WHERE ID > 0;

AP> (In this last case, it won't be logged in the slow query log beause it uses 
an index...)

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


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Slow Queries Log and Index-less queries

2005-08-30 Thread Alexey Polyakov
> 
> 
> 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


Slow Queries Log and Index-less queries

2005-08-30 Thread HMax
Hey list,

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 ?

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

Thank you,
HMax



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]