国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

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

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

瀏覽:127日期: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...

主站蜘蛛池模板: 定边县| 开封县| 台北县| 盐山县| 柞水县| 霍山县| 云和县| 高安市| 元谋县| 文登市| 麻栗坡县| 微山县| 靖西县| 广东省| 平塘县| 莱芜市| 永川市| 北海市| 中西区| 仁化县| 永川市| 秦皇岛市| 咸丰县| 双峰县| 安庆市| 石门县| 铁力市| 玛纳斯县| 韩城市| 襄汾县| 额济纳旗| 建昌县| 衡水市| 汉中市| 新宁县| 朝阳市| 泾川县| 东乌珠穆沁旗| 山西省| 同江市| 信阳市|