MySQL why logged as slow query/log-queries-not-usi

2020-07-24 05:50发布

Mysql 5.1.x

in my.cnf:

log-queries-not-using-indexes = 1
long_query_time = 30
and slow queries are logged

Why I show this at log? Not slow and all fields are indexed.

From mysql.slow.log:

# Query_time: 0.001492  Lock_time: 0.000031 Rows_sent: 229  Rows_examined: 458
use database1;
SET timestamp=1393342939;
SELECT id,name FROM database1 ORDER BY name ASC;

This table has 229 rows, MYISAM.

id and name are indexed
id = auto increment int unsigned
name = varchar(255) utf-8

Can you explain why I show this at not indexed/slow query log?

Summary and more information:

MYISAM TABLE, 229 rows, more columns but all, 229 needed with id and name column. Both has index. At query need all 229 rows to show.

I want 2 things:

  • 1.: Don't show that query at slow query/not-using-indexes log.
  • 2.: Make that query fast as possible.

Thanks.

1条回答
欢心
2楼-- · 2020-07-24 06:46

You are doing a literal full scan of the table, since you've got no WHERE predicates to index by.

查看更多
登录 后发表回答