{"id":229,"date":"2026-09-06T00:42:50","date_gmt":"2026-09-05T16:42:50","guid":{"rendered":"https:\/\/www.ziliaochi.cn\/index.php\/2026\/09\/06\/bptree-vs-lsmtree\/"},"modified":"2026-09-06T01:30:39","modified_gmt":"2026-09-05T17:30:39","slug":"bptree-vs-lsmtree","status":"publish","type":"post","link":"https:\/\/www.ziliaochi.cn\/index.php\/2026\/09\/06\/bptree-vs-lsmtree\/","title":{"rendered":"\u4e3a\u4ec0\u4e48 MySQL \u7528 B+Tree \u800c\u5206\u5e03\u5f0f KV \u7528 LSM-Tree\uff1a\u4ece\u5199\u5165\u65b9\u5f0f\u8bb2\u8d77"},"content":{"rendered":"<div style=\"font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;font-size:16.5px;line-height:1.9;color:#35435c;letter-spacing:.2px\">\n<div style=\"background:linear-gradient(135deg,#f5f9ff,#eef5ff);border:1px solid #dce8f8;border-left:4px solid #6d8fb8;border-radius:12px;padding:16px 20px;margin:0 0 24px;font-size:14.5px;color:#3d5570;line-height:2\"><span style=\"display:inline-block;background:#6d8fb8;color:#fff;font-size:12.5px;font-weight:700;padding:3px 10px;border-radius:6px;margin-right:12px;letter-spacing:1px;vertical-align:1px\">\u5173\u952e\u8bcd<\/span>B+Tree\u3001LSM-Tree\u3001\u5b58\u50a8\u5f15\u64ce\u3001\u5199\u653e\u5927\u3001\u8bfb\u653e\u5927\u3001Compaction<\/div>\n<div style=\"background:#fafbfd;border:1px solid #e8edf5;border-radius:12px;padding:18px 22px;margin:0 0 30px\">\n<div style=\"font-size:13.5px;font-weight:700;color:#8a99ae;letter-spacing:2px;margin-bottom:12px\">\u76ee\u5f55<\/div>\n<ol style=\"margin:0;padding-left:20px\">\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-1\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e00\u3001\u6839\u672c\u5206\u6b67\uff1a\u539f\u5730\u66f4\u65b0 vs \u8ffd\u52a0\u5199\u5165<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-2\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e8c\u3001LSM-Tree \u7684\u4e09\u4e2a&#8221;\u653e\u5927&#8221;<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-3\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e09\u3001\u5bf9\u6bd4\u8868<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-4\" style=\"color:#42546e;text-decoration:none;border:none\">\u56db\u3001\u5bf9\u5e94\u5230\u5b9e\u9645\u7cfb\u7edf<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-5\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e94\u3001\u9009\u578b\u5efa\u8bae<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-6\" style=\"color:#42546e;text-decoration:none;border:none\">\u516d\u3001\u4e24\u4e2a\u5e38\u89c1\u8bef\u89e3<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-7\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e03\u3001\u5c0f\u7ed3<\/a><\/li>\n<\/ol>\n<\/div>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><span style=\"font-size:17px;color:#1e2f47\">\u4e3a\u4ec0\u4e48 MySQL \u7528 B+Tree\uff0c\u800c\u5f88\u591a\u5206\u5e03\u5f0f KV \u5b58\u50a8\u7528 LSM-Tree\uff1f\u7b54\u6848\u4e0d\u662f&#8221;\u54ea\u4e2a\u66f4\u5148\u8fdb&#8221;\uff0c\u800c\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u5b83\u4eec\u5bf9\u78c1\u76d8\u7684\u5199\u5165\u65b9\u5f0f\u6839\u672c\u4e0d\u540c\uff0c\u8fdb\u800c\u51b3\u5b9a\u4e86\u5404\u81ea\u9002\u5408\u4ec0\u4e48\u8d1f\u8f7d<\/strong>\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u7406\u89e3\u8fd9\u4e2a\u5dee\u5f02\uff0c\u5f88\u591a\u6570\u636e\u5e93\u7684&#8221;\u5947\u602a\u884c\u4e3a&#8221;\u5c31\u90fd\u80fd\u89e3\u91ca\u4e86\uff1a\u4e3a\u4ec0\u4e48 LSM \u7cfb\u7684\u5e93\u5199\u5165\u5feb\u4f46\u8bfb\u5ef6\u8fdf\u6296\u52a8\uff0c\u4e3a\u4ec0\u4e48 B+Tree \u7cfb\u7684\u8868\u5728\u5927\u91cf\u968f\u673a\u5199\u5165\u540e\u4f1a\u53d8\u6162\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #6d8fb8;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-1\">\u4e00\u3001\u6839\u672c\u5206\u6b67\uff1a\u539f\u5730\u66f4\u65b0 vs \u8ffd\u52a0\u5199\u5165<\/h2>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8fd9\u662f\u4e24\u6761\u8def\u7ebf\u7684\u5206\u6c34\u5cad\u3002<\/p>\n<figure style=\"margin:30px 0;text-align:center\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"900\" src=\"https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/bptree-vs-lsmtree-fig.png\" alt=\"B+Tree \u4e0e LSM-Tree \u5bf9\u6bd4\" class=\"wp-image-228\" style=\"max-width:100%;height:auto;border-radius:12px;border:1px solid #e6ecf4;box-shadow:0 8px 24px rgba(15,30,60,.07)\" srcset=\"https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/bptree-vs-lsmtree-fig.png 1200w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/bptree-vs-lsmtree-fig-300x225.png 300w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/bptree-vs-lsmtree-fig-1024x768.png 1024w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/bptree-vs-lsmtree-fig-768x576.png 768w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/bptree-vs-lsmtree-fig-800x600.png 800w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><figcaption style=\"margin-top:12px;font-size:13.5px;color:#7b8aa0;text-align:center;line-height:1.75\">\u4e24\u79cd\u7d22\u5f15\u7ed3\u6784\u5728\u5199\u5165\u65b9\u5f0f\u3001\u8bfb\u5199\u6027\u80fd\u4e0e\u5178\u578b\u7cfb\u7edf\u4e0a\u7684\u5dee\u5f02<\/figcaption><\/figure>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #6d8fb840\">B+Tree\uff1a\u539f\u5730\u66f4\u65b0<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">B+Tree \u662f\u4e00\u68f5<strong style=\"color:#0f1c2e;font-weight:600\">\u591a\u8def\u5e73\u8861\u641c\u7d22\u6811<\/strong>\uff0c\u6570\u636e\u4e3b\u8981\u5b58\u5728\u53f6\u5b50\u8282\u70b9\uff0c\u53f6\u5b50\u4e4b\u95f4\u7528\u94fe\u8868\u4e32\u8d77\u6765\u3002\u5b83\u7684\u66f4\u65b0\u65b9\u5f0f\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u627e\u5230\u90a3\u6761\u8bb0\u5f55\u5728\u78c1\u76d8\u4e0a\u7684\u4f4d\u7f6e\uff0c\u76f4\u63a5\u6539\u6389<\/strong>\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8fd9\u4e2a\u6a21\u578b\u5f88\u7b26\u5408\u76f4\u89c9\uff0c\u4e5f\u5e26\u6765\u51e0\u4e2a\u76f4\u63a5\u4f18\u52bf\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">\u8bfb\u8def\u5f84\u77ed\u4e14\u7a33\u5b9a<\/strong>\u2014\u2014\u4ece\u6839\u5230\u53f6\u5b50\u6700\u591a\u4e09\u56db\u5c42\uff0c\u4e14\u56e0\u4e3a\u6709\u7f13\u5b58\uff0c\u5b9e\u9645 IO \u6b21\u6570\u66f4\u5c11\uff1b<strong style=\"color:#0f1c2e;font-weight:600\">\u8303\u56f4\u67e5\u8be2\u6781\u5feb<\/strong>\u2014\u2014\u53f6\u5b50\u8282\u70b9\u672c\u8eab\u6709\u5e8f\u4e14\u76f8\u8fde\uff0c\u626b\u4e00\u6bb5\u533a\u95f4\u5c31\u662f\u987a\u5e8f\u8bfb\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u4ee3\u4ef7\u5728\u5199\u5165\u3002\u968f\u673a\u4e3b\u952e\u5199\u5165\u610f\u5473\u7740<strong style=\"color:#0f1c2e;font-weight:600\">\u6bcf\u6b21\u4fee\u6539\u90fd\u53ef\u80fd\u843d\u5728\u78c1\u76d8\u7684\u4e0d\u540c\u4f4d\u7f6e<\/strong>\uff0c\u4ea7\u751f\u968f\u673a IO\u3002\u66f4\u9ebb\u70e6\u7684\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u9875\u5206\u88c2<\/strong>\uff1a\u5f53\u4e00\u4e2a\u6570\u636e\u9875\u5199\u6ee1\uff0c\u8981\u5206\u88c2\u6210\u4e24\u4e2a\u9875\u5e76\u8c03\u6574\u7236\u8282\u70b9\uff0c\u8fd9\u662f\u76f8\u5f53\u6602\u8d35\u7684\u64cd\u4f5c\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #6d8fb840\">LSM-Tree\uff1a\u8ffd\u52a0\u5199\u5165<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">LSM-Tree \u7684\u601d\u8def\u5b8c\u5168\u4e0d\u540c\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">\u6240\u6709\u5199\u5165\u90fd\u662f\u8ffd\u52a0<\/strong>\u3002\u65b0\u6570\u636e\u5148\u5199 WAL\uff08\u4fdd\u8bc1\u6301\u4e45\u6027\uff09\uff0c\u518d\u8fdb\u5185\u5b58\u91cc\u7684 MemTable\uff1bMemTable \u6ee1\u4e86\u5c31<strong style=\"color:#0f1c2e;font-weight:600\">\u6574\u4f53\u5237\u6210\u4e00\u4e2a\u4e0d\u53ef\u53d8\u7684 SSTable \u6587\u4ef6<\/strong>\u843d\u5230\u78c1\u76d8\u3002\u78c1\u76d8\u4e0a\u7684\u6587\u4ef6\u4ece\u4e0d\u539f\u5730\u4fee\u6539\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8fd9\u4e2a\u8bbe\u8ba1\u628a<strong style=\"color:#0f1c2e;font-weight:600\">\u968f\u673a\u5199\u53d8\u6210\u4e86\u987a\u5e8f\u5199<\/strong>\u2014\u2014\u5bf9\u673a\u68b0\u76d8\u662f\u6570\u91cf\u7ea7\u7684\u6027\u80fd\u5dee\u5f02\uff0c\u5bf9 SSD \u4e5f\u663e\u8457\u51cf\u5c11\u5199\u653e\u5927\u3002\u5199\u5165\u541e\u5410\u56e0\u6b64\u8fdc\u9ad8\u4e8e B+Tree\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u4ee3\u4ef7\u88ab\u8f6c\u79fb\u5230\u4e86\u4e09\u4e2a\u5730\u65b9\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">\u8bfb\u653e\u5927\u3001\u7a7a\u95f4\u653e\u5927\u3001\u5199\u653e\u5927\uff08\u7531 compaction \u5f15\u8d77\uff09<\/strong>\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #6d8fb8;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-2\">\u4e8c\u3001LSM-Tree \u7684\u4e09\u4e2a&#8221;\u653e\u5927&#8221;<\/h2>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8fd9\u662f\u7406\u89e3 LSM \u884c\u4e3a\u7279\u5f81\u7684\u5173\u952e\uff0c\u4e5f\u662f\u9762\u8bd5\u548c\u7ebf\u4e0a\u8c03\u4f18\u7684\u9ad8\u9891\u8003\u70b9\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #6d8fb840\">1. \u8bfb\u653e\u5927<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u4e00\u6761\u8bb0\u5f55\u53ef\u80fd\u5b58\u5728<strong style=\"color:#0f1c2e;font-weight:600\">\u591a\u4e2a SSTable \u6587\u4ef6\u91cc<\/strong>\uff08\u6bcf\u6b21\u66f4\u65b0\u90fd\u4ea7\u751f\u65b0\u7248\u672c\uff09\u3002\u67e5\u8be2\u65f6\u8981\u4ece\u6700\u65b0\u7684 MemTable \u5f00\u59cb\uff0c\u9010\u5c42\u5f80\u8001\u7684\u6587\u4ef6\u627e\uff0c\u76f4\u5230\u627e\u5230\u4e3a\u6b62\u3002\u5c42\u6570\u8d8a\u591a\uff0c\u8bfb\u4e00\u6b21\u53ef\u80fd\u8981\u78b0\u7684\u6587\u4ef6\u6570\u5c31\u8d8a\u591a\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u4e24\u4e2a\u6807\u51c6\u7f13\u89e3\u624b\u6bb5\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">Bloom Filter<\/strong>\uff08\u5feb\u901f\u5224\u65ad&#8221;\u8fd9\u4e2a\u6587\u4ef6\u80af\u5b9a\u6ca1\u6709\u8fd9\u4e2a key&#8221;\uff0c\u76f4\u63a5\u8df3\u8fc7\uff09\u548c<strong style=\"color:#0f1c2e;font-weight:600\">\u5757\u7f13\u5b58<\/strong>\u3002\u8fd9\u4e24\u4e2a\u7ec4\u4ef6\u505a\u5f97\u597d\u4e0d\u597d\uff0c\u76f4\u63a5\u51b3\u5b9a\u4e86\u4e00\u4e2a LSM \u5f15\u64ce\u7684\u5b9e\u9645\u8bfb\u6027\u80fd\u3002\u4ee5 RocksDB \u4e3a\u4f8b\uff0c\u8fd9\u4e24\u4e2a\u65cb\u94ae\u901a\u5e38\u662f\u8c03\u4f18\u7684\u7b2c\u4e00\u7ad9\uff1a<\/p>\n<pre style=\"background:#0f1a2b;color:#dbe6f5;border-radius:12px;padding:18px 20px;overflow-x:auto;font-size:13.6px;line-height:1.78;margin:22px 0;border:1px solid #1e2c42;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace\"><code style=\"background:none;border:none;color:inherit;padding:0;font-size:inherit;font-family:inherit\">\/\/ RocksDB\uff1a\u8bfb\u653e\u5927\u6cbb\u7406\u7684\u4e24\u4e2a\u5173\u952e\u914d\u7f6e\noptions.optimize_filters_for_hits = true;  \/\/ \u70ed\u70b9\u6570\u636e\u4f18\u5148\u547d\u4e2d Bloom Filter\noptions.bloom_locality = 1;                \/\/ \u63d0\u9ad8 filter \u7684\u7f13\u5b58\u5c40\u90e8\u6027\n\n\/\/ BlockBasedTable \u5c42\u9762\uff1a\u7f13\u5b58\u547d\u4e2d\u51b3\u5b9a\u70b9\u67e5\u5ef6\u8fdf\nBlockBasedTableOptions table;\ntable.block_cache = NewLRUCache(4ULL * 1024 * 1024 * 1024); \/\/ 4GB \u5757\u7f13\u5b58\ntable.filter_policy.reset(NewBloomFilterPolicy(10));        \/\/ 10 \u4f4d\/\u952e\noptions.table_factory.reset(NewBlockBasedTableFactory(table));<\/code><\/pre>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #6d8fb840\">2. \u7a7a\u95f4\u653e\u5927<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u540c\u4e00\u6761\u8bb0\u5f55\u7684\u591a\u4e2a\u7248\u672c\u3001\u4ee5\u53ca\u88ab\u5220\u9664\u8bb0\u5f55\u7559\u4e0b\u7684\u5893\u7891\u6807\u8bb0\uff0c\u90fd\u8981\u7b49\u5230 <strong style=\"color:#0f1c2e;font-weight:600\">compaction<\/strong>\uff08\u540e\u53f0\u5408\u5e76\uff09\u65f6\u624d\u88ab\u6e05\u7406\u3002\u8fd9\u610f\u5473\u7740<strong style=\"color:#0f1c2e;font-weight:600\">\u5b9e\u9645\u5360\u7528\u7684\u78c1\u76d8\u7a7a\u95f4\u53ef\u4ee5\u8fdc\u5927\u4e8e\u6709\u6548\u6570\u636e\u91cf<\/strong>\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u89c4\u5212\u5bb9\u91cf\u65f6\u5fc5\u987b\u628a\u8fd9\u4e2a\u7cfb\u6570\u7b97\u8fdb\u53bb\u3002\u5199\u591a\u8bfb\u5c11\u3001\u4e14\u66f4\u65b0\u9891\u7e41\u7684\u4e1a\u52a1\uff0c\u7a7a\u95f4\u653e\u5927\u53ef\u80fd\u975e\u5e38\u53ef\u89c2\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #6d8fb840\">3. \u5199\u653e\u5927<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">compaction \u8981\u628a\u591a\u4e2a SSTable \u8bfb\u51fa\u6765\u3001\u5408\u5e76\u6392\u5e8f\u3001\u518d\u5199\u56de\u53bb\u3002<strong style=\"color:#0f1c2e;font-weight:600\">\u540c\u4e00\u6761\u6570\u636e\u53ef\u80fd\u88ab\u53cd\u590d\u8bfb\u5199\u591a\u8f6e<\/strong>\u2014\u2014\u8fd9\u5c31\u662f\u5199\u653e\u5927\uff1a\u4e1a\u52a1\u5199\u4e86\u4e00\u4efd\uff0c\u78c1\u76d8\u4e0a\u5b9e\u9645\u5199\u4e86\u597d\u51e0\u4efd\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8fd9\u4e5f\u662f LSM \u7cfb\u6570\u636e\u5e93<strong style=\"color:#0f1c2e;font-weight:600\">\u5ef6\u8fdf\u6296\u52a8<\/strong>\u7684\u6839\u6e90\uff1acompaction \u662f\u540e\u53f0\u8dd1\u7684\uff0c\u4f46\u5b83\u62a2\u5360 IO \u548c CPU \u8d44\u6e90\u3002\u8868\u73b0\u5c31\u662f\u5e73\u65f6\u54cd\u5e94\u5f88\u5feb\uff0c\u6bcf\u9694\u4e00\u6bb5\u65f6\u95f4\u7a81\u7136\u51fa\u73b0\u4e00\u6279\u6162\u8bf7\u6c42\u3002\u5bf9 SSD \u6765\u8bf4\uff0c\u5199\u653e\u5927\u8fd8\u76f4\u63a5\u5f71\u54cd\u76d8\u7684\u4f7f\u7528\u5bff\u547d\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #6d8fb8;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-3\">\u4e09\u3001\u5bf9\u6bd4\u8868<\/h2>\n<ul style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u5199\u5165\u541e\u5410<\/strong>\uff1aLSM-Tree \u660e\u663e\u66f4\u9ad8\uff08\u987a\u5e8f\u5199\uff09\uff1bB+Tree \u5728\u968f\u673a\u5199\u573a\u666f\u4e0b\u53d7\u9875\u5206\u88c2\u62d6\u7d2f\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u70b9\u67e5\u5ef6\u8fdf<\/strong>\uff1aB+Tree \u66f4\u7a33\u5b9a\u4e14\u53ef\u9884\u6d4b\uff1bLSM-Tree \u5e73\u5747\u66f4\u4f4e\u4f46<strong style=\"color:#0f1c2e;font-weight:600\">\u957f\u5c3e\u660e\u663e<\/strong>\uff08\u53d7\u5c42\u6570\u4e0e compaction \u5f71\u54cd\uff09\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u8303\u56f4\u67e5\u8be2<\/strong>\uff1aB+Tree \u539f\u751f\u5360\u4f18\uff1bLSM-Tree \u9700\u8981\u8de8\u591a\u4e2a\u6587\u4ef6\u5f52\u5e76\uff0c\u4ee3\u4ef7\u66f4\u9ad8\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u7a7a\u95f4\u5360\u7528<\/strong>\uff1aB+Tree \u66f4\u7d27\u51d1\uff1bLSM-Tree \u5b58\u5728\u7a7a\u95f4\u653e\u5927\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u8bfb\u53d6\u4e00\u81f4\u6027<\/strong>\uff1aB+Tree \u8bfb\u5230\u7684\u4e00\u5b9a\u662f\u6700\u65b0\u503c\uff1bLSM-Tree \u8981\u6309\u5c42\u67e5\u627e\uff0c\u4f9d\u8d56\u7248\u672c\u987a\u5e8f\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u8fd0\u7ef4\u590d\u6742\u5ea6<\/strong>\uff1aB+Tree \u76f8\u5bf9&#8221;\u7701\u5fc3&#8221;\uff1bLSM-Tree \u9700\u8981\u8c03 compaction \u7b56\u7565\uff0c\u662f\u6301\u7eed\u7684\u8c03\u4f18\u5de5\u4f5c\u3002<\/li>\n<\/ul>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #6d8fb8;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-4\">\u56db\u3001\u5bf9\u5e94\u5230\u5b9e\u9645\u7cfb\u7edf<\/h2>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u7406\u89e3\u4e86\u8fd9\u4e2a\u6846\u67b6\uff0c\u518d\u770b\u5177\u4f53\u4ea7\u54c1\u5c31\u6e05\u695a\u4e86\uff1a<\/p>\n<ul style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">MySQL InnoDB<\/strong> \u7684\u805a\u7c07\u7d22\u5f15\u662f\u5178\u578b B+Tree\uff0c\u56e0\u6b64\u5b83\u5728<strong style=\"color:#0f1c2e;font-weight:600\">\u8bfb\u591a\u5199\u5c11\u3001\u9700\u8981\u5927\u91cf\u8303\u56f4\u626b\u63cf\u548c\u4e8b\u52a1<\/strong>\u7684 OLTP \u573a\u666f\u4e0b\u8868\u73b0\u7a33\u5065\u3002\u5b83\u7684\u74f6\u9888\u5728\u5927\u91cf\u968f\u673a\u5199\u5165\u65f6\u7684\u9875\u5206\u88c2\u4e0e\u5237\u76d8\u538b\u529b\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">RocksDB<\/strong> \u662f LSM-Tree \u7684\u4ee3\u8868\u5b9e\u73b0\uff0c\u88ab\u5927\u91cf\u5206\u5e03\u5f0f\u7cfb\u7edf\u7528\u4f5c\u5b58\u50a8\u5f15\u64ce\uff0c\u9002\u5408<strong style=\"color:#0f1c2e;font-weight:600\">\u5199\u541e\u5410\u8981\u6c42\u9ad8\u3001\u8bfb\u4ee5\u70b9\u67e5\u4e3a\u4e3b<\/strong>\u7684\u573a\u666f\u3002\u4f7f\u7528\u65f6\u7ed5\u4e0d\u5f00 compaction \u8c03\u4f18\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">PostgreSQL<\/strong> \u7684\u5806\u8868 + B+Tree \u7d22\u5f15\u662f\u53e6\u4e00\u79cd\u7ec4\u5408\uff1a\u6570\u636e\u5b58\u5728\u5806\u91cc\uff0c\u7d22\u5f15\u662f\u72ec\u7acb\u7684 B+Tree\u3002\u8fd9\u4e2a\u8bbe\u8ba1\u5728\u66f4\u65b0\u9891\u7e41\u65f6\u4f1a\u4ea7\u751f\u8868\u81a8\u80c0\uff08\u9700\u8981 VACUUM \u6e05\u7406\uff09\uff0c\u672c\u8d28\u4e0a\u4e5f\u662f\u4e00\u79cd&#8221;\u7248\u672c\u5806\u79ef&#8221;\u95ee\u9898\u3002<\/li>\n<\/ul>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #6d8fb8;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-5\">\u4e94\u3001\u9009\u578b\u5efa\u8bae<\/h2>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u4e0d\u8981\u95ee&#8221;\u54ea\u4e2a\u66f4\u597d&#8221;\uff0c\u95ee\u4e0b\u9762\u4e09\u4e2a\u95ee\u9898\uff1a<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #6d8fb840\">1. \u8bfb\u5199\u6bd4\u4f8b\u548c\u8bbf\u95ee\u6a21\u5f0f\u662f\u4ec0\u4e48\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u8bfb\u591a\u3001\u8303\u56f4\u67e5\u8be2\u591a\u3001\u8981\u6c42\u5ef6\u8fdf\u7a33\u5b9a<\/strong>\u2192 B+Tree \u7cfb\u66f4\u7701\u5fc3\u3002<br \/>\n<strong style=\"color:#0f1c2e;font-weight:600\">\u5199\u541e\u5410\u6781\u9ad8\u3001\u4ee5\u70b9\u67e5\u4e3a\u4e3b\u3001\u80fd\u63a5\u53d7\u5ef6\u8fdf\u6296\u52a8<\/strong>\u2192 LSM-Tree \u7cfb\u66f4\u5408\u9002\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #6d8fb840\">2. \u6709\u6ca1\u6709\u80fd\u529b\u505a\u6301\u7eed\u8c03\u4f18\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8fd9\u662f\u6700\u73b0\u5b9e\u7684\u4e00\u4e2a\u95ee\u9898\u3002LSM-Tree \u7684\u6027\u80fd<strong style=\"color:#0f1c2e;font-weight:600\">\u9ad8\u5ea6\u4f9d\u8d56 compaction \u7b56\u7565\u4e0e\u786c\u4ef6\u5339\u914d<\/strong>\uff0c\u9700\u8981\u6709\u4eba\u6301\u7eed\u770b\u6307\u6807\u3001\u8c03\u53c2\u6570\u3002<strong style=\"color:#0f1c2e;font-weight:600\">\u6ca1\u6709\u8fd9\u4e2a\u4eba\u529b\uff0c\u9009 B+Tree \u7cfb\u4f1a\u66f4\u7a33\u3002<\/strong><\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #6d8fb840\">3. \u5b58\u50a8\u6210\u672c\u654f\u611f\u5417\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u5982\u679c\u6570\u636e\u91cf\u5f88\u5927\u4e14\u9884\u7b97\u654f\u611f\uff0c<strong style=\"color:#0f1c2e;font-weight:600\">LSM \u7684\u7a7a\u95f4\u653e\u5927\u662f\u5b9e\u6253\u5b9e\u7684\u6210\u672c<\/strong>\uff0c\u8981\u6309\u653e\u5927\u7cfb\u6570\u89c4\u5212\u5bb9\u91cf\uff0c\u4e0d\u80fd\u6309\u6709\u6548\u6570\u636e\u91cf\u7b97\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #6d8fb8;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-6\">\u516d\u3001\u4e24\u4e2a\u5e38\u89c1\u8bef\u89e3<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #6d8fb840\">\u8bef\u89e3\u4e00\uff1aLSM-Tree \u5199\u5165\u5feb\uff0c\u6240\u4ee5\u4ec0\u4e48\u90fd\u5feb<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">LSM \u4f18\u5316\u7684\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u5199\u541e\u5410<\/strong>\uff0c\u4ee3\u4ef7\u662f\u8bfb\u8def\u5f84\u53d8\u957f\u548c\u540e\u53f0 compaction \u7684\u8d44\u6e90\u5360\u7528\u3002\u628a\u5b83\u7528\u5728\u8bfb\u5bc6\u96c6\u3001\u4e14\u5bf9\u5ef6\u8fdf\u7a33\u5b9a\u6027\u8981\u6c42\u9ad8\u7684\u573a\u666f\uff0c\u4f1a\u5f97\u5230\u6bd4 B+Tree \u66f4\u5dee\u7684\u7ed3\u679c\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #6d8fb840\">\u8bef\u89e3\u4e8c\uff1aB+Tree \u4e00\u5b9a\u6bd4 LSM \u66f4\u5360\u7a7a\u95f4<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u901a\u5e38 B+Tree \u66f4\u7d27\u51d1\uff0c\u4f46<strong style=\"color:#0f1c2e;font-weight:600\">B+Tree \u4e5f\u6709\u788e\u7247\u95ee\u9898<\/strong>\uff1a\u5927\u91cf\u5220\u9664\u548c\u66f4\u65b0\u540e\uff0c\u9875\u5185\u4f1a\u51fa\u73b0\u7a7a\u6d1e\uff0c\u9700\u8981\u91cd\u5efa\u8868\u6765\u56de\u6536\u7a7a\u95f4\u3002\u4e24\u7c7b\u7ed3\u6784\u53ea\u662f&#8221;\u653e\u5927&#8221;\u7684\u8868\u73b0\u5f62\u5f0f\u4e0d\u540c\u2014\u2014\u4e00\u4e2a\u662f\u7248\u672c\u5806\u79ef\uff0c\u4e00\u4e2a\u662f\u9875\u5185\u788e\u7247\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #6d8fb8;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-7\">\u4e03\u3001\u5c0f\u7ed3<\/h2>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">B+Tree \u548c LSM-Tree \u7684\u5206\u91ce\uff0c\u672c\u8d28\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u628a\u590d\u6742\u5ea6\u653e\u5728\u8bfb\u8def\u5f84\u8fd8\u662f\u5199\u8def\u5f84<\/strong>\uff1aB+Tree \u4fdd\u6301\u4e86\u8bfb\u7684\u7b80\u5355\uff0c\u628a\u4ee3\u4ef7\u7559\u7ed9\u4e86\u968f\u673a\u5199\uff1bLSM-Tree \u628a\u5199\u53d8\u6210\u987a\u5e8f\uff0c\u628a\u4ee3\u4ef7\u8f6c\u79fb\u7ed9\u8bfb\u653e\u5927\u548c\u540e\u53f0\u5408\u5e76\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8fd1\u5e74\u4e5f\u51fa\u73b0\u4e86\u4e0d\u5c11<strong style=\"color:#0f1c2e;font-weight:600\">\u6df7\u5408\u7ed3\u6784<\/strong>\u7684\u5c1d\u8bd5\uff08\u5728 LSM \u7684\u67d0\u4e9b\u5c42\u5f15\u5165 B+Tree\uff0c\u6216\u53cd\u8fc7\u6765\uff09\uff0c\u76ee\u7684\u90fd\u662f\u5728\u4e24\u8005\u4e4b\u95f4\u627e\u5e73\u8861\u70b9\u3002\u4f46\u5e95\u5c42\u6743\u8861\u6ca1\u6709\u53d8\u2014\u2014<strong style=\"color:#0f1c2e;font-weight:600\">\u590d\u6742\u5ea6\u4e0d\u4f1a\u6d88\u5931\uff0c\u53ea\u4f1a\u88ab\u642c\u8d70\u3002<\/strong>\u7406\u89e3\u5b83\u88ab\u642c\u5230\u4e86\u54ea\u91cc\uff0c\u5c31\u662f\u7406\u89e3\u4e00\u4e2a\u5b58\u50a8\u5f15\u64ce\u7684\u5f00\u59cb\u3002<\/p>\n<div style=\"margin:42px 0 0;padding:22px 0 0;border-top:1px solid #eaeef4\">\n<div style=\"font-size:13px;color:#93a1b5;letter-spacing:1px;margin-bottom:12px\">\u6807\u7b7e<\/div>\n<p><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#\u5b58\u50a8\u5f15\u64ce<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#B+Tree<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#LSM-Tree<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#\u8ba1\u7b97\u673a\u57fa\u7840<\/span><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u7406\u89e3 B+Tree \u4e0e LSM-Tree \u7684\u6839\u672c\u5206\u6b67\uff0c\u5f88\u591a\u6570\u636e\u5e93\u7684\u5947\u602a\u884c\u4e3a\u5c31\u90fd\u80fd\u89e3\u91ca\u4e86\uff1a\u4e3a\u4ec0\u4e48 LSM \u7cfb\u7684\u5e93\u5199\u5165\u5feb\u4f46\u8bfb\u5ef6\u8fdf\u6296\u52a8\uff0c\u4e3a\u4ec0\u4e48 B+Tree \u7cfb\u7684\u8868\u5728\u5927\u91cf\u968f\u673a\u5199\u5165\u540e\u4f1a\u81a8\u80c0\u3002\u672c\u6587\u4ece\u539f\u5730\u66f4\u65b0\u4e0e\u8ffd\u52a0\u5199\u5165\u8bb2\u8d77\uff0c\u7ed9\u51fa\u9009\u578b\u5efa\u8bae\u5e76\u6f84\u6e05\u4e24\u4e2a\u5e38\u89c1\u8bef\u89e3\u3002<\/p>\n","protected":false},"author":1,"featured_media":227,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,9],"tags":[110,111,109,62],"class_list":["post-229","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical","category-computer-basics","tag-btree","tag-lsm-tree","tag-109","tag-62"],"_links":{"self":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts\/229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/comments?post=229"}],"version-history":[{"count":1,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts\/229\/revisions"}],"predecessor-version":[{"id":337,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts\/229\/revisions\/337"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/media\/227"}],"wp:attachment":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/media?parent=229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/categories?post=229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/tags?post=229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}