【发布时间】:2017-12-23 12:53:00
【问题描述】:
当我尝试使用以下查询更新我的 torrent 表(我的 torrent 站点只允许共享开源内容)时
UPDATE `torrents` SET `leech` = '0', `seed` = '1' WHERE `id` = '26784'
更新仅包含 20,000 条记录的表大约需要 0.5 秒。我的其他查询在不到 0.0478 秒内执行(SELECT 查询)
CREATE TABLE IF NOT EXISTS `torrents` (
`id` int(11) NOT NULL,
`hash_info` varchar(255) NOT NULL,
`category_slug` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`size` bigint(20) NOT NULL,
`age` int(11) NOT NULL,
`description` text NOT NULL,
`trackers` longtext NOT NULL,
`magnet` longtext,
`files` longtext,
`parent_category` int(11) NOT NULL,
`category` int(11) NOT NULL,
`publish_date` int(11) DEFAULT NULL,
`uploader` int(11) NOT NULL,
`seed` int(11) DEFAULT '0',
`leech` int(11) DEFAULT '0',
`file_key` varchar(255) DEFAULT NULL,
`comments_count` int(11) DEFAULT '0'
) ENGINE=InnoDB AUTO_INCREMENT=26816 DEFAULT CHARSET=latin1;
有什么办法吗?
【问题讨论】:
-
赞成表名
torrents;) .. 世界不会在 0.5 秒内结束,可以忽略不计。一些外部因素可能是原因 -
我的其他查询在不到 0.0478 秒内执行,所以我认为这是问题;)
-
这里
20.000是20还是20000 -
对不起,我的意思是 20000
-
那么您可以在
id列上创建索引以减少所花费的时间..
标签: mysql sql database mariadb