[英]What is the use of Mysql Index key?
Hi I am a newbie to mysql 嗨,我是mysql的新手
Here are my questions: 这是我的问题:
What is the use of Mysql Index key? Mysql索引键有什么用?
Does it make a difference in mysql queries with defining an Index key and without it? 在没有定义索引键的情况下,它在mysql查询中是否有所不同?
Are all primary keys default Index key? 所有主键都是默认的索引键吗?
Thanks a million 太感谢了
1- Defining an index on a column (or set of columns) makes searching on that column (or set) much faster, at the expense of additional disk space. 1-在一个列(或一组列)上定义索引可以使在该列(或一组集)上的搜索变得更快,但会增加磁盘空间。
2- Yes, the difference is that queries using that column will be much faster. 2-是的,不同之处在于使用该列的查询会快得多。
3- Yes, as it's usual to search by the primary key, it makes sense for that column to always be indexed. 3-是的,因为通常使用主键进行搜索,所以始终对该列进行索引是有意义的。
An index is indeed an additional set of records. 索引确实是另一组记录。 Nothing more.
而已。
Things that make indexes access faster are: 使索引访问更快的是:
To know whether or not an index is useful is not so easy to guess (obviously I'm not talking about the primary key) and should be investigated. 要知道索引是否有用并不是一件容易的事(显然我不是在谈论主键),应该进行调查。 Here are some counterparts when it might slow down your operations:
以下是一些可能会减慢您的操作速度的方法:
Now about your question 'Are all primary keys default Index key?', I must say that it is not like this that the optimizer works. 现在关于您的问题“所有主键都是默认的索引键吗?”,我必须说优化器不是这样工作的。 When there are various indexes defined in a table, the more efficient index combination will be compiled with on the fly datas and some other static datas (indexes statistics), in order to reach the best performances.
当表中定义了各种索引时,将使用动态数据和一些其他静态数据(索引统计信息)来编译更有效的索引组合,以达到最佳性能。 There's no default index per se, every situation leeds to a different result.
本身没有默认索引,每种情况都会导致不同的结果。
Regards. 问候。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.