{"id":10006177,"date":"2022-08-11T18:16:02","date_gmt":"2022-08-11T10:16:02","guid":{"rendered":"https:\/\/ityet.com\/?p=10006177"},"modified":"2022-08-11T18:16:02","modified_gmt":"2022-08-11T10:16:02","slug":"%e4%b8%80%e6%96%87%e5%89%96%e6%9e%90polardb-htap%e7%9a%84%e5%88%97%e5%ad%98%e6%95%b0%e6%8d%ae%e5%8e%8b%e7%bc%a9","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006177","title":{"rendered":"\u4e00\u6587\u5256\u6790PolarDB HTAP\u7684\u5217\u5b58\u6570\u636e\u538b\u7f29"},"content":{"rendered":"<p>\u7b80\u4ecb\uff1a\u00a0PolarDB MySQL\u662f\u963f\u91cc\u4e91\u81ea\u7814\u7684\u4e91\u539f\u751f\u6570\u636e\u5e93\uff0c\u4e3b\u8981\u5904\u7406\u5728\u7ebf\u4e8b\u52a1\u8d1f\u8f7d(OLTP, OnLine Transactional Processing)\uff0c\u6df1\u53d7\u4f01\u4e1a\u7528\u6237\u7684\u9752\u7750\u3002\u524d\u8a00\u6570\u636e\u5e93\u8fc1\u79fb\u4e0a\u4e91\u662f\u5927\u6570\u636e\u65f6\u4ee3\u7684\u4e00\u5927\u8d8b\u52bf\uff0cPolarDB MySQL\u662f\u963f\u91cc\u4e91\u81ea\u7814\u7684\u4e91\u539f\u751f\u6570\u636e\u5e93\uff0c\u4e3b\u8981\u5904\u7406\u5728\u7ebf\u4e8b\u52a1\u8d1f\u8f7d(OLTP, OnLine Transactional Processing)\uff0c\u6df1\u53d7\u4f01\u4e1a\u7528\u6237\u7684\u9752\u7750\u3002\u5f53\u4e0b\uff0c\u6570\u636e\u5206\u6790\u5bf9\u4e8e\u4f01\u4e1a\u7684\u91cd\u8981\u6027\u8d8a\u53d1\u663e\u8457\uff1a\u4f01\u4e1a\u4f7f\u7528\u6570\u636e\u9a71\u52a8\u51b3\u7b56\uff0c\u5229\u7528\u5206\u6790\u7ed3\u679c\u7cbe\u51c6\u8c03\u914d\u8d44\u6e90\uff0c\u4ece\u800c\u964d\u4f4e\u6210\u672c\uff0c\u63d0\u5347\u4f01\u4e1a\u6548\u7387\uff0c\u63a8\u52a8\u4e1a\u52a1\u521b\u65b0\uff0c\u5feb\u901f\u9002\u5e94\u5916\u90e8\u73af\u5883\u7684\u53d8\u5316\u3002\u7136\u800c\uff0c\u4f20\u7edf\u6570\u4ed3\u67b6\u6784\u7684\u6ede\u540e\u6027\u9650\u5236\u4e86\u4f01\u4e1a\u7684\u521b\u65b0\u6b65\u4f10\u3002\u56e0\u6b64\uff0c\u4f01\u4e1a\u5bf9OLTP\u6570\u636e\u5e93\u63d0\u51fa\u66f4\u9ad8\u7684\u8981\u6c42\uff0c\u5e0c\u671b\u80fd\u5728OLTP\u6570\u636e\u5e93\u540c\u65f6\u8fdb\u884c\u590d\u6742\u7684\u5b9e\u65f6\u5206\u6790(OLAP, OnLine Analytical Processing)\uff0c\u53ca\u65f6\u5e94\u5bf9\u4e1a\u52a1\u73af\u5883\u7684\u9ad8\u901f\u53d8\u5316\u3002\u00a0\u4e3a\u6ee1\u8db3\u6df7\u5408\u8d1f\u8f7d(HTAP, Hybrid Transactional\/Analytical Processing)\u7684\u9700\u6c42\uff0c\u90e8\u5206\u5ba2\u6237\u9009\u62e9\u4e86MySQL + Clickhouse\u7684\u65b9\u6848\uff0c\u4f46\u56f0\u6270\u4e8e\u7740\u4e24\u5957\u72ec\u7acb\u7cfb\u7edf\u7684\u9ad8\u4f7f\u7528\u548c\u9ad8\u7ef4\u62a4\u6210\u672c\uff0c\u4ee5\u53ca\u7cfb\u7edf\u95f4\u7684\u6570\u636e\u4e0d\u4e00\u81f4\u7b49\u95ee\u9898\u3002\u5ba2\u6237\u5bfb\u6c42\u5728\u4e00\u5957\u7cfb\u7edf\u4e0a\u5b8c\u7f8e\u5730\u5e94\u5bf9HTAP\u8d1f\u8f7d\u7684\u89e3\u51b3\u65b9\u6848\u3002\u5bf9\u6b64\uff0cPolarDB MySQL \u6280\u672f\u56e2\u961f\u63d0\u51fa\u4e86\u57fa\u4e8eIn-Memory Column Index(\u4ee5\u4e0b\u7b80\u79f0IMCI)\u7684HTAP\u6280\u672f\u65b9\u6848\uff0c\u5728PolarDB MySQL\u884c\u5b58\u652f\u6301OLTP\u7684\u57fa\u7840\u4e0a\uff0c\u539f\u751f\u5730\u6784\u5efa\u5217\u5b58\u7d22\u5f15\u4ee5\u53ca\u5b9e\u73b0\u5217\u5b58\u8ba1\u7b97\u5f15\u64ce\uff0c\u652f\u6301\u9ad8\u6548\u5730\u5b9e\u65f6\u5206\u6790\uff0c\u5728TPC-H\u6d4b\u8bd5\u4e2d\u83b7\u5f97\u6570\u767e\u500d\u4e8e\u884c\u5b58\u7684\u52a0\u901f\u6548\u679c\u3002\u5173\u4e8ePolarDB HTAP\u548cIMCI\u7684\u8be6\u7ec6\u4ecb\u7ecd\u53c2\u8003\u300a400\u500d\u52a0\u901f, PolarDB HTAP\u5b9e\u65f6\u6570\u636e\u5206\u6790\u6280\u672f\u89e3\u5bc6\u300b[1]\u3002\u00a0\u672c\u6587\u4ecb\u7ecd\u6570\u636e\u7684\u538b\u7f29\u65b9\u6cd5\u4ee5\u53caPolarDB HTAP\u5728\u5217\u5b58\u6570\u636e\u538b\u7f29\u4e0a\u7684\u5de5\u4f5c\u3002PolarDB MySQL\u4f5c\u4e3a\u4e91\u539f\u751f\u6570\u636e\u5e93\uff0c\u5177\u6709\u5b58\u50a8\u8ba1\u7b97\u5206\u79bb\u7684\u7279\u70b9\uff0c\u8ba1\u7b97\u8d44\u6e90\u72ec\u53ef\u4ee5\u8fdb\u884c\u6309\u9700\u5206\u914d\uff0c\u800c\u5b58\u50a8\u59cb\u7ec8\u56fa\u5b9a\u5b58\u5728\u4e14\u6301\u7eed\u589e\u957f\u7684\uff0c\u9700\u8981\u538b\u7f29\u5bf9\u5b58\u50a8\u6210\u672c\u8fdb\u884c\u63a7\u5236\u3002IMCI\u7684\u6570\u636e\u5b58\u50a8\u662f\u4e3a\u5217\u5b58\u683c\u5f0f\uff0c\u5217\u6570\u636e\u76f8\u6bd4\u4e8e\u884c\u6570\u636e\u5177\u6709\u66f4\u9ad8\u7684\u76f8\u4f3c\u6027\uff0c\u5229\u4e8e\u6570\u636e\u538b\u7f29\u3002\u901a\u8fc7\u538b\u7f29\uff0cIMCI\u5728\u5927\u90e8\u5206\u4e1a\u52a1\u573a\u666f\u5c06\u5217\u5b58\u5b58\u50a8\u7a7a\u95f4\u51cf\u5c11\u5230\u5341\u5206\u4e4b\u4e00\uff0c\u5927\u5e45\u51cf\u5c11\u5ba2\u6237\u7684\u5b58\u50a8\u6210\u672c\u3002\u53e6\u5916IMCI\u901a\u8fc7\u6570\u636e\u538b\u7f29\uff0c\u51cf\u5c11\u6570\u636e\u7684\u5927\u5c0f\u548c\u5b58\u50a8\u8bbf\u95ee\u5f00\u9500\uff0c\u5e76\u63a2\u7a76\u5c06\u8ba1\u7b97\u4e0b\u63a8\u5230\u538b\u7f29\u6570\u636e\u4ece\u800c\u52a0\u901f\u5206\u6790\uff0c\u8fdb\u4e00\u6b65\u4e3a\u5ba2\u6237\u63d0\u4f9b\u66f4\u597d\u7684OLAP\u67e5\u8be2\u6027\u80fd\uff0c\u5b9e\u73b0HTAP\u7cfb\u7edf\u6027\u80fd\u548c\u6210\u672c\u7684\u517c\u5f97\u3002\u00a0\u540e\u6587\u4e3b\u8981\u5206\u4e3a4\u4e2a\u90e8\u5206\uff0c\u5728\u201c\u6570\u636e\u538b\u7f29\u6982\u8ff0\u201d\u90e8\u5206\u6211\u4eec\u4ece\u6570\u636e\u538b\u7f29\u7684\u7406\u8bba\u57fa\u7840\u2014\u2014\u4fe1\u606f\u8bba\u8c08\u8d77\uff0c\u7ed3\u5408\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u538b\u7f29\u95ee\u9898\u8fdb\u884c\u8ba8\u8bba\u3002\u5728\u201c\u538b\u7f29\u7b97\u6cd5\u5206\u7c7b\u548c\u4ecb\u7ecd\u201d\u4e2d\uff0c\u6211\u4eec\u5c06\u538b\u7f29\u65b9\u6cd5\u5206\u4e3a\u901a\u7528\u538b\u7f29\u548c\u8f7b\u91cf\u538b\u7f29\uff0c\u4ecb\u7ecd\u6570\u636e\u5e93\u4e2d\u6700\u5e38\u89c1\u7684\u901a\u7528\u538b\u7f29\u65b9\u6cd5\u539f\u7406\uff0c\u7136\u540e\u9010\u4e00\u4ecb\u7ecd\u8f7b\u91cf\u538b\u7f29\uff0c\u5e76\u8ba8\u8bba\u5b57\u7b26\u4e32\u7684\u8f7b\u91cf\u5b57\u5178\u538b\u7f29\uff0c\u4e3a\u4e0b\u4e00\u4e2a\u90e8\u5206\u94fa\u57ab\u3002\u5728\u201c\u5ef6\u8fdf\u89e3\u538b\u52a0\u901f\u8ba1\u7b97\u201d\u90e8\u5206\uff0c\u6211\u4eec\u4ecb\u7ecd\u538b\u7f29\u6570\u636e\u4e0a\u7684\u76f4\u63a5\u67e5\u8be2\u7684\u4f18\u5316\u6280\u672f\uff0c\u53c8\u79f0\u4e3a\u5ef6\u8fdf\u89e3\u538b\u6280\u672f\uff0c\u7136\u540e\u5206\u6790\u57fa\u4e8e\u5b57\u7b26\u4e32\u5b57\u5178\u538b\u7f29\u4f18\u5316\u7684\u539f\u7406\u548c\u96be\u70b9\u3002\u6700\u540e\uff0c\u6211\u4eec\u8fdb\u884c\u201c\u603b\u7ed3\u4ee5\u53ca\u540e\u7eed\u5de5\u4f5c\u201d\u7684\u8ba8\u8bba\uff0c\u5c55\u671bPolarDB HTAP\u5728\u6570\u636e\u538b\u7f29\u65b9\u5411\u7684\u540e\u7eed\u5de5\u4f5c\u3002\u00a0\u6570\u636e\u538b\u7f29\u6982\u8ff0\u538b\u7f29\u7b97\u6cd5\u5305\u62ec\u65e0\u635f\u538b\u7f29\u548c\u6709\u635f\u538b\u7f29\uff0c\u672c\u6587\u6211\u4eec\u53ea\u8ba8\u8bba\u65e0\u635f\u538b\u7f29\uff0c\u5373\u89e3\u538b\u540e\u7684\u6587\u672c\u4e0e\u538b\u7f29\u524d\u7684\u6587\u672c\u5b8c\u5168\u76f8\u540c\uff0c\u540e\u6587\u7684\u201c\u538b\u7f29\u201d\u90fd\u662f\u6307\u65e0\u635f\u538b\u7f29\u3002\u538b\u7f29\u7b97\u6cd5\u7531\u7f16\u7801\u548c\u89e3\u7801\u4e24\u90e8\u5206\u6784\u6210\uff0c\u7f16\u7801\u548c\u89e3\u7801\u672c\u8d28\u4e0a\u662f\u5c06\u6587\u672c\u6620\u5c04\u5230\u53e6\u4e00\u4e2a\u66f4\u7d27\u51d1\u7684\u6587\u672c\u7a7a\u95f4\u4ee5\u53ca\u9006\u6620\u5c04\u7684\u8fc7\u7a0b\u3002\u00a0\u538b\u7f29\u4e0e\u6982\u7387\u662f\u7d27\u5bc6\u76f8\u5173\u7684\u3002\u6240\u6709\u7684\u538b\u7f29\u7b97\u6cd5\u5bf9\u4e8e\u8f93\u5165\u6570\u636e\u90fd\u6709\u4e00\u5b9a\u7684\u9884\u5148\u5047\u8bbe\uff0c\u8fd9\u79cd\u5047\u8bbe\u53ef\u4ee5\u7528\u6982\u7387\u63cf\u8ff0\uff0c\u4f8b\u5982\u5047\u8bbe\u67d0\u79cd\u6570\u636e\u91cd\u590d\u7684\u6982\u7387\u6216\u67d0\u51e0\u79cd\u6570\u636e\u4e00\u8d77\u51fa\u73b0\u7684\u6982\u7387\u9ad8\u3002\u9999\u519c\u7684\u8bba\u6587\u300a\u901a\u4fe1\u7684\u6570\u5b66\u539f\u7406\u300b\uff0c\u88ab\u89c6\u4e3a\u73b0\u4ee3\u4fe1\u606f\u8bba\u7814\u7a76\u7684\u5f00\u7aef\uff0c\u6b63\u662f\u4fe1\u606f\u8bba\u5c06\u6570\u636e\u51fa\u73b0\u7684\u6982\u7387\u548c\u6570\u636e\u6240\u9700\u7f16\u7801\u957f\u5ea6\u8054\u7cfb\u8d77\u6765\u3002\u5728\u8bba\u6587\u4e2d\uff0c\u9999\u519c\u4ece\u7edf\u8ba1\u7269\u7406\u5b66\u4e2d\u501f\u9274\u4e86\u71b5\u7684\u6982\u5ff5\uff0c\u5b9a\u4e49\u4e86\u4fe1\u606f\u71b5[2]:<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305418\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305419\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><br \/>H(S)\u5373\u4fe1\u606f\u71b5\uff0cS\u662f\u6240\u6709\u4fe1\u606fs\u6784\u6210\u7684\u96c6\u5408\uff0cp(s) \u662f\u4fe1\u606fs\u51fa\u73b0\u7684\u6982\u7387\uff0cs \u2208 S\u3002i(s)\u8868\u793a\u9700\u8981\u7f16\u7801\u5355\u4e2a\u4fe1\u606f\u6240\u9700\u8981\u7684\u6bd4\u7279\u6570\uff0c\u800c\u4fe1\u606f\u71b5H(S)\u662fi(s)\u4ee5\u6982\u7387p(s)\u4e3a\u6743\u91cd\u7684\u52a0\u6743\u5e73\u5747\uff0c\u8868\u793a\u7f16\u7801\u4fe1\u606f\u96c6\u5408S\u6240\u9700\u7684\u603b\u6bd4\u7279\u6570\u3002\u00a0\u4e3e\u4e2a\u4f8b\u5b50\u7b80\u5355\u7406\u89e3\u8fd9\u4e24\u4e2a\u516c\u5f0f\u3002\u6211\u4eec\u5047\u8bbe96\u4e2a\u53ef\u6253\u5370\u5b57\u7b26\u51fa\u73b0\u7684\u6982\u7387\u76f8\u540c\uff0c\u90a3\u4e48\u7f16\u7801\u6bcf\u4e2a\u5b57\u7b26\u9700\u8981\u7684\u5e73\u5747\u6bd4\u7279\u6570\uff0c\u5373i(s) = log_2(96) = 6.6 bits\/char\uff0c\u663e\u7136\uff0c\u81f3\u5c117 bits\u624d\u53ef\u4ee5\u8868\u793a96(2^7=128)\u4e2a\u4e0d\u540c\u7684\u5b57\u7b26\u3002\u5982\u679c\u6211\u4eec\u57fa\u4e8e\u4e00\u4e2a\u82f1\u6587\u6587\u672c\u96c6(\u4f8b\u5982Calgary Corpus)\u8fdb\u884c\u7edf\u8ba1\uff0c\u4f7f\u7528\u5b57\u7b26\u7684\u9891\u7387\u8fd1\u4f3c\u6982\u7387\uff0c\u8ba1\u7b97\u51fa\u4fe1\u606f\u71b5\u7684\u5e73\u5747\u503ci(s)\u4e3a4.5 bits\/char\uff0c\u5177\u4f53\u7f16\u7801\u53ef\u4ee5\u901a\u8fc7huffman\u7f16\u7801\u7b97\u6cd5\u5f97\u5230\u3002\u8fd9\u4e2a\u4f30\u7b97\u8ba4\u4e3a\u5b57\u7b26\u95f4\u662f\u72ec\u7acb\u7684\uff0c\u5982\u679c\u8003\u8651\u4e0a\u76f8\u90bb\u5b57\u7b26\u3001\u5355\u8bcd\u95f4\u7684\u5173\u8054\u7ed3\u5408\u8d85\u5927\u6587\u672c\u8fdb\u884c\u7edf\u8ba1\uff0c\u7f16\u7801\u5b57\u7b26\u6240\u9700\u8981\u7684\u6bd4\u7279\u6570\u662f1.3 bits\/char\uff0c8\/1.3 = 6.15\u8fd1\u4f3c\u4e3a\u4efb\u610f\u82f1\u6587\u6587\u7ae0\u7684\u538b\u7f29\u6bd4\u7684\u4e0a\u754c\u3002\u00a0\u901a\u7528\u538b\u7f29\u7b97\u6cd5\u5bf9\u8f93\u5165\u6570\u636e\u4ec5\u505a\u7b80\u5355\u7684\u5047\u8bbe\uff0c\u5982\u5047\u8bbe\u6570\u636e\u5b58\u5728\u5c40\u90e8\u76f8\u4f3c\u6027\u7b49\u3002GZIP\u548cBOA\u5728Calgary Corpus\u6587\u672c\u96c6\u7684\u538b\u7f29\u6548\u679c\u4e3a2.7 bits\/char\u548c2.0 bits\/char\uff0c\u5982\u679c\u8981\u66f4\u63a5\u8fd1\u82f1\u6587\u6587\u672c\u7684\u538b\u7f29\u4e0a\u754c\uff0c\u901a\u7528\u538b\u7f29\u7b97\u6cd5\u9700\u8981\u82f1\u6587\u8bcd\u9891\u548c\u8bed\u6cd5\u7b49\u4f5c\u4e3a\u8f93\u5165\uff0c\u8fd9\u5c06\u5f71\u54cd\u5176\u901a\u7528\u6027\u3002\u6211\u4eec\u5728\u4e0b\u4e00\u90e8\u5206\u5bf9\u5e38\u89c1\u901a\u7528\u538b\u7f29\u7b97\u6cd5\u7684\u539f\u7406\u8fdb\u884c\u7b80\u5355\u4ecb\u7ecd\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305420\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><br \/>\u7f16\u7801\u53ef\u6253\u5370\u5b57\u7b26\u6240\u9700\u8981\u7684\u6bd4\u7279\u6570\uff0c\u56e0\u6b64\u6570\u503c\u8d8a\u5c0f\uff0c\u8bf4\u660e\u538b\u7f29\u6548\u679c\u8d8a\u597d\uff0c\u56fe\u6e90\u81ea[2]\u3002\u00a0\u4e86\u89e3\u538b\u7f29\u4e0e\u6982\u7387\u7684\u5173\u8054\u540e\uff0c\u6211\u4eec\u770b\u770b\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\u7684\u6570\u636e\u538b\u7f29\u95ee\u9898\u3002\u9996\u5148\u6211\u4eec\u5173\u6ce8OLTP\u6570\u636e\u5e93\u548cOLAP\u6570\u636e\u5e93\u7684\u6570\u636e\u5b58\u50a8\u683c\u5f0f\uff0c\u5e38\u89c1\u7684OLTP\u6570\u636e\u5e93\u7684\u5b58\u50a8\u5f15\u64ce\u5305\u62ec\u57fa\u4e8eB+Tree\u7684innodb\u548c\u57fa\u4e8eLSM-Tree\u7684X-Engine\u548crocksDB\u7b49\uff0c\u5b83\u4eec\u4f7f\u7528\u884c\u5f0f\u5b58\u50a8\uff0c\u8868\u6570\u636e\u6309\u884c\u6c34\u5e73\u5206\u5272\uff0c\u6bcf\u4e2a\u8bb0\u5f55\u4f1a\u5305\u542b\u5404\u4e2a\u4e0d\u540c\u7684\u5217\u3002\u800cOLAP\u6570\u636e\u5e93\u4f7f\u7528\u5217\u5f0f\u5b58\u50a8\uff0c\u8868\u6570\u636e\u6309\u5217\u5782\u76f4\u5206\u5272\uff0c\u6bcf\u5217\u6570\u636e\u5355\u72ec\u5b58\u50a8\u3002\u5047\u8bbe\u4f7f\u7528\u901a\u7528\u538b\u7f29\u7b97\u6cd5\uff0c\u540c\u4e00\u5217\u6570\u636e\u7684\u5c40\u90e8\u76f8\u4f3c\u6027\u4e00\u822c\u9ad8\u4e8e\u4e0d\u540c\u7684\u5217\uff0c\u56e0\u6b64\u5217\u5b58\u76f8\u6bd4\u884c\u5b58\u5929\u7136\u5177\u6709\u66f4\u9ad8\u7684\u538b\u7f29\u6bd4\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305421\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305422\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><br \/>\u884c\u5f0f\u5b58\u50a8\uff0c\u8868\u6570\u636e\u6309\u884c\u6c34\u5e73\u5206\u5272 vs \u5217\u5f0f\u5b58\u50a8\uff0c\u8868\u6570\u636e\u6309\u5217\u5782\u76f4\u5206\u5272\u00a0\u53e6\u4e00\u65b9\u9762\u7531\u4e8e\u5217\u5b58\u6309\u5217\u7ec4\u7ec7\u6570\u636e\uff0c\u56e0\u6b64\u4e0d\u540c\u7684\u5217\u53ef\u4ee5\u9009\u62e9\u4e0d\u540c\u7684\u538b\u7f29\u7b97\u6cd5\uff0c\u5728\u4e0b\u4e00\u90e8\u5206\u6211\u4eec\u5c06\u770b\u5230\u8f7b\u91cf\u538b\u7f29\u6839\u636e\u4e0d\u540c\u5217\u7684\u7c7b\u578b\u548c\u7279\u5f81\uff0c\u501f\u6b64\u83b7\u5f97\u8fdc\u9ad8\u4e8e\u901a\u7528\u538b\u7f29\u7684\u538b\u7f29\u6bd4\u548c\u538b\u7f29\u89e3\u538b\u6027\u80fd\u3002\u00a0\u8bba\u6587[3]\u5206\u6790\u4e86\u5217\u5b58\u76f8\u5bf9\u884c\u5b58\u52a0\u901f\u67e5\u8be2\u7684\u539f\u56e0\uff0c\u5305\u62ec\u9ad8\u538b\u7f29\uff0c\u6279\u5904\u7406\u548c\u5ef6\u8fdf\u7269\u5316\u7b49\uff0c\u5176\u4e2d\u4ec5\u8003\u8651\u538b\u7f29\uff0c\u76f8\u6bd4\u884c\u5b58\uff0c\u5217\u5b58\u6570\u636e\u5e93\u5e73\u5747\u83b7\u5f9710\u500d\u4ee5\u4e0a\u7684\u67e5\u8be2\u52a0\u901f\u6bd4\u3002\u6211\u4eec\u5728IMCI\u7684TPC-H\u6d4b\u8bd5\u4e2d\u9a8c\u8bc1\u4e86\u8fd9\u4e00\u7ed3\u8bba\uff0c\u800c\u4e14\u5728\u4e1a\u52a1\u771f\u5b9e\u6570\u636e\u4e2d\u53ef\u4ee5\u8fbe\u5230\u5e73\u574710\u500d\u7684\u538b\u7f29\u6bd4\u3002\u53ef\u89c1\u6570\u636e\u538b\u7f29\u5bf9\u4e8e\u5217\u5b58\u6570\u636e\u5e93\u5c24\u4e3a\u91cd\u8981\u3002\u00a0\u538b\u7f29\u7b97\u6cd5\u5206\u7c7b\u548c\u4ecb\u7ecd\u5b66\u672f\u4e0a\u5bf9\u4e8e\u538b\u7f29\u7b97\u6cd5\u5df2\u7ecf\u6709\u4e86\u76f8\u5f53\u5145\u5206\u7684\u7814\u7a76\uff0c\u6700\u65b0\u7684\u5b66\u672f\u5de5\u4f5c\u5f00\u59cb\u63a2\u7d22\u6df1\u5ea6\u5b66\u4e60\u65b9\u6cd5\u66f4\u7cbe\u786e\u5730\u4f30\u8ba1\u6570\u636e\u7684\u6982\u7387\u5206\u5e03\uff0c\u4ece\u800c\u63d0\u5347\u538b\u7f29\u6bd4\uff0c\u4f46\u6682\u672a\u6709\u5927\u89c4\u6a21\u7684\u5b9e\u9645\u5e94\u7528\u3002\u5927\u90e8\u5206\u538b\u7f29\u7b97\u6cd5\u7684\u533a\u522b\u5728\u4e8e\u5de5\u7a0b\u4e0a\u7684\u4f18\u5316\u3002\u6211\u4eec\u5c06\u538b\u7f29\u5206\u4e3a\u901a\u7528\u538b\u7f29\u548c\u8f7b\u91cf\u538b\u7f29\uff0c\u901a\u7528\u538b\u7f29\u5bf9\u8f93\u5165\u4e0d\u505a\u590d\u6742\u7684\u5047\u8bbe\uff0c\u4ee5\u5757\u4e3a\u7c92\u5ea6\u538b\u7f29\u6570\u636e\uff0c\u9002\u7528\u4e8e\u5404\u7c7b\u6570\u636e\uff1b\u8f7b\u91cf\u538b\u7f29\u7684\u4f7f\u7528\u5b58\u5728\u9650\u5236\u6761\u4ef6\uff0c\u9700\u8981\u6570\u636e\u6ee1\u8db3\u4e00\u5b9a\u7279\u6027\uff0c\u4f8b\u5982\u6709\u5e8f\u6027\uff0cdistinct\u503c\u5c11\u7b49\uff0c\u4f46\u538b\u7f29\u6bd4\uff0c\u538b\u7f29\u548c\u89e3\u538b\u901f\u5ea6\u4e0a\u4f18\u4e8e\u901a\u7528\u538b\u7f29\uff0c\u5e76\u80fd\u8fdb\u4e00\u6b65\u4f18\u5316\u67e5\u8be2\u3002\u4e24\u7c7b\u538b\u7f29\u7b97\u6cd5\u4e0d\u51b2\u7a81\uff0c\u901a\u5e38\u4f1a\u7ed3\u5408\u4f7f\u7528\u83b7\u5f97\u66f4\u9ad8\u7684\u538b\u7f29\u6bd4\u3002\u00a0\u901a\u7528\u538b\u7f29\u6211\u4eec\u7b80\u8981\u4ecb\u7ecdLZ4\u548cZSTD\uff0c\u5b83\u4eec\u662f\u5728\u76ee\u524d\u6570\u636e\u5e93\u9886\u57df\u6700\u4e3a\u5e38\u7528\u7684\u4e24\u79cd\u5feb\u901f\u538b\u7f29\u7b97\u6cd5\uff0c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u901a\u7528\u538b\u7f29\u7b97\u6cd5\uff0c\u5b83\u4eec\u7684\u538b\u7f29\u548c\u89e3\u538b\u6027\u80fd\u8f83\u4e3a\u7a81\u51fa\uff0c\u66f4\u9002\u5408\u6570\u636e\u5e93\u7684\u6570\u636e\u8bbf\u95ee\u6a21\u5f0f\u3002LZ4\u7684\u7279\u70b9\u662f\u89e3\u538b\u901f\u5ea6\u5feb\uff0c\u4f46\u538b\u7f29\u6bd4\u4e00\u822c\uff0c\u5728lzbench\u6807\u51c6\u6d4b\u8bd5\u4e2d\uff0c\u89e3\u538b\u901f\u5ea6\u8fbe\u52304.97GB\/s\u3002Zstd \u5168\u79f0\u4e3aZstandard\uff0c\u5b9a\u4f4d\u662f\u63d0\u4f9b\u9ad8\u538b\u7f29\u6bd4\u7684\u5feb\u901f\u538b\u7f29\u7b97\u6cd5\uff0c\u7531Facebook\u4e8e2016\u5e74\u53d1\u5e03\u7684\u3002Zstd \u91c7\u7528\u4e86\u6709\u9650\u72b6\u6001\u71b5\uff08FSE\uff0cFinite State Entropy\uff09\u7f16\u7801\u5668\uff0c\u83b7\u5f97\u4e86\u66f4\u9ad8\u7684\u538b\u7f29\u6bd4\u7684\u540c\u65f6\u89e3\u538b\u6027\u80fd\u4ecd\u7136\u4fdd\u6301\u5728\u8f83\u9ad8\u6c34\u5e73\uff0clzbench\u6d4b\u8bd5\u4e2d\u89e3\u538b\u901f\u5ea6\u5230 1.38GB\/s\u3002\u00a0\u4e8b\u5b9e\u4e0a\uff0c\u5305\u62ecLZ4\u548cZSTD\u5728\u5185\uff0c\u5e38\u89c1\u7684snappy, zlib, gzip\u7b49\u538b\u7f29\u7b97\u6cd5\u90fd\u5c5e\u4e8eLZ77\u7b97\u6cd5\u7684\u53d8\u4f53\uff0c\u56e0\u6b64\u6211\u4eec\u7b80\u5355\u4ecb\u7ecdLZ77\u7b97\u6cd5\u7684\u539f\u7406\u3002\u00a0LZ77 \u7b97\u6cd5\u53ca\u5176\u53d8\u4f53\u90fd\u4f7f\u7528\u4e86\u968fcursor\u79fb\u52a8\u7684\u6ed1\u52a8\u7a97\u53e3\u3002Cursor\u6307\u5411\u5f53\u524d\u9700\u8981\u538b\u7f29\u7684\u7b2c\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u5e76\u628a\u7a97\u53e3\u5206\u4e3a\u4e24\u90e8\u5206\uff0ccursor\u4e4b\u524d\u7684\u90e8\u5206\uff0c\u79f0\u4e3a\u5b57\u5178\uff1b\u5305\u542bcursor\u5f00\u59cb\u7684\u90e8\u5206\uff0c\u79f0\u4e3alookahead buffer\u3002\u8fd9\u4e24\u4e2a\u90e8\u5206\u7684\u5927\u5c0f\u662f\u7531\u53c2\u6570\u8bbe\u7f6e\uff0c\u5728\u7b97\u6cd5\u6267\u884c\u8fc7\u7a0b\u4e2d\u662f\u56fa\u5b9a\u7684\u3002\u57fa\u672c\u7b97\u6cd5\u975e\u5e38\u7b80\u5355\uff0c\u5faa\u73af\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u00a0\u67e5\u627e\u4ececursor\u5f00\u59cb\u5e76\u5b8c\u5168\u5305\u542b\u5728lookahead buffer\u4e2d\u7684\u5b57\u7b26\u4e32\u4e0e\u5b57\u5178\u4e2d\u7684\u5b57\u7b26\u4e32\u7684\u6700\u957f\u5339\u914d\u3002\u8f93\u51fa\u4e00\u4e2a\u538b\u7f29\u7ed3\u679c\u4e09\u5143\u7ec4 (p, n, c)\uff0c\u4e3a\u5b57\u5178\u4e2d\u7684\u4f4d\u7f6ep\u3001\u5339\u914d\u7684\u957f\u5ea6 n \u548c\u5339\u914d\u90e8\u5206\u7684\u4e0b\u4e00\u4e2a\u5b57\u7b26c\u3002p\u662f\u76f8\u5bf9cursor\u7684\u8ddd\u79bb\uff0c\u5177\u4f53\u542b\u4e49\u662f\u5339\u914d\u5b57\u7b26\u4e32\u5728\u5b57\u5178\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5b57\u7b26\u76f8\u5bf9cursor\u7684\u504f\u79fb\u91cf\u3002\u5c06\u5149\u6807\u5411\u524d\u79fb\u52a8 n + 1 \u4e2a\u5b57\u7b26\u3002\u00a0\u6211\u4eec\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u4f7f\u7528LZ77\u7b97\u6cd5\u538b\u7f29\u5b57\u7b26\u4e32aacaacabcabaaac\uff0c\u56f4\u7ed5\u5b57\u7b26\u7684\u65b9\u6846\u8868\u793acursor\uff0c\u52a0\u7c97\u7684\u5b57\u7b26\u4e32\u90e8\u5206\u662f\u5b57\u5178\uff0c\u5927\u5c0f\u4e3a5\uff0c\u4e0b\u5212\u7ebf\u5b57\u7b26\u4e32\u90e8\u5206\u4e3alookahead buffer\uff0c\u5927\u5c0f\u4e3a4(\u5305\u62eccursor\u6307\u5411\u7684\u5b57\u7b26)\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305423\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><br \/>LZ77\u7b97\u6cd5\u538b\u7f29\u5b57\u7b26\u4e32aacaacabcabaaac, \u538b\u7f29\u7ed3\u679c\u4e3a(0, 0, a), (1, 1, c), (3, 4, b), (3, 3, a), (1, 2, c)\u00a0step1:\u00a0\u6ed1\u52a8\u7a97\u53e3\u7684\u5b57\u5178\u90e8\u5206\u4e3a\u7a7a\uff0clookahead buffer\u4e3aaaca\uff0c\u5b57\u5178\u4e3a\u7a7a\u65e0\u6cd5\u5339\u914d\uff0c\u76f4\u63a5\u8f93\u51fa(0, 0, a)\u3002step2:\u00a0\u5f53\u524d\u5b57\u5178\u4e3aa\uff0clookahead buffer\u4e3aacaa\uff0c\u5339\u914da\u540e\u7684\u4e0b\u4e00\u4e2a\u5b57\u7b26\u4e3ac\uff0c\u8f93\u51fa(1, 1, c)\u3002step3:\u00a0\u5f53\u524d\u5b57\u5178\u4e3aaac\uff0clookahead buffer\u4e3aaaca\uff0c\u5728step3\u4e2d\uff0c\u672a\u4f18\u5316\u7684\u60c5\u51b5\u4e0b\uff0c\u5339\u914d\u5230aac\u65f6\u5e94\u8be5\u7ed3\u675f\uff0c\u4f18\u5316\u5904\u7406\u540e\u5b9e\u9645\u5339\u914d\u7684\u5b57\u7b26\u4e32\u4e3aaaca\uff0c\u4e0b\u4e00\u4e2a\u5b57\u7b26\u4e3ab\uff0c\u8f93\u51fa(3, 4, b)\u3002step4:\u00a0\u5f53\u524d\u5b57\u5178\u4e3acaacab\uff0clookahead buffer\u4e3acaba\uff0c\u5339\u914dcab\u540e\u7684\u4e0b\u4e00\u4e2a\u5b57\u7b26\u4e3aa\uff0c\u8f93\u51fa(3, 3, a)\u3002step5:\u00a0\u5f53\u524d\u5b57\u5178\u4e3aabcaba\uff0clookahead buffer\u4e3aaac\uff0c\u7c7b\u4f3cstep3\uff0c\u5339\u914daa\u540e\u7684\u4e0b\u4e00\u4e2a\u5b57\u7b26\u4e3ac\uff0c\u8f93\u51fa(1, 2, c)\u3002\u00a0step3\u548cstep5\u4ea7\u751f\u7684(3,4,b)\u548c(1,2,c)\u6bd4\u8f83\u7279\u6b8a\uff0c\u4ed4\u7ec6\u89c2\u5bdf\u4f1a\u53d1\u73b0\u5339\u914d\u7684\u5b57\u7b26\u4e32\u8d85\u51fa\u4e86\u5b57\u5178\uff0c\u5373n &gt; p\uff0c\u6b64\u65f6\u5b57\u5178\u5339\u914d\u5728cursor\u7684\u8fb9\u754c[cursor &#8211; p, cursor &#8211; 1]\uff0c\u8fd9\u90e8\u5206\u88ab\u5f53\u6210ring buffer, \u5339\u914d\u5230\u672b\u5c3e\u540e\u53c8\u4ece\u5934\u5f00\u59cb\u5339\u914d\uff0c\u5b9e\u73b0\u4e86\u5bf9\u8fde\u7eed\u91cd\u590d\u5b57\u7b26\u4e32\u7684\u7f16\u7801\u4f18\u5316\uff0c\u8fd9\u4e2a\u538b\u7f29\u6548\u679c\u548c\u4e0b\u9762\u4ecb\u7ecd\u7684\u8f7b\u91cf\u538b\u7f29\u4e2d\u7684RLE\u7f16\u7801\u6548\u679c\u76f8\u4f3c\u3002\u7ed3\u5408\u89e3\u538b\u8fc7\u7a0b\u52a8\u6001\u4ea7\u751f\u5b57\u5178\u7684\u8fc7\u7a0b\uff0c\u53ef\u4ee5\u66f4\u597d\u7406\u89e3\u8fd9\u4e2a\u5904\u7406\u3002\u00a0\u89e3\u538b\u6bd4\u8f83\u7b80\u5355\uff0c\u6574\u4e2a\u8fc7\u7a0b\u662f\u8fb9\u89e3\u538b\u8fb9\u4f7f\u7528\u4e4b\u524d\u89e3\u7801\u7684\u6570\u636e\u4f5c\u4e3a\u5f53\u524d\u5b57\u5178\u3002step3\u548cstep5\u7684\u9700\u8981\u7279\u6b8a\u5904\u7406\uff0c\u5f53\u5b57\u5178\u4e2d\u51fa\u73b0\u7684\u4f4d\u7f6ep\u5c0f\u4e8e\u5339\u914d\u7684\u957f\u5ea6 n\uff0c\u5c06p\u5230cursor\u7684\u5b57\u7b26\u4e32\u590d\u5236n \/ p\u6b21\u540e\u52a0\u4e0a\u5269\u4e0b\u7684n % p\u4e2a\u5b57\u7b26\u5373\u53ef\u3002\u00a0\u4eceLZ77\u7b97\u6cd5\u7684\u539f\u7406\u4e2d\uff0c\u6211\u4eec\u4e0d\u96be\u7406\u89e3\u4e3a\u4ec0\u4e48LZ4, ZSTD\u7b49LZ77\u53d8\u79cd\u7684\u7b97\u6cd5\u5728\u538b\u7f29\u548c\u89e3\u538b\u65b9\u9762\u7684\u6027\u80fd\u5177\u6709\u4e0d\u5bf9\u79f0\u6027\u3002\u8fd9\u79cd\u4e0d\u5bf9\u79f0\u6027\u4f53\u73b0\u5728\u968f\u7740\u538b\u7f29\u7b49\u7ea7\u589e\u5927\uff0c\u538b\u7f29\u6bd4\u589e\u52a0\uff0c\u538b\u7f29\u901f\u5ea6\u4e0b\u964d\uff0c\u4f46\u89e3\u538b\u901f\u5ea6\u51e0\u4e4e\u4e0d\u53d7\u5f71\u54cd\uff0c\u56e0\u4e3a\u538b\u7f29\u8fc7\u7a0b\u4e2d\u7684\u8ba1\u7b97\u590d\u6742\u5ea6\u53d6\u51b3\u4e8e\u5b57\u5178\u7a97\u53e3\u7684\u5927\u5c0f\u548c\u5339\u914d\u5b57\u7b26\u7684\u957f\u5ea6\u7b49\uff0c\u800c\u89e3\u538b\u7684\u8fc7\u7a0b\u4ec5\u4ec5\u662f\u4ece\u5b57\u5178\u4e2d\u5b9a\u4f4d\uff0c\u62f7\u8d1d\u6570\u636e\u5230\u8f93\u51fa\u4e2d\u3002\u00a0\u8f7b\u91cf\u538b\u7f29\u524d\u6587\u63d0\u5230\u901a\u7528\u538b\u7f29\u4ee5\u5757\u4e3a\u7c92\u5ea6\u538b\u7f29\u6570\u636e\uff0c\u8fd9\u5bfc\u81f4\u6570\u636e\u7684\u968f\u673a\u8bbf\u95ee\u5b58\u5728\u8bfb\u653e\u5927\u95ee\u9898\uff0c\u5373\u8bfb\u53d6\u4e00\u4e2a\u8bb0\u5f55\u9700\u8981\u5c06\u5757\u4e2d\u6240\u6709\u7684\u8bb0\u5f55\u8fdb\u884c\u89e3\u538b\uff0c\u8ba1\u7b97\u4ee3\u4ef7\u5927\u3002\u8fd9\u5728\u5185\u5b58\u8ba1\u7b97\u4e3a\u4e3b\u7684\u573a\u666f\u4e2d\u4e25\u91cd\u5f71\u54cd\u6027\u80fd\uff0c\u56e0\u6b64\u901a\u7528\u538b\u7f29\u5e38\u7528\u4e8e\u843d\u76d8\u6570\u636e\uff0c\u800c\u5185\u5b58\u538b\u7f29\uff0c\u4f7f\u7528\u8f7b\u91cf\u538b\u7f29\u65b9\u6cd5\u3002\u4e0b\u9762\u5206\u5b57\u7b26\u4e32\u7c7b\u578b\u7f16\u7801\uff0c\u6570\u503c\u7c7b\u578b\u7f16\u7801\uff0c\u6570\u636e\u7c7b\u578b\u65e0\u5173\u7f16\u7801\u4e09\u4e2a\u7c7b\u522b\u8ba8\u8bba\u8f7b\u91cf\u538b\u7f29\u65b9\u6cd5\u3002\u00a0[\u5b57\u7b26\u4e32\u7c7b\u578b\u7f16\u7801]Prefix\u7f16\u7801\uff1a\u524d\u7f00\u7f16\u7801(incremental encoding\/front coding)\uff0c\u901a\u8fc7\u5c06\u5b57\u7b26\u4e32\u6309\u5b57\u5178\u5e8f\u6392\u5217\uff0c\u5c06\u5f53\u524d\u5b57\u7b26\u4e32\u8868\u793a\u4e3a\u548c\u4e0a\u4e00\u4e2a\u5b57\u7b26\u4e32\u91cd\u590d\u7684\u90e8\u5206\u7684\u957f\u5ea6 + \u4e0d\u91cd\u590d\u7684\u5269\u4f59\u90e8\u5206\u3002\u00a0[\u6570\u503c\u7c7b\u578b\u7f16\u7801]FOR\u7f16\u7801\uff1aFOR\uff0cFrame Of Reference\u5b58\u50a8\u4e0e\u6700\u5c0f\u503c\u8fdb\u884c\u76f8\u51cf\u540e\u7684\u7ed3\u679c\u3002\u65e0\u987b\u6570\u636e\u6709\u5e8f\uff0c\u538b\u7f29\u548c\u89e3\u538b\u901f\u5ea6\u5f88\u5feb\uff0c\u53ef\u4ee5\u5728\u538b\u7f29\u540e\u7684\u6570\u7ec4\u4e0a\u8fdb\u884cO(1)\u968f\u673a\u8bbf\u5b58\uff0c\u53ea\u9700\u8981\u989d\u5916\u5b58\u50a8\u7684\u6700\u5c0f\u503c\u4fe1\u606f\u3002Delta\u7f16\u7801\uff1a\u5b58\u50a8\u4e24\u4e24\u76f8\u90bb\u76f8\u51cf\u7684\u7ed3\u679c\uff0c\u6709\u5e8f\u5b58\u50a8\u7684\u6570\u636e\uff0c\u4e24\u4e24\u76f8\u90bb\u76f8\u51cf\u540e\u7684\u7ed3\u679c\u53d6\u503c\u8303\u56f4\u5f88\u5c0f\uff0c\u4f8b\u5982\u4e3b\u952e\u4e24\u4e24\u76f8\u90bb\u76f8\u51cf\u540e\u8fd1\u4f3c\u5e38\u6570\u3002NS\u7f16\u7801: Null Supression, NS\u7b97\u6cd5\u672c\u8d28\u662f\u8bbe\u8ba1\u65b0\u7684\u7f16\u7801\uff0c\u5c3d\u91cf\u53ea\u5b58\u50a8\u6570\u636e\u7684\u6709\u6548\u4f4d(\u975e0\u4f4d)\uff0c\u8282\u7701\u524d\u7f00\u5b58\u5728\u7684\u8fde\u7eed\u76840\u7684\u5b58\u50a8\u5f00\u9500\u3002\u5b66\u672f\u754c\u4e3b\u8981\u5173\u6ce8\u8fd9\u7c7b\u8f7b\u91cf\u538b\u7f29\u7b97\u6cd5\uff0c\u8bbe\u8ba1\u4e86\u8bf8\u591a\u7f16\u7801\u7ed3\u5408SIMD\u4f18\u5316, \u4ee3\u8868\u6027\u7684varint-GB, SIMD-BP128, simple_8b, fastpfor\u7b49\uff0c\u4e5f\u5728\u4e1a\u754c\u5e7f\u6cdb\u4f7f\u7528\uff0c\u4f8b\u5982google\u7684protobuf\u5373\u4f7f\u7528\u4e86varint\u8fdb\u884c\u7f16\u7801\u3002NS\u5047\u8bbe\u5f85\u538b\u7f29\u6570\u636e\u4e3a\u975e\u8d1f\u6570(\u56e0\u4e3a\u8d1f\u6570\u8865\u7801\u6700\u9ad8\u4e3a1\uff0c\u4e0d\u5b58\u5728\u65e0\u6548\u4f4d)\u3002\u5e38\u89c1\u548cFOR\u7f16\u7801, Delta\u7f16\u7801\u7b49\u7ed3\u5408\u4f7f\u7528\uff0c\u4f8b\u5982FOR\u7f16\u7801, Delta\u7f16\u7801\u903b\u8f91\u4e0a\u5c06\u6570\u636e\u8303\u56f4\u4eceint64\u7f29\u5c0f\u5230int16\uff0c\u518d\u4f7f\u7528NS\u7f16\u7801\u5c06\u6570\u636e\u7269\u7406\u5b58\u50a8\u4ee3\u4ef7\u51cf\u5c11\u5230int16\u5373\u53ef\u3002\u00a0[\u6570\u636e\u7c7b\u578b\u65e0\u5173\u7f16\u7801]\u5b57\u5178\u7f16\u7801\uff1a\u5b57\u5178\u7f16\u7801\u672c\u8d28\u662f\u5c06\u91cd\u590d\u6027\u8f83\u9ad8\u7684\u4e00\u6bb5\u6570\u636e\u4f5c\u4e3a\u5b57\u5178entry\uff0c\u4f7f\u7528\u5b57\u5178\u4e0b\u6807number\u66ff\u4ee3\u539f\u6587\u7684\u5b57\u5178entry\uff0c\u8fbe\u5230\u538b\u7f29\u7684\u76ee\u7684\u3002\u89e3\u538b\u8fc7\u7a0b\uff0c\u5c06\u4e0b\u6807\u5bf9\u5e94\u7684\u6570\u636e\u4ece\u5b57\u5178\u4e2d\u53d6\u51fa\u5373\u53ef\u3002\u6211\u4eec\u6309\u5b57\u5178entry\u7684\u8bbe\u8ba1\u7b80\u5355\u5c06\u5b57\u5178\u7f16\u7801\u5206\u4e3a\u4e09\u4e2a\u5b50\u7c7b\u3002Entry\u4e3a\u5b8c\u6574\u7684\u5355\u4e2a\u8bb0\u5f55(\u4f8b\u5982\u5b8c\u6574\u7684\u5b57\u7b26\u4e32)\uff0c\u7f16\u7801\u540e\u539f\u6570\u636e\u7528\u5b57\u5178\u4e2d\u7684\u4e0b\u6807\u66ff\u4ee3\uff0c\u9002\u7528\u4e8edistinct\u503c\u8f83\u5c11\u7684\u5217\u3002\u4f7f\u7528base + offset\u5904\u7406\u6570\u503c\u6570\u636e\uff0cEntry\u4e3abase\uff0c\u539f\u6570\u636e\u7f16\u7801\u540e\u4e3a(\u4e0b\u6807, offset)\u7684\u4e8c\u5143\u7ec4\u3002\u4f7f\u7528common prefix + suffix\u5904\u7406\u4e8c\u8fdb\u5236\u6570\u636e\uff0cEntry\u4e3acommon prefix\uff0c\u7f16\u7801\u540e\u4e3a(\u4e0b\u6807, suffix)\u7684\u4e8c\u5143\u7ec4\u3002RLE\u7f16\u7801\uff1a\u8981\u6c42\u8fde\u7eed\u91cd\u590d\u7684\u6570\u636e\u5c3d\u53ef\u80fd\u96c6\u4e2d\u5728\u4e00\u8d77\uff0c\u56e0\u6b64\u9700\u8981\u6392\u5e8f\u3002\u7f16\u7801\u7ed3\u679c\u4e3a(value\uff0clength\uff0cposition)\u7684\u4e09\u5143\u7ec4\uff0c\u4f8b\u59820\uff0c0\uff0c1\uff0c1\uff0c1&#8230;\u7684\u6570\u636e\uff0c\u7f16\u7801\u4e3a(0, 2, 0)\uff0c(1, 3, 2)\uff0c\u538b\u7f29\u6548\u679c\u53d6\u51b3\u4e8eavg run length\uff0c\u538b\u7f29\u6bd4\u8fd1\u4f3cdata size\/avg run length\u3002Bitmap\u7f16\u7801\uff1adistinct\u503c\u6781\u7aef\u5c11\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528bitmap\u538b\u7f29\uff0c\u4f8b\u5982\u6570\u636e\u4e3a\u6027\u522bmale, female\uff0c\u8f6c\u5316\u4e3a\u4e24\u4e2abit\u4f4d\u6570\u7b49\u540c\u4e8e\u5217\u6570\u636e\u957f\u5ea6\u7684bitmap\u3002bitmap\u672c\u8eab\u5c31\u6709\u96c6\u5408\u7684\u8bed\u4e49\uff0c\u53ef\u4ee5\u7528\u4e8egroup by\u7b49\u64cd\u4f5c\u7684\u4f18\u5316\u4ee5\u53ca\u96c6\u5408\u8fd0\u7b97\u3002Constant\u7f16\u7801\uff1a\u9488\u5bf9\u8fd1\u4f3cConstant\u7684\u6570\u636e\uff0c\u51fa\u73b0\u9891\u7387\u6700\u9ad8\u7684\u6570\u636e\u89c6\u4e3aConstant\uff0c\u800c\u53ea\u8bb0\u5f55\u6240\u6709\u4e0d\u7b49\u4e8e\u8fd9\u4e2aConstant\u7684\u5f02\u5e38\u503c\u548c\u5b83\u4eec\u7684\u884c\u53f7\uff0cConstant\u7f16\u7801\u5728\u5b9e\u9645\u4e1a\u52a1\u6570\u636e\u4e2d\u5bf9\u5e94\u4f7f\u7528\u4e86\u9ed8\u8ba4\u503c\u7684\u5217\u3002\u00a0\u5bf9\u6bd4\u901a\u7528\u538b\u7f29\u7b97\u6cd5\u548c\u8f7b\u91cf\u538b\u7f29\u7b97\u6cd5\u4ecb\u7ecd\uff0c\u4e0d\u96be\u53d1\u73b0\u8f7b\u91cf\u538b\u7f29\u7b97\u6cd5\u7684\u538b\u7f29\u548c\u89e3\u538b\u8f83\u4e3a\u7b80\u5355\uff0c\u8ba1\u7b97\u4ee3\u4ef7\u5c0f\uff0c\u5e76\u4e14\u538b\u7f29\u540e\u7684\u6570\u636e\u4ecd\u7136\u53ef\u4ee5\u53c2\u4e0e\u8ba1\u7b97\uff0c\u4f8b\u5982RLE\u7f16\u7801\u540e\u7684\u6570\u636e\u7528\u4e8e\u52a0\u901f\u6c42\u548c\uff0cFOR\u7f16\u7801\u7684\u6570\u636e\u66f4\u7d27\u51d1\uff0cCPU\u8ba1\u7b97\u6548\u7387\u66f4\u9ad8\u3002\u00a0\u5b57\u7b26\u4e32\u7684\u8f7b\u91cf\u5b57\u5178\u538b\u7f29\u672c\u8282\u6211\u4eec\u5c55\u5f00\u8ba8\u8bba\u5b57\u7b26\u4e32\u7684\u5b57\u5178\u538b\u7f29\u7b97\u6cd5\uff0c\u6211\u4eec\u6309\u6784\u5efa\u5b57\u5178entry\u7684\u7c92\u5ea6\u5c06\u5b57\u5178\u538b\u7f29\u5206\u4e3a\u4e09\u7c7b\uff1a\u5bf9\u6574\u4e2a\u5b57\u7b26\u4e32\uff0c\u5b50\u5b57\u7b26\u4e32\u548c\u5355\u4e2a\u5b57\u7b26\u7f16\u7801\u7684\u5b57\u5178\u3002\u5206\u522b\u4f7f\u7528direct map\uff0cpattern map\uff0cchar map\u533a\u5206\u4e09\u7c7b\u7b97\u6cd5\u3002\u8fd9\u4e09\u7c7b\u7b97\u6cd5\u53ca\u5bf9\u5e94\u7684\u5178\u578b\u7b97\u6cd5\u5982\u4e0b\uff1adirect map: dictionarypattern map: FSST\uff0c\u89c1\u8bba\u6587[4]char map: huffman\u00a0\u5176\u4e2d\uff0c\u4ece\u7b97\u6cd51-&gt;\u7b97\u6cd53\uff0c\u7b97\u6cd5\u7684\u901a\u7528\u7a0b\u5ea6\u4f4e-&gt;\u901a\u7528\u7a0b\u5ea6\u9ad8\uff0c\u89e3\u538b\u901f\u5ea6\u9ad8-&gt;\u89e3\u538b\u901f\u5ea6\u4f4e\uff0c\u538b\u7f29\u6bd4\u5219\u4e0e\u5b9e\u9645\u6570\u636e\u7684\u5206\u5e03\u6709\u5173\u3002\u5bf9\u4e8ecardinality\u8f83\u5c0f\u7684\u6570\u636e\u5982category\u7c7b\u7684\u6570\u636e\u5e94\u4f7f\u7528dictionary\uff0c\u53ef\u83b7\u5f97\u8f83\u9ad8\u7684\u538b\u7f29\u6bd4\u3002\u5bf9\u4e8epattern skew\u7684\u60c5\u51b5\uff0c\u4f8b\u5982urls\u96c6\u5408\uff0cFSST\u66f4\u9002\u7528\u3002Huffman\u7f16\u7801\u5728GZIP\u548cZSTD\u4e2d\u4f7f\u7528\uff0c\u4f7f\u7528Huffman\u7f16\u7801\u5bf9\u6ed1\u52a8\u7a97\u53e3\u538b\u7f29\u8fc7\u7684\u6570\u636e\u518d\u8fdb\u884c\u538b\u7f29\uff0c\u8fdb\u4e00\u6b65\u589e\u52a0\u538b\u7f29\u6bd4\u3002\u00a0\u5b57\u5178\u538b\u7f29\u7b97\u6cd5\u901a\u5e38\u5177\u6709\u4fdd\u5e8f\u6027: \u5982\u4e0b\u56fe\u6240\u793a\u5b57\u5178\u6620\u5c04\u540e\u539f\u5b57\u7b26\u4e32\u548c\u7f16\u7801\u76f8\u5bf9\u987a\u5e8f\u4e0d\u53d8\uff0c\u65b9\u4fbf\u76f4\u63a5\u5728\u538b\u7f29\u6570\u636e\u4e0a\u8fdb\u884crange\u67e5\u8be2\u4f18\u5316\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305424\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><br \/>\u4fdd\u5e8f\u6027\u793a\u4f8b\uff0c\u538b\u7f29\u7f16\u7801\u540e\u7684\u6570\u636e\u987a\u5e8f\u4e0d\u53d8, abc(8) &lt; abcdef(17) &lt; xyz(95)\uff0c\u62ec\u53f7\u5185\u4e3a\u7f16\u7801\u540e\u7684\u6570\u636e\u00a0\u7f16\u7801\u65b9\u5f0f\u7684\u53d8\u957fvs\u5b9a\u957f\uff0c\u53d8\u957f\u7684\u538b\u7f29\u6bd4\u66f4\u9ad8\uff0c\u4f46\u89e3\u538b\u901f\u5ea6\u66f4\u6162\uff0c\u53d8\u957f\u6570\u636e\u901a\u8fc7padding\u53ef\u4ee5\u8f6c\u5316\u4e3a\u5b9a\u957f\uff0c\u4fbf\u4e8e\u4f7f\u7528SIMD\u52a0\u901f\u8ba1\u7b97\u3002direct map\u5219\u662f\u5b9a\u957f\u7f16\u7801\uff0c\u800cpattern map\u548cchar map\u4e3a\u53d8\u957f\uff0c\u7f16\u7801\u65b9\u5f0f\u5f71\u54cd\u4e09\u8005\u7684\u89e3\u538b\u901f\u5ea6\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305425\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><br \/>\u4e09\u7c7b\u5b57\u7b26\u4e32\u5b57\u5178\u538b\u7f29\u793a\u4f8b\uff0c\u4ece\u5de6\u5230\u53f3\uff0c\u538b\u7f29\u7684\u7c92\u5ea6\u4ece\u9ad8\u5230\u4f4e\uff0c\u901a\u7528\u7a0b\u5ea6\u4f4e-&gt;\u901a\u7528\u7a0b\u5ea6\u9ad8\uff0c\u89e3\u538b\u901f\u5ea6\u9ad8-&gt;\u89e3\u538b\u901f\u5ea6\u4f4e\u3002\u00a0\u5ef6\u8fdf\u89e3\u538b\u52a0\u901f\u8ba1\u7b97\u6570\u636e\u538b\u7f29\u80fd\u51cf\u5c11\u5b58\u50a8\u7a7a\u95f4\u548cIO\u7684\u5f00\u9500\uff0c\u4ee3\u4ef7\u662f\u9700\u8981\u652f\u4ed8\u989d\u5916\u7684\u8ba1\u7b97\u8d44\u6e90\u5bf9\u6570\u636e\u8fdb\u884c\u89e3\u538b\uff0c\u662f\u65f6\u95f4\u6362\u7a7a\u95f4\u7684trade-off\u3002\u7531\u4e8eIO\u5e26\u5bbd\u76f8\u6bd4\u8ba1\u7b97\u8d44\u6e90\u66f4\u5bb9\u6613\u6210\u4e3a\u74f6\u9888\uff0c\u56e0\u6b64\u5f00\u542f\u538b\u7f29\u540e\uff0c\u6027\u80fd\u4f1a\u63d0\u5347\u3002\u4f46\u6570\u636e\u5728\u5185\u5b58\u538b\u7f29\u65f6\uff0c\u6570\u636e\u89e3\u538b\u5360\u7528\u8ba1\u7b97\u8d44\u6e90\uff0c\u964d\u4f4e\u5e76\u884c\u5ea6\uff0c\u53ef\u80fd\u5bfc\u81f4\u5217\u5b58\u67e5\u8be2\u6210\u500d\u7684\u6027\u80fd\u4e0b\u964d\u3002\u56e0\u6b64\u5982\u679c\u6761\u4ef6\u5141\u8bb8\uff0c\u907f\u514d\u89e3\u538b\u6216\u8005\u5ef6\u8fdf\u89e3\u538b\uff0c\u76f4\u63a5\u5728\u538b\u7f29\u6570\u636e\u4e0a\u67e5\u8be2\u662f\u6709\u5fc5\u8981\u7684\u3002\u4f8b\u5982\u5bf9\u4e8e\u4ee5\u4e0b\u67e5\u8be2\uff1aSELECT COUNT(1) FROM table_a WHERE col_1 = &#8220;xxx&#8221;;\u00a0\u5047\u8bbe\u6211\u4eec\u5c06col_1\u5217\u6570\u636e\u4ee5\u538b\u7f29\u540e\u7684\u7f16\u7801\u5b58\u653e\uff0c\u5e76\u5728\u6267\u884c\u67e5\u8be2\u65f6\u4f7f\u7528\u5b57\u5178\u5c06\u67e5\u8be2\u6761\u4ef6\u4e2d\u7684\u5b57\u7b26\u4e32&#8221;xxx&#8221;\u6620\u5c04\u4e3a\u6570\u5b57\uff0c\u67e5\u8be2\u65f6\u5c31\u80fd\u4f7f\u7528\u5b57\u5178\u538b\u7f29\u7ed3\u679c\u4e0e&#8221;xxx&#8221;\u7684\u6620\u5c04\u503c\u76f4\u63a5\u8fdb\u884c\u6bd4\u8f83\uff0c\u4ece\u800c\u5c06string\u6bd4\u8f83\u8f6c\u5316\u4e3aint\u6570\u636e\u6bd4\u8f83\uff0c\u53ef\u51cf\u5c11\u5185\u5b58\u5e26\u5bbd\u538b\u529b\u548c\u8ba1\u7b97\u4ee3\u4ef7\uff0c\u63d0\u9ad8\u6027\u80fd\u3002\u00a0\u53ef\u89c1\u5728\u7279\u5b9a\u7684\u67e5\u8be2\u548c\u4f7f\u7528\u4e86\u7279\u5b9a\u7684\u538b\u7f29\u7b97\u6cd5\u4e0b\uff0c\u6211\u4eec\u80fd\u591f\u76f4\u63a5\u5728\u538b\u7f29\u6570\u636e\u4e0a\u67e5\u8be2\uff0c\u7531\u4e8e\u6570\u636e\u538b\u7f29\u540e\u6bd4\u8f83\u7684\u8ba1\u7b97\u91cf\u51cf\u5c11\uff0c\u5185\u5b58\u4e2d\u53efcache\u66f4\u591a\u6570\u636e\uff0c\u67e5\u8be2\u6027\u80fd\u5c06\u6709\u660e\u663e\u7684\u63d0\u5347\u3002Oracle IMC\uff0cDB2 BLU\u7b49\u5217\u5b58\u4ea7\u54c1\u5b9e\u73b0\u4e86\u5c3d\u53ef\u80fd\u907f\u514d\u89e3\u538b\u64cd\u4f5c\u7684\u4f18\u5316\uff0c\u800c\u4e14\u5c06\u8be5\u4f18\u5316\u4f5c\u4e3a\u548c\u540c\u7c7b\u5217\u5b58\u4ea7\u54c1\u5bf9\u6bd4\u7684\u4e00\u4e2a\u91cd\u8981\u7279\u5f81\u3002\u672c\u8282\u6211\u4eec\u4ecb\u7ecd\u8bba\u6587[5]\u7684\u76f4\u63a5\u67e5\u8be2\u538b\u7f29\u6570\u636e\u7684\u7b97\u6cd5\u539f\u7406\u3002\u00a0\u652f\u6301\u5ef6\u8fdf\u89e3\u538b\u7684\u7b97\u5b50\u00a0[SCAN\u4e0b\u63a8]Scan\u7b97\u5b50\u7684\u5ef6\u8fdf\u89e3\u538b\u52a0\u901f\uff0c\u4e3b\u8981\u662f\u8c13\u8bcd\u4e0b\u63a8\uff0c\u5728\u538b\u7f29\u6570\u636e\u4e0a\u76f4\u63a5\u8fc7\u6ee4\u3002string\u7c7b\u578b\u6570\u636e\uff0c\u5bf9\u4e8estring\u7c7b\u578b\u5b57\u5178\u538b\u7f29\uff1a\u00a0\u4f7f\u7528\u4fdd\u5e8fdirect map\u5b57\u5178\u7f16\u7801\uff0c\u538b\u7f29\u540e\u6570\u636e\u7c7b\u578b\u7531string -&gt; int\uff0c\u901a\u8fc7\u91cd\u5199\u67e5\u8be2\uff0c\u5c06string\u6bd4\u8f83\u8f6c\u5316\u4e3aint\u6570\u636e\u6bd4\u8f83\uff0c\u53ef\u652f\u6301QE, NE, Between, LT, GE, IN, \u524d\u7f00\u7684like\u7b49\u6bd4\u8f83\uff0c\u9002\u7528\u4e8ecardinality\u4e0d\u5927\u7684\u5217(50,000~100,000)\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305426\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><br \/>direct map\u5b57\u5178\u7f16\u7801\uff0c\u7f16\u7801\u540e\u7684\u6570\u636e\u5177\u6709\u4fdd\u5e8f\u6027\uff0c\u56fe\u4e2d&#8217;Whole Milk*&#8217;\u6a21\u7cca\u5339\u914d\u88ab\u6539\u5199\u4e3ap_name\u7684[32000, 32100]\u4e2d\u7684range\u67e5\u8be2\u3002\u00a0\u4f7f\u7528Pattern map\u4f8b\u5982FSST, \u538b\u7f29\u540e\u4ecd\u7136\u662fstring\uff0c\u53ef\u652f\u6301QE, NE, IN\u7b49\u64cd\u4f5c\u3002\u7531\u4e8ePattern map\u5b57\u5178\u4e0d\u4fdd\u5e8f\u6478\uff0c\u56e0\u6b64\u53ea\u652f\u6301\u70b9\u67e5\u8be2\u7684\u5ef6\u8fdf\u89e3\u538b\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305427\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><br \/>Pattern map\u5b57\u5178\u7684\u67e5\u8be2\u6539\u5199\u3002\u5ef6\u8fdf\u89e3\u538b\u4e3b\u8981\u52a0\u901f\u70b9\u67e5\u8be2\u3002\u00a0int\u7c7b\u578b\u6570\u636e\uff0c\u4f8b\u5982int64\u7c7b\u578b\u4f7f\u7528FOR\u7b97\u6cd5\u538b\u7f29\u523015bits\uff0c\u5f53\u67e5\u8be2\u6761\u4ef6\u4e3a col = value\uff0c\u5219\u5c06value\u6539\u5199\u4e3avalue &#8211; min\u5373\u53ef\u3002\u00a0[JOIN]\u8bba\u6587[5]\u63d0\u5230RLE\u548cbit vector\u7f16\u7801\uff0c\u4ee5nested loop join\u4e3a\u4f8b\uff0c\u5f53\u53d1\u73b0\u5176\u4e2d\u4e00\u5217\u4e3aRLE\u65f6\uff0c\u4fbf\u80fd\u8df3\u8fc7k\u6b21\u6bd4\u8f83(k \u662frun length)\u3002\u6b64\u4e3a\u5982\u679c\u4f7f\u7528\u4e86\u5168\u5c40\u5b57\u5178\uff0c\u5373\u4e0d\u540c\u7684\u5217\u4f7f\u7528\u4e86\u76f8\u540c\u7684\u5b57\u5178\u538b\u7f29\uff0c\u90a3\u4e24\u5217\u53ef\u4ee5\u76f4\u63a5\u8fdb\u884c\u5ef6\u8fdf\u89e3\u538b\u7684\u6bd4\u8f83\u64cd\u4f5c\uff0c\u8fd4\u56de\u5339\u914d\u7684\u884cid\uff0c\u4ece\u800c\u52a0\u901fJOIN\u3002\u00a0[GROUPBY\u805a\u5408]\u6570\u636e\u4ee5RLE\u7f16\u7801\uff0cbitmap\u7f16\u7801\u6216\u8005\u5b57\u5178\u7f16\u7801\u65f6\u53ef\u4ee5\u52a0\u901fgroupby\u805a\u5408\u3002RLE\uff0cbitmap\u548c\u5b57\u5178\u76f8\u5f53\u4e8e\u5df2\u7ecf\u8fdb\u884c\u4e00\u8f6e\u805a\u7c7b\uff0c\u5728\u8fd9\u57fa\u7840\u4e0a\uff0c\u53ef\u4ee5\u5bf9\u4f8b\u5982aggregation, distinct\u8ba1\u7b97\u8fdb\u884c\u4f18\u5316\uff0c\u4f8b\u5982RLE\u7f16\u7801\u7684\u6c42\u548c\u8f6c\u5316\u4e3av * run length\u7684\u548c\uff0cdistinct\u76f8\u5173\u8ba1\u7b97\u4ec5\u9700\u8981\u626b\u63cf\u5b57\u5178\u6216\u8005\u8fd4\u56de\u5b57\u5178\u5927\u5c0f\u3002\u00a0\u538b\u7f29\u6570\u636eSCAN\u7684\u8c13\u8bcd\u4e0b\u63a8AP\u67e5\u8be2\u901a\u5e38\u9700\u8981\u626b\u63cf\u5927\u91cf\u843d\u76d8\u6570\u636e\u3002\u538b\u7f29\u6570\u636eSCAN\u7684\u8c13\u8bcd\u4e0b\u63a8\uff0c\u5e38\u4e0e\u5b57\u5178\u538b\u7f29\u7b97\u6cd5\u7ed3\u5408\uff0c\u5b9e\u73b0\u5ef6\u8fdf\u89e3\u538b\u52a0\u901f\u67e5\u8be2\u3002\u538b\u7f29\u6570\u636eSCAN\u7684\u8c13\u8bcd\u4e0b\u63a8\uff0c\u4e3b\u8981\u5305\u62ec\u4ee5\u4e0b3\u4e2a\u8fc7\u7a0b\uff1a\u5143\u4fe1\u606f\u68c0\u67e5\uff0c\u662f\u5426\u7b26\u5408\u5ef6\u8fdf\u89e3\u538b\u7684\u6761\u4ef6\u3002\u8c13\u8bcd\u6539\u5199\uff0c\u4f7f\u7528\u76f8\u540c\u7684\u5b57\u5178\u6539\u5199\u67e5\u8be2\u6761\u4ef6\u3002\u8c13\u8bcd\u4e0b\u63a8\uff0c\u626b\u63cf\u538b\u7f29\u6570\u636e\uff0c\u8fd4\u56de\u5339\u914d\u884c\u3002\u00a0\u5b9e\u9645\u4e0a\uff0c\u5728\u6570\u636e\u5e93\u4e2d\u5b57\u7b26\u4e32\u7684\u6bd4\u8f83\uff0c\u4e0d\u4ec5\u9700\u8981\u8003\u8651charset\uff0c\u8fd8\u8981\u8003\u8651collation\u3002Collation\u5b9a\u4e49\u4e86\u5b57\u7b26\u96c6\u4e2d\u5143\u7d20\u7684\u987a\u5e8f\uff0c\u5b83\u672c\u8d28\u662f\u4e00\u79cd\u6620\u5c04\uff0c\u5c06\u5b57\u7b26\u6620\u5c04\u4e3a\u53ef\u6bd4\u8f83\u987a\u5e8f\u7684\u7f16\u7801\u3002\u5982\u679ccollation\u4e3a\u4e8c\u8fdb\u5236\u5e8fbinary\uff0c\u76f4\u63a5\u5728\u538b\u7f29\u6570\u636e\u4e0a\u6bd4\u8f83\u6ca1\u6709\u95ee\u9898\uff0c\u4f46\u51e0\u4e4e\u6240\u6709\u5b57\u7b26\u96c6\u9ed8\u8ba4\u7684collation\u4e0d\u662fbinary\uff0c\u4f8b\u5982latin1\u5b57\u7b26\u96c6\u7684\u9ed8\u8ba4collation\u4e3alatin1_swedish_ci\uff0c\u4e0b\u56fe\u4e3a\u8be5collation\u7684\u90e8\u5206\u622a\u56fe\u3002\u53ef\u4ee5\u770b\u5230\u5c3d\u7ba1A, a\u7b49\u4e8c\u8fdb\u5236\u7f16\u7801\u4e0d\u540c\uff0c\u4f46\u5728\u6bd4\u8f83\u65f6\u88ab\u8ba4\u4e3a\u662f\u76f8\u540c\u3002\u5927\u90e8\u5206collation\u95ee\u9898\u5728\u4e8e\u5b83\u662fn\u5bf91\u7684\u6620\u5c04\u5173\u7cfb\uff0c\u800c\u65e0\u635f\u538b\u7f29\u7b97\u6cd5\u662f1\u5bf91\u6620\u5c04\uff0c\u56e0\u6b64\u65e0\u6cd5\u76f4\u63a5\u4f7f\u7528\u538b\u7f29\u540e\u7684\u7f16\u7801\u8fdb\u884c\u6bd4\u8f83\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305428\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><br \/>\u5de6\u4fa7\u4e3a\u56fe\u4f8b\uff0ccollation\u6b21\u5e8f\u56fe\u4e2d\u53ef\u4ee5\u770b\u5230\u5728latin1\u5b57\u7b26\u96c6\uff0ccollation\u4e3alatin1_swedish_ci\u7684\u60c5\u51b5\u4e0b\uff0cascii\u7801\u4e3a41, 61, C0&#8230;E3\u7f16\u7801\u7684\u5b57\u7b26\u5728\u6bd4\u8f83\u65f6\u662f\u76f8\u540c\u7684collation\u5e8f\u3002\u00a0\u6211\u4eec\u4e3e\u4e2a\u4f8b\u5b50\u6765\u8bf4\u660e\u8fd9\u4e2a\u95ee\u9898\uff0c\u5b57\u7b26\u4e32\u201cabc\u201d, \u201cabcdef\u201d, \u201cxyz\u201d, \u201c\u00e5bc\u201d\u5b57\u5178\u538b\u7f29\u540e\u4e3a\u201c8,17,95,100\u201d\uff0c\u538b\u7f29\u540e\u662f\u4fdd\u8bc1\u5b57\u5178\u5e8f\u7684\uff0c\u201cabc\u201d\u548c \u201c\u00e5bc\u201d\u4ec5\u770b\u538b\u7f29\u7684\u7f16\u7801\u201c8\u201d\u548c\u201c100\u201d\u662f\u4e0d\u540c\u7684\uff0c\u5728\u5e26collation\u7684\u6bd4\u8f83\u65f6\u5374\u88ab\u8ba4\u4e3a\u662f\u540c\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u56e0\u6b64\u65e0\u6cd5\u8fd0\u7528\u5ef6\u8fdf\u89e3\u538b\uff0c\u5fc5\u987b\u8fdb\u884c\u89e3\u538b\u540e\u4f7f\u7528\u5e26collation\u7684\u6bd4\u8f83\u3002\u90a3\u95ee\u9898\u662f\u53ef\u4ee5\u4f7f\u7528collation\u987a\u5e8f\u4ee3\u66ff\u5b57\u5178\u5e8f\u5417\uff1f\u663e\u7136\u662f\u4e0d\u884c\u7684\uff0c\u5982\u679c\u6211\u4eec\u53ea\u4fdd\u5b58collation\uff0c\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5982\u679c\u8981\u89e3\u7801\u6570\u5b571\uff0c\u5b83\u5373\u53ef\u4ee5\u662f\u201cabc\u201d\uff0c\u53c8\u53ef\u4ee5\u662f\u201c\u00e5bc\u201d\uff0c\u65e0\u6cd5\u9006\u6620\u5c04\uff0c\u53ef\u89c1collation\u53ea\u80fd\u7528\u4e8e\u987a\u5e8f\u7684\u6bd4\u8f83\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042305429\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><br \/>\u5e26collation\u7684\u6bd4\u8f83\u95ee\u9898\uff1a\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u00e5bc\u548cabc\u5728\u5b57\u5178\u7f16\u7801\u7684\u4f4d\u7f6e\u662f\u4fdd\u5e8f\u7684 8 &lt; 100\uff0c\u4f46\u5b9e\u9645\u6bd4\u8f83\u65f6\u5e26collation\u4f1a\u8ba4\u4e3a\u5b83\u4eec\u76f8\u540c(\u90fd\u662f1)\uff0c\u5982\u679c\u5e0c\u671b\u5ef6\u8fdf\u89e3\u538b\u4f18\u5316\uff0c\u90a3\u4e488\u548c100\u9700\u8981\u88ab\u6620\u5c04\u52301\uff0c\u8fd9\u662f\u4e00\u4e2a\u989d\u5916\u4fe1\u606f\uff0c\u65e0\u6cd5\u5728\u4e0d\u89e3\u538b\u5b57\u7b26\u4e32\u7684\u60c5\u51b5\u4e0b\u83b7\u5f97(\u9ec4\u8272\u66f2\u7ebf\u8868\u793aencode\u7a7a\u95f4\u5230collation\u7a7a\u95f4\u7684\u53d8\u6362\uff0c\u6709\u4e2a\u201cX\u201d\u8868\u793a\u65e0\u6cd5\u76f4\u63a5\u4f7f\u7528\u5b57\u7b26\u4e32\u7684collation\u8fdb\u884c\u8fd9\u4e2a\u53d8\u6362)\u00a0\u4e00\u4e2a\u89e3\u51b3\u65b9\u6848\u662f\u901a\u8fc7\u989d\u5916\u4fdd\u5b58collation\u7ed3\u679c\uff0c\u53ef\u4ee5\u52a0\u901f\u4f7f\u7528\u5217\u9ed8\u8ba4collation\u8fdb\u884c\u6bd4\u8f83\u7684\u67e5\u8be2\u3002\u901a\u8fc7\u5b58\u50a8collation\u7ed3\u679c\uff0c\u53ef\u4ee5\u5728\u5b57\u7b26\u4e32\u6bd4\u8f83\u65f6\u8282\u7701\u8ba1\u7b97\uff0c\u7f3a\u70b9\u662f\u5b58\u50a8collation\u7f16\u7801\u9700\u8981\u989d\u5916\u5185\u5b58\u548c\u5b58\u50a8\u7a7a\u95f4\uff0c\u5bf9\u538b\u7f29\u6bd4\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\u5728IMCI\u4e2d\uff0c\u6211\u4eec\u9a8c\u8bc1\u4e86\u538b\u7f29\u6570\u636eSCAN\u7684\u8c13\u8bcd\u4e0b\u63a8\u6548\u679c\uff0c\u5728\u4e0d\u540c\u7684scan\u67e5\u8be2\u573a\u666f\u4e2d\u83b7\u5f97\u4e863 ~ 20\u500d\u7684\u67e5\u8be2\u52a0\u901f\u3002\u00a0\u603b\u7ed3\u4ee5\u53ca\u540e\u7eed\u5de5\u4f5c\u6570\u636e\u538b\u7f29\u4f5c\u4e3a\u6570\u636e\u5e93\u4e00\u9879\u91cd\u8981\u6280\u672f\uff0c\u5728\u5217\u5b58\u6267\u884c\u4e2d\u7ed3\u5408\u5ef6\u8fdf\u89e3\u538b\uff0c\u5728\u7cfb\u7edf\u6027\u80fd\u548c\u6210\u672c\u7684\u5e73\u8861\u4e2d\u8d77\u5230\u5173\u952e\u4f5c\u7528\u3002\u672c\u6587\u9996\u5148\u4ecb\u7ecd\u6570\u636e\u538b\u7f29\u7684\u7406\u8bba\u57fa\u7840\uff0c\u4fe1\u606f\u8bba\uff0c\u5176\u4e3a\u538b\u7f29\u6548\u679c\u5b9a\u4e49\u4e86\u8fb9\u754c\uff0c\u7136\u540e\u5206\u6790\u4e86\u6570\u636e\u538b\u7f29\u5728\u884c\u5b58\u548c\u5217\u5b58\u6570\u636e\u5e93\u4e2d\u7684\u4e0d\u540c\u3002\u538b\u7f29\u65b9\u6cd5\u5206\u4e3a\u901a\u7528\u538b\u7f29\u548c\u8f7b\u91cf\u538b\u7f29\uff0c\u6570\u636e\u5e93\u4e2d\u6700\u5e38\u89c1\u7684\u901a\u7528\u538b\u7f29\u7b97\u6cd5LZ4\u548cZSTD\u90fd\u57fa\u4e8eLZ77\u7b97\u6cd5\uff0c\u7136\u540e\u6211\u4eec\u9010\u4e00\u4ecb\u7ecd\u8f7b\u91cf\u538b\u7f29\u65b9\u6cd5\u3002\u968f\u540e\u6211\u4eec\u8ba8\u8bba\u8f7b\u91cf\u538b\u7f29\u6570\u636e\u4e0a\u7684\u76f4\u63a5\u67e5\u8be2\u6280\u672f\uff0c\u5728\u8be5\u90e8\u5206\u6211\u4eec\u4ecb\u7ecd\u57fa\u4e8e\u5b57\u5178\u538b\u7f29\u5b9e\u73b0\u5b57\u7b26\u4e32\u5ef6\u8fdf\u89e3\u538b\u7684\u539f\u7406\uff0c\u5bf9\u6027\u80fd\u7684\u5f71\u54cd\u4ee5\u53ca\u9700\u8981\u89e3\u51b3\u7684\u95ee\u9898\u3002\u00a0IMCI\u662fPolarDB\u8fc8\u5411\u6570\u636e\u5206\u6790\u5e02\u573a\u7684\u7b2c\u4e00\u6b65\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u5c06\u59cb\u7ec8\u5982\u4e00\u5730\u6df1\u6316\u6280\u672f\uff0c\u7ed3\u5408\u4e1a\u52a1\u573a\u666f\uff0c\u4f18\u5316HTAP\u7ec6\u8282\u5e76\u843d\u5b9e\u5230\u5ba2\u6237\u7684\u5b9e\u9645\u5e94\u7528\uff0c\u4e3a\u5ba2\u6237\u964d\u672c\u589e\u6548\u6301\u7eed\u8d4b\u80fd\u3002\u6700\u540e\uff0c\u6211\u4eec\u5c55\u671bPolarDB HTAP\u5728\u538b\u7f29\u6280\u672f\u65b9\u9762\u7684\u540e\u7eed\u5de5\u4f5c\uff1a\u63a2\u7d22\u538b\u7f29\u76f8\u5173\u7684\u6700\u65b0\u7684\u5b66\u672f\u7814\u7a76\u6210\u679c\u5728\u7528\u6237\u5b9e\u9645\u573a\u666f\u7684\u6700\u4f73\u5b9e\u8df5\u3002\u5728\u57fa\u4e8e\u89c4\u5219\u7684\u5217\u538b\u7f29\u9009\u62e9\u7b97\u6cd5\u4e0a\uff0c\u63a2\u7d22\u5e76\u843d\u5730\u57fa\u4e8eschema\u548c\u6570\u636e\u7279\u5f81\u5b9e\u73b0\u6309\u5217\u7684\u667a\u80fd\u538b\u7f29\u7b97\u6cd5\u9009\u62e9\u3002\u63a2\u7d22\u6570\u636e\u5185\u5b58\u538b\u7f29\u6280\u672f\uff0c\u589e\u5927\u5185\u5b58\u7684\u6570\u636e\u5bc6\u5ea6\uff0c\u540c\u65f6\u5229\u7528\u5ef6\u8fdf\u89e3\u538b\u7684\u6280\u672f\u65b9\u6848\uff0c\u52a0\u901f\u67e5\u8be2\uff0c\u5b9e\u73b0\u6027\u80fd\u548c\u6210\u672c\u7684\u517c\u5f97\u3002\u00a0\u53c2\u8003400\u500d\u52a0\u901f, PolarDB HTAP\u5b9e\u65f6\u6570\u636e\u5206\u6790\u6280\u672f\u89e3\u5bc6 \u963f\u91cc\u4e91\u793e\u533aIntroduction to Data Compression. Guy E. Blelloch.Daniel J. Abadi, Samuel R. Madden, and Nabil Hachem. 2008. Column-stores vs. row-stores: how different are they really? In Proceedings of the 2008 ACM SIGMOD international conference on Management of data (SIGMOD &#8217;08). Association for Computing Machinery, New York, NY, USA, 967\u2013980.Peter Boncz, Thomas Neumann, and Viktor Leis. 2020. FSST: fast random access string compression. Proc. VLDB Endow. 13, 12 (August 2020), 2649\u20132661.Daniel Abadi, Samuel Madden, and Miguel Ferreira. 2006. Integrating compression and execution in column-oriented database systems. In Proceedings of the 2006 ACM SIGMOD international conference on Management of data (SIGMOD &#8217;06). Association for Computing Machinery, New York, NY, USA, 671\u2013682.\u539f\u6587\u94fe\u63a5\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=1%2BxsRrtj2cMNd72AqsNK%2FA%3D%3D.lq2qN86ULX6cv75OmR9iCjePmsLVcxhjAyOvpLuZZaqJyG5e0v3c%2Bij5krMrygsq\" rel=\"nofollow\">https:\/\/click.aliyun.com\/m\/10&#8230;<\/a>\u00a0\u672c\u6587\u4e3a\u963f\u91cc\u4e91\u539f\u521b\u5185\u5bb9\uff0c\u672a\u7ecf\u5141\u8bb8\u4e0d\u5f97\u8f6c\u8f7d\u3002<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000042305416\">https:\/\/segmentfault.com\/a\/1190000042305416<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u4ecb\uff1a\u00a0PolarDB MySQL\u662f\u963f\u91cc\u4e91\u81ea\u7814\u7684\u4e91\u539f\u751f\u6570\u636e\u5e93\uff0c\u4e3b\u8981\u5904\u7406\u5728\u7ebf\u4e8b\u52a1\u8d1f\u8f7d(OLTP, OnLine  [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-10006177","post","type-post","status-publish","format-standard","hentry"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10006177"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006177\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}