MySQL Forums
Forum List  »  Optimizer & Parser

sql_no_cache added by the optimizer
Posted by: alan langridge
Date: March 08, 2007 12:32PM

Hi,

Can anyone answer why the optimizer sometimes adds a "sql_no_cache" to a query, and what rules does it use to decide to do this?

An example of this is shown here:

mysql> explain extended select count(*) from db.tbl where dtm < date_sub(current_date(), interval @months month);
+----+-------------+-------+-------+---------------+-------+---------+------+------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+---------------+-------+---------+------+------+--------------------------+
| 1 | SIMPLE | tbl | range | ixDtm | ixDtm | 9 | NULL | 5993 | Using where; Using index |
+----+-------------+-------+-------+---------------+-------+---------+------+------+--------------------------+
1 row in set, 1 warning (0.01 sec)

mysql> show warnings;
+-------+------+--------------------------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+--------------------------------------------------------------------------------------------+
| Note | 1003 | select sql_no_cache count(0) AS `count(*)` from db.tbl where (db.tbl.dtm < 20070208000000) |
+-------+------+--------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

This was done in MySQL 4.1.14 on an InnoDB table.

Thanks,
Alan

Options: ReplyQuote


Subject
Views
Written By
Posted
sql_no_cache added by the optimizer
3533
March 08, 2007 12:32PM


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.