[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"site-config":3,"primary-menu":20,"cat-mysql":99,"catposts-mysql":112,"post-detail-post-mysql-index-btree-61981a83":221},{"config":4,"socialLinks":19},{"title":5,"subtitle":6,"logoUrl":7,"faviconUrl":8,"footerText":9,"beianIcp":10,"beianPublicSecurity":9,"seoDescription":11,"seoKeywords":12,"homepageTitle":13,"homepageSubtitle":14,"analyticsHeadCode":15,"planetQrcodeUrl":16,"planetIntroHtml":9,"planetCtaText":17,"updatedAt":18},"编码世界","用编码改变世界","\u002Fupload\u002F2026\u002F09\u002F2f277021172f43f6bb34e1c115760b7f.png","\u002Fupload\u002F2026\u002F09\u002Fdcbad022e68c4a729a5dc4997a9bba8a.png","","苏ICP备2026073884号","编码世界（mashangan.com）是面向 Java 后端与 Go 语言的系统化编程教程站：提供\nMyBatis Plus、Lombok、Java 8、IDEA、Docker 等原创图文教程，以及 JVM、并发、\nSpring、MySQL、Redis、消息队列、计算机网络等大厂面试八股题库，另有可落地的\n项目实战系列，帮你从入门到精通。","编码世界,Java教程,Go语言教程,Docker教程,MyBatis Plus教程,Lombok教程, Java 8新特性,IDEA教程,Java面试题,八股文,JVM面试题,Java并发面试题, MySQL面试题,Redis面试题,Spring面试题,消息队列面试题,高并发,分库分表, Netty面试题,计算机网络面试题,AI Agent,RAG,程序员学习路线","Java全栈系统化编程教程","覆盖 MyBatis Plus、Lombok、Java 8、IDEA、Go、Docker 等原创图文教程，配套大厂面试八股题库，从入门到精通，持续更新","\u003Cscript>\nvar _hmt = _hmt || [];\n(function() {\n  var hm = document.createElement(\"script\");\n  hm.src = \"https:\u002F\u002Fhm.baidu.com\u002Fhm.js?f00af7e56d956c02e11efed4131379b0\";\n  var s = document.getElementsByTagName(\"script\")[0]; \n  s.parentNode.insertBefore(hm, s);\n})();\n\u003C\u002Fscript>\n","\u002Fupload\u002F2026\u002F09\u002Fc1a8f5de46584d3eb0bc762c180a5db9.png","扫码加入知识星球","2026-09-29T14:56:02.498693Z",[],{"metadata":21,"spec":24,"menuItems":34},{"name":22,"creationTimestamp":23},"primary","2026-09-12T06:13:55.024154Z",{"displayName":25,"menuItems":26},"主菜单",[27,28,29,30,31,32,33],"88c3f10b-321c-4092-86a8-70db00251b74","menu-item-izrtmxer","c4c814d1-0c2c-456b-8c96-4864965fee94","menu-item-column","menu-item-tools","menu-item-zsxq","menu-item-ocrxlczu",[35,44,54,63,72,81,90],{"displayName":36,"metadata":37,"spec":39,"status":42,"children":43},"首页",{"name":27,"creationTimestamp":38},"2026-09-12T06:13:54.422830Z",{"displayName":36,"href":40,"priority":41,"menuName":22},"\u002F",0,{"displayName":36,"href":40},[],{"displayName":45,"metadata":46,"spec":48,"status":52,"children":53},"Java面试八股",{"name":28,"creationTimestamp":47},"2026-09-13T09:42:02.854891Z",{"displayName":45,"href":49,"target":50,"priority":51,"menuName":22},"\u002Fjava-interview","_self",1,{"displayName":45,"href":49},[],{"displayName":55,"metadata":56,"spec":58,"status":61,"children":62},"文章",{"name":29,"creationTimestamp":57},"2026-09-12T06:13:54.457307Z",{"displayName":55,"href":59,"priority":60,"menuName":22},"\u002Farchives",2,{"displayName":55,"href":59},[],{"displayName":64,"metadata":65,"spec":67,"status":70,"children":71},"项目实战",{"name":30,"creationTimestamp":66},"2026-09-14T00:35:08.138170Z",{"displayName":64,"href":68,"target":50,"priority":69,"menuName":22},"\u002Fcolumn",3,{"displayName":64,"href":68},[],{"displayName":73,"metadata":74,"spec":76,"status":79,"children":80},"在线工具",{"name":31,"creationTimestamp":75},"2026-09-14T00:35:08.171474Z",{"displayName":73,"href":77,"target":50,"priority":78,"menuName":22},"\u002Ftools",4,{"displayName":73,"href":77},[],{"displayName":82,"metadata":83,"spec":85,"status":88,"children":89},"知识星球",{"name":32,"creationTimestamp":84},"2026-09-14T00:35:08.199145Z",{"displayName":82,"href":86,"target":50,"priority":87,"menuName":22},"\u002Fzsxq",5,{"displayName":82,"href":86},[],{"displayName":91,"metadata":92,"spec":94,"status":97,"children":98},"特价云服务器",{"name":33,"creationTimestamp":93},"2026-09-25T15:30:59.201614Z",{"displayName":91,"href":95,"target":50,"priority":96,"menuName":22},"\u002Fserver",6,{"displayName":91,"href":95},[],{"metadata":100,"spec":105,"status":110,"postCount":87},{"name":101,"creationTimestamp":102,"labels":103},"mysql","2026-09-13T09:13:25.545156Z",{"haloweb.section":104},"interview",{"displayName":106,"slug":101,"cover":9,"description":107,"priority":108,"hideFromList":109,"preventParentPostCascadeQuery":109},"MySQL 面试题","MySQL 面试题：索引原理、事务隔离、锁机制、SQL 调优、日志体系与分库分表。",11,false,{"permalink":111,"postCount":87,"visiblePostCount":87},"\u002Fcategories\u002Fmysql",[113,137,158,179,200],{"metadata":114,"spec":117,"status":126,"categories":131},{"name":115,"creationTimestamp":116},"post-mysql-slow-sql-72d516f1","2026-09-13T10:00:56.554547Z",{"title":118,"slug":119,"cover":9,"excerpt":120,"publishTime":122,"categories":123,"tags":124,"priority":41,"pinned":109,"deleted":109,"visible":125,"allowComment":121},"如何排查和优化慢 SQL？","mysql-slow-sql",{"raw":9,"autoGenerate":121},true,"2026-09-13T10:00:56.602215Z",[101],[],"PUBLIC",{"permalink":127,"excerpt":128,"lastModifyTime":129,"phase":130},"\u002Farchives\u002Fmysql-slow-sql","一、排查步骤 开启慢查询日志：slow_query_log = ON，long_query_time = 1。 用 explain 分析执行计划，关注 type、key、rows、Extra。 用 show profile 看各阶段耗时。 二、常见优化 索引：给 where、join、order b","2026-09-16T09:13:50.446266Z","PUBLISHED",[132],{"metadata":133,"spec":135,"status":136,"postCount":87},{"name":101,"creationTimestamp":102,"labels":134},{"haloweb.section":104},{"displayName":106,"slug":101,"cover":9,"description":107,"priority":108,"hideFromList":109,"preventParentPostCascadeQuery":109},{"permalink":111,"postCount":87,"visiblePostCount":87},{"metadata":138,"spec":141,"status":148,"categories":152},{"name":139,"creationTimestamp":140},"post-mysql-mvcc-6bac3675","2026-09-13T10:00:56.263936Z",{"title":142,"slug":143,"cover":9,"excerpt":144,"publishTime":145,"categories":146,"tags":147,"priority":41,"pinned":109,"deleted":109,"visible":125,"allowComment":121},"什么是 MVCC？","mysql-mvcc",{"raw":9,"autoGenerate":121},"2026-09-13T10:00:56.441642Z",[101],[],{"permalink":149,"excerpt":150,"lastModifyTime":151,"phase":130},"\u002Farchives\u002Fmysql-mvcc","一、定义 MVCC（Multi-Version Concurrency Control，多版本并发控制），通过维护数据的多个历史版本，实现读写不阻塞，提高并发性能。 二、实现要素 隐藏字段：每行有 trx_id（创建该版本的事务 ID）和 roll_pointer（指向 undo log 中的上一版","2026-09-16T09:13:48.546617Z",[153],{"metadata":154,"spec":156,"status":157,"postCount":87},{"name":101,"creationTimestamp":102,"labels":155},{"haloweb.section":104},{"displayName":106,"slug":101,"cover":9,"description":107,"priority":108,"hideFromList":109,"preventParentPostCascadeQuery":109},{"permalink":111,"postCount":87,"visiblePostCount":87},{"metadata":159,"spec":162,"status":169,"categories":173},{"name":160,"creationTimestamp":161},"post-mysql-isolation-levels-38ba7e64","2026-09-13T10:00:55.948391Z",{"title":163,"slug":164,"cover":9,"excerpt":165,"publishTime":166,"categories":167,"tags":168,"priority":41,"pinned":109,"deleted":109,"visible":125,"allowComment":121},"MySQL 的四种事务隔离级别？","mysql-isolation-levels",{"raw":9,"autoGenerate":121},"2026-09-13T10:00:56.137691Z",[101],[],{"permalink":170,"excerpt":171,"lastModifyTime":172,"phase":130},"\u002Farchives\u002Fmysql-isolation-levels","一、四种级别（由低到高） 隔离级别 脏读 不可重复读 幻读 READ UNCOMMITTED 可能 可能 可能 READ COMMITTED 否 可能 可能 REPEATABLE READ（InnoDB 默认） 否 否 否（间隙锁） SERIALIZABLE 否 否 否 二、问题解释 脏读：读到其他","2026-09-16T09:13:49.485728Z",[174],{"metadata":175,"spec":177,"status":178,"postCount":87},{"name":101,"creationTimestamp":102,"labels":176},{"haloweb.section":104},{"displayName":106,"slug":101,"cover":9,"description":107,"priority":108,"hideFromList":109,"preventParentPostCascadeQuery":109},{"permalink":111,"postCount":87,"visiblePostCount":87},{"metadata":180,"spec":183,"status":190,"categories":194},{"name":181,"creationTimestamp":182},"post-mysql-transaction-acid-5795447c","2026-09-13T10:00:55.754027Z",{"title":184,"slug":185,"cover":9,"excerpt":186,"publishTime":187,"categories":188,"tags":189,"priority":41,"pinned":109,"deleted":109,"visible":125,"allowComment":121},"事务的 ACID 特性是什么？","mysql-transaction-acid",{"raw":9,"autoGenerate":121},"2026-09-13T10:00:55.826031Z",[101],[],{"permalink":191,"excerpt":192,"lastModifyTime":193,"phase":130},"\u002Farchives\u002Fmysql-transaction-acid","一、原子性（Atomicity） 事务中的操作要么全部成功，要么全部失败回滚。由 undo log 保证：记录修改前的旧值，回滚时反向操作。 二、一致性（Consistency） 事务前后数据满足业务约束。由原子性、隔离性、持久性共同保证，是事务的最终目标。 三、隔离性（Isolation） 并发事","2026-09-16T09:13:49.020776Z",[195],{"metadata":196,"spec":198,"status":199,"postCount":87},{"name":101,"creationTimestamp":102,"labels":197},{"haloweb.section":104},{"displayName":106,"slug":101,"cover":9,"description":107,"priority":108,"hideFromList":109,"preventParentPostCascadeQuery":109},{"permalink":111,"postCount":87,"visiblePostCount":87},{"metadata":201,"spec":204,"status":211,"categories":215},{"name":202,"creationTimestamp":203},"post-mysql-index-btree-61981a83","2026-09-13T10:00:55.574621Z",{"title":205,"slug":206,"cover":9,"excerpt":207,"publishTime":208,"categories":209,"tags":210,"priority":41,"pinned":109,"deleted":109,"visible":125,"allowComment":121},"MySQL 索引为什么用 B+ 树？","mysql-index-btree",{"raw":9,"autoGenerate":121},"2026-09-13T10:00:55.631382Z",[101],[],{"permalink":212,"excerpt":213,"lastModifyTime":214,"phase":130},"\u002Farchives\u002Fmysql-index-btree","一、B+ 树特点 非叶子节点只存索引，不存数据，单节点可容纳更多索引，树更矮。 叶子节点通过双向链表连接，范围查询效率高。 所有数据都在叶子节点，查询路径长度一致，性能稳定。 二、为什么不用 B 树 B 树非叶子节点也存数据，导致单节点索引少、树更高、磁盘 I\u002FO 多；范围查询需要中序遍历，效率低。","2026-09-16T09:13:47.604960Z",[216],{"metadata":217,"spec":219,"status":220,"postCount":87},{"name":101,"creationTimestamp":102,"labels":218},{"haloweb.section":104},{"displayName":106,"slug":101,"cover":9,"description":107,"priority":108,"hideFromList":109,"preventParentPostCascadeQuery":109},{"permalink":111,"postCount":87,"visiblePostCount":87},{"metadata":222,"spec":223,"status":227,"categories":228,"content":234},{"name":202,"creationTimestamp":203},{"title":205,"slug":206,"cover":9,"excerpt":224,"publishTime":208,"categories":225,"tags":226,"priority":41,"pinned":109,"deleted":109,"visible":125,"allowComment":121},{"raw":9,"autoGenerate":121},[101],[],{"permalink":212,"excerpt":213,"lastModifyTime":214,"phase":130},[229],{"metadata":230,"spec":232,"status":233,"postCount":87},{"name":101,"creationTimestamp":102,"labels":231},{"haloweb.section":104},{"displayName":106,"slug":101,"cover":9,"description":107,"priority":108,"hideFromList":109,"preventParentPostCascadeQuery":109},{"permalink":111,"postCount":87,"visiblePostCount":87},{"content":235,"raw":235},"\u003Ch2>一、B+ 树特点\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>非叶子节点只存索引，不存数据，单节点可容纳更多索引，树更矮。\u003C\u002Fli>\n\u003Cli>叶子节点通过双向链表连接，范围查询效率高。\u003C\u002Fli>\n\u003Cli>所有数据都在叶子节点，查询路径长度一致，性能稳定。\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2>二、为什么不用 B 树\u003C\u002Fh2>\n\u003Cp>B 树非叶子节点也存数据，导致单节点索引少、树更高、磁盘 I\u002FO 多；范围查询需要中序遍历，效率低。\u003C\u002Fp>\n\u003Ch2>三、为什么不用哈希\u003C\u002Fh2>\n\u003Cp>哈希等值查询 O(1)，但不支持范围查询、排序、模糊查询，数据库这些场景很多。\u003C\u002Fp>\n\u003Ch2>四、为什么不用红黑树\u003C\u002Fh2>\n\u003Cp>红黑树是二叉树，节点只有两个子节点，数据量大时树很高，磁盘 I\u002FO 次数多。B+ 树是多叉，矮胖，适合磁盘存储。\u003C\u002Fp>"]