mysql - 二级关键词搜索的索引结构

标签 mysql indexing database-performance query-performance

我有一个具有以下结构的表格(文章):

id int(10) unsigned not_null auto_increment
title varchar(32)
system_id int(10) unsigned default 0
last_update int(10) unsigned default 0

建议的表索引结构是什么,将为该查询提供最佳性能:

"SELECT * FROM Articles where system_id = {ID} order by last_update desc"

最佳答案

正如所讨论的here ,从 = 列 (system_id) 开始,然后是“range”列 (last_update):

INDEX(system_id, last_update)

关于mysql - 二级关键词搜索的索引结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47917465/

相关文章:

mysql - Mysql表的格式可以保持吗?

mysql - 从具有多对多关系的表中选择

MySQL统计表优化

python - 使用作为字符串一部分的整数迭代 for 循环

mysql - MySQL 中的排序陷入困境

postgresql - Postgres JSONB 唯一约束

Mysql 随机排序特色产品,但按日期对正常产品进行排序

c# - 在多个sql表之间进行选择

oracle - 在空表中执行缓慢的查询。 (删除大量插入后)

SQL Server 查询 : Union vs Distinct union all performance