久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

mysql優(yōu)化 - 如何解釋mysql主鍵太長導致secondary indexes使用更多空間的問題, 如用uuid當主鍵導致這個問題

瀏覽:125日期:2022-06-12 16:21:57

問題描述

我是看了美團的文章 : 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空間占用也大呢, 搞不明白

問題解答

回答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 secondary index. InnoDB uses this primary key value to search for the row in the clustered index.

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

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

主站蜘蛛池模板: 漠河县| 青铜峡市| 玉田县| 六枝特区| 永城市| 湄潭县| 东至县| 儋州市| 安陆市| 成武县| 远安县| 怀化市| 阜城县| 甘谷县| 宝丰县| 寿阳县| 安义县| 依兰县| 图木舒克市| 合肥市| 五指山市| 南宫市| 大城县| 永平县| 安国市| 昆山市| 万安县| 汶川县| 康乐县| 略阳县| 秀山| 佛学| 黑龙江省| 大丰市| 铜陵市| 英吉沙县| 斗六市| 岳阳市| 德安县| 格尔木市| 鹤峰县|