作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下数据库:
CREATE TABLE IF NOT EXISTS `musics` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`active` tinyint(1) NOT NULL DEFAULT '1',
`slug` varchar(50) NOT NULL,
`movie_id` int(11) NOT NULL,
`added` int(11) NOT NULL,
`updated` int(11) NOT NULL,
`featured` tinyint(1) NOT NULL,
`hits` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `slug` (`slug`),
KEY `active` (`active`),
KEY `featured` (`featured`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3339 ;
查询 UPDATE musics SET attempts = 7 WHERE id = '1770'
在音乐专辑的每个页面加载时运行。有什么办法可以优化这个查询吗?
最佳答案
示例..
set global long_query_time=1;
还有,my.cnf
[mysqld]
...
long_query_time=1;
您可以使用“解释”。
explain select * from musics where id = 1770;
关于mysql - 为什么这个查询被记录为slow_query?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20377900/
我是一名优秀的程序员,十分优秀!