mysql優化 - 如何解釋mysql主鍵太長導致secondary indexes使用更多空間的問題, 如用uuid當主鍵導致這個問題
过去多啦不再A梦
过去多啦不再A梦 2017-05-18 10:53:33
0
1
811

我是看了美團的文章 : http://tech.meituan.com/MT_Le... 想到的, 不太懂

mysql官方原話是:

If the primary key is long, the secondary indexes use more space, so it is advantageous to have a short primary key

例如 uuid 當主鍵, 主鍵空間就變大了, 為啥會導致secondary indexes空間佔用也大呢, 搞不明白

过去多啦不再A梦
过去多啦不再A梦

全部回覆(1)
習慣沉默

All indexes other than the clustered index are known as secondary indexes. In InnoDB, each record in a secondary index contains the primary key columns for the row, as well as the columns specified for the seconda ns for the row, as well as the columns specified for the seconda ns for the row as well as the columns specified for the secry sindex. search for the row in the clustered index.

這個是官方文件中的,意思是secondary index也會包含primary,所以你主鍵越大,secondary indexes空間佔用也越大

參考:https://dev.mysql.com/doc/ref...

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!