索引表中的每一列 [英] Indexing every column in a table

查看:104
本文介绍了索引表中的每一列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个关于MySQL索引的问题:

I have a couple of questions regarding MySQL indexing:

1)索引存储在内存中的表时是否有任何速度提升?

1) Is there any speed increase when indexing a table stored in memory?

2)当我搜索我的表时,我在列字段上匹配,是否会将每列索引化为索引的目的?

2) When searching my table I match on column field, would indexing every column defeat the purpose of an index?

非常感谢。

推荐答案

对基于内存或文件系统的任何表建立索引,将加快基于该列选择或排序结果的查询。这是因为索引的工作方式类似于树结构,搜索距离取决于树,它比列的行数增加了很多(对数)。

Indexing any table, either memory or file system based, will speed up queries that select or sort results based on that column. This is because the index works like a tree structure and the search distance depends on the depth of the tree, which increases a lot slower than the row count of the column (logarithmic).

索引每一列并不会破坏索引的目的,但它会慢下来插入和更新,因为这些更改将导致更新该表的每个索引。此外,索引会占用数据库服务器上的空间,因此这是另一个需要考虑的缺点。

Indexing every column does not defeat the purpose of the index, but it will slow up inserts and updates because those changes will cause an update of every index of that table. Also, the indexes take up space on the database server, so that is another drawback to be considered.

与此问题相关的其他SO问题:

Other SO questions to read relating to this question:

编制索引的最佳做法

什么是索引
b $ b 有多少索引就够了

这篇关于索引表中的每一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆