MySQL的KEY的'_idx'后缀是什么? [英] What is the '_idx' suffix for on KEY for MySQL?
问题描述
尝试搜索此内容,但找不到任何可以帮助我理解的东西。
例如在CodeIgniter的Session表创建查询中,有一行:
KEY`last_activity_idx`(`last_activity`)
$ b $
这是做什么用的?
这意味着对 last_activity
列建立了索引,索引的名称为 last_activity_idx
。索引意味着运行基于该字段的条件查询会更快。
例如,如果您运行以下查询:
选择*从`session_table`那里`last_activity` = 1000
如果该列未建立索引,MySQL将不得不搜索每一行以检查该列的值。如果对该列进行了索引,则MySQL能够更快地找到与该列匹配的行。
https://dev.mysql.com/doc/refman/5.5/en/optimization-indexes.html
Tried searching for this but couldn't find anything that helped me understand.
In CodeIgniter's Session table creation query for example, there's a line:
KEY `last_activity_idx` (`last_activity`)
that comes after defining the column 'last_activity'.
What's this for?
That means the column last_activity
is indexed, and the name of the index is last_activity_idx
. An index means that running conditional queries based on that field will be faster.
For example, if you run a query like:
SELECT * FROM `session_table` WHERE `last_activity` = 1000
If the column is not indexed, MySQL will have to search through every row to check the value of that column. If that column is indexed, MySQL is able to more quickly find rows which match that column.
https://dev.mysql.com/doc/refman/5.5/en/optimization-indexes.html
这篇关于MySQL的KEY的'_idx'后缀是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!