{"id":170035,"date":"2024-11-06T20:36:18","date_gmt":"2024-11-06T12:36:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/170035\/"},"modified":"2024-11-06T20:36:19","modified_gmt":"2024-11-06T12:36:19","slug":"%e5%85%a7%e5%ad%98%e6%95%b8%e6%93%9a%e5%ba%abr%ef%bc%9a%e5%a6%82%e4%bd%95%e5%b0%87%e6%95%b8%e6%93%9a%e5%8a%a0%e9%80%9f%e5%ad%98%e5%84%b2%ef%bc%9f-%e5%85%a7%e5%ad%98%e6%95%b8%e6%93%9a%e5%ba%abr","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/170035\/","title":{"rendered":"\u5167\u5b58\u6578\u64da\u5eabr\uff1a\u5982\u4f55\u5c07\u6578\u64da\u52a0\u901f\u5b58\u5132\uff1f (\u5167\u5b58\u6578\u64da\u5eabr)"},"content":{"rendered":"<h1 id=\"%e5%85%a7%e5%ad%98%e6%95%b8%e6%93%9a%e5%ba%abr%ef%bc%9a%e5%a6%82%e4%bd%95%e5%b0%87%e6%95%b8%e6%93%9a%e5%8a%a0%e9%80%9f%e5%ad%98%e5%84%b2%ef%bc%9f-aysxQTTJgn\">\u5167\u5b58\u6578\u64da\u5eabR\uff1a\u5982\u4f55\u5c07\u6578\u64da\u52a0\u901f\u5b58\u5132\uff1f<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u7684\u5b58\u5132\u548c\u8655\u7406\u901f\u5ea6\u5c0d\u65bc\u4f01\u696d\u7684\u6210\u529f\u81f3\u95dc\u91cd\u8981\u3002\u5167\u5b58\u6578\u64da\u5eab\uff08In-Memory Database, IMDB\uff09\u4f5c\u70ba\u4e00\u7a2e\u65b0\u8208\u7684\u6578\u64da\u5b58\u5132\u6280\u8853\uff0c\u56e0\u5176\u9ad8\u6548\u7684\u6578\u64da\u8655\u7406\u80fd\u529b\u800c\u53d7\u5230\u5ee3\u6cdb\u95dc\u6ce8\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u5167\u5b58\u6578\u64da\u5eab\u7684\u57fa\u672c\u6982\u5ff5\u3001\u512a\u52e2\u4ee5\u53ca\u5982\u4f55\u5229\u7528\u5167\u5b58\u6578\u64da\u5eabR\u4f86\u52a0\u901f\u6578\u64da\u5b58\u5132\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e5%85%a7%e5%ad%98%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9f-aysxQTTJgn\">\u4ec0\u9ebc\u662f\u5167\u5b58\u6578\u64da\u5eab\uff1f<\/h2>\n<p>\u5167\u5b58\u6578\u64da\u5eab\u662f\u4e00\u7a2e\u5c07\u6578\u64da\u5b58\u5132\u5728\u8a08\u7b97\u6a5f\u7684\u4e3b\u5167\u5b58\uff08RAM\uff09\u4e2d\uff0c\u800c\u975e\u50b3\u7d71\u7684\u78c1\u789f\u9a45\u52d5\u5668\u4e0a\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u3002\u9019\u7a2e\u5b58\u5132\u65b9\u5f0f\u4f7f\u5f97\u6578\u64da\u7684\u8b80\u53d6\u548c\u5beb\u5165\u901f\u5ea6\u5927\u5e45\u63d0\u5347\uff0c\u56e0\u70ba\u5167\u5b58\u7684\u8a2a\u554f\u901f\u5ea6\u9060\u5feb\u65bc\u78c1\u789f\u3002\u5167\u5b58\u6578\u64da\u5eab\u901a\u5e38\u7528\u65bc\u9700\u8981\u5feb\u901f\u97ff\u61c9\u7684\u61c9\u7528\u5834\u666f\uff0c\u5982\u91d1\u878d\u4ea4\u6613\u3001\u5373\u6642\u5206\u6790\u548c\u5927\u6578\u64da\u8655\u7406\u7b49\u3002<\/p>\n<h2 id=\"%e5%85%a7%e5%ad%98%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%84%aa%e5%8b%a2-aysxQTTJgn\">\u5167\u5b58\u6578\u64da\u5eab\u7684\u512a\u52e2<\/h2>\n<ul>\n<li><strong>\u9ad8\u6027\u80fd\uff1a<\/strong>\u5167\u5b58\u6578\u64da\u5eab\u80fd\u5920\u5728\u6beb\u79d2\u7d1a\u5225\u5167\u5b8c\u6210\u67e5\u8a62\uff0c\u9019\u5c0d\u65bc\u9700\u8981\u5373\u6642\u6578\u64da\u8655\u7406\u7684\u61c9\u7528\u81f3\u95dc\u91cd\u8981\u3002<\/li>\n<li><strong>\u7c21\u5316\u67b6\u69cb\uff1a<\/strong>\u7531\u65bc\u6578\u64da\u5b58\u5132\u5728\u5167\u5b58\u4e2d\uff0c\u5167\u5b58\u6578\u64da\u5eab\u901a\u5e38\u4e0d\u9700\u8981\u8907\u96dc\u7684\u7d22\u5f15\u7d50\u69cb\uff0c\u9019\u4f7f\u5f97\u6578\u64da\u6a21\u578b\u66f4\u52a0\u7c21\u55ae\u3002<\/li>\n<li><strong>\u5be6\u6642\u5206\u6790\uff1a<\/strong>\u5167\u5b58\u6578\u64da\u5eab\u652f\u6301\u5be6\u6642\u6578\u64da\u5206\u6790\uff0c\u4f01\u696d\u53ef\u4ee5\u5373\u6642\u7372\u53d6\u6d1e\u5bdf\uff0c\u505a\u51fa\u5feb\u901f\u6c7a\u7b56\u3002<\/li>\n<li><strong>\u64f4\u5c55\u6027\uff1a<\/strong>\u8a31\u591a\u5167\u5b58\u6578\u64da\u5eab\u7cfb\u7d71\u652f\u6301\u5206\u4f48\u5f0f\u67b6\u69cb\uff0c\u80fd\u5920\u8f15\u9b06\u64f4\u5c55\u4ee5\u61c9\u5c0d\u4e0d\u65b7\u589e\u9577\u7684\u6578\u64da\u9700\u6c42\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%85%a7%e5%ad%98%e6%95%b8%e6%93%9a%e5%ba%abr%e7%9a%84%e6%87%89%e7%94%a8-aysxQTTJgn\">\u5167\u5b58\u6578\u64da\u5eabR\u7684\u61c9\u7528<\/h2>\n<p>\u5167\u5b58\u6578\u64da\u5eabR\u662f\u4e00\u7a2e\u5c08\u70baR\u8a9e\u8a00\u8a2d\u8a08\u7684\u5167\u5b58\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\uff0c\u65e8\u5728\u63d0\u9ad8\u6578\u64da\u8655\u7406\u7684\u6548\u7387\u3002R\u8a9e\u8a00\u5ee3\u6cdb\u61c9\u7528\u65bc\u6578\u64da\u5206\u6790\u548c\u7d71\u8a08\u5efa\u6a21\uff0c\u800c\u5167\u5b58\u6578\u64da\u5eabR\u5247\u80fd\u5920\u52a0\u901f\u9019\u4e9b\u904e\u7a0b\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5167\u5b58\u6578\u64da\u5eabR\u7684\u61c9\u7528\u793a\u4f8b\uff1a<\/p>\n<h3 id=\"1-%e6%95%b8%e6%93%9a%e9%a0%90%e8%99%95%e7%90%86-aysxQTTJgn\">1. \u6578\u64da\u9810\u8655\u7406<\/h3>\n<p>\u5728\u9032\u884c\u6578\u64da\u5206\u6790\u4e4b\u524d\uff0c\u6578\u64da\u9810\u8655\u7406\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u6b65\u9a5f\u3002\u4f7f\u7528\u5167\u5b58\u6578\u64da\u5eabR\uff0c\u5206\u6790\u5e2b\u53ef\u4ee5\u5feb\u901f\u52a0\u8f09\u548c\u8655\u7406\u5927\u91cf\u6578\u64da\uff0c\u5f9e\u800c\u7bc0\u7701\u6642\u9593\u4e26\u63d0\u9ad8\u6548\u7387\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684\u793a\u4f8b\uff1a<\/p>\n<pre><code>library(RSQLite)\ncon &lt;- dbConnect(RSQLite::SQLite(), &quot;:memory:&quot;)\ndbWriteTable(con, &quot;data&quot;, my_data_frame)\nresult  100\")\n<\/code><\/pre>\n<h3 id=\"2-%e5%af%a6%e6%99%82%e6%95%b8%e6%93%9a%e5%88%86%e6%9e%90-aysxQTTJgn\">2. \u5be6\u6642\u6578\u64da\u5206\u6790<\/h3>\n<p>\u5167\u5b58\u6578\u64da\u5eabR\u652f\u6301\u5be6\u6642\u6578\u64da\u6d41\u7684\u8655\u7406\uff0c\u9019\u5c0d\u65bc\u9700\u8981\u5373\u6642\u53cd\u61c9\u7684\u696d\u52d9\u5834\u666f\u975e\u5e38\u91cd\u8981\u3002\u4f8b\u5982\uff0c\u91d1\u878d\u5e02\u5834\u7684\u5373\u6642\u4ea4\u6613\u7cfb\u7d71\u53ef\u4ee5\u5229\u7528\u5167\u5b58\u6578\u64da\u5eabR\u4f86\u5feb\u901f\u5206\u6790\u5e02\u5834\u6578\u64da\uff0c\u4e26\u505a\u51fa\u4ea4\u6613\u6c7a\u7b56\u3002<\/p>\n<h3 id=\"3-%e6%a9%9f%e5%99%a8%e5%ad%b8%e7%bf%92%e6%a8%a1%e5%9e%8b%e8%a8%93%e7%b7%b4-aysxQTTJgn\">3. \u6a5f\u5668\u5b78\u7fd2\u6a21\u578b\u8a13\u7df4<\/h3>\n<p>\u5728\u6a5f\u5668\u5b78\u7fd2\u4e2d\uff0c\u8a13\u7df4\u6a21\u578b\u901a\u5e38\u9700\u8981\u5927\u91cf\u7684\u6578\u64da\u8655\u7406\u3002\u5167\u5b58\u6578\u64da\u5eabR\u53ef\u4ee5\u52a0\u901f\u9019\u4e00\u904e\u7a0b\uff0c\u901a\u904e\u5c07\u6578\u64da\u5b58\u5132\u5728\u5167\u5b58\u4e2d\uff0c\u6e1b\u5c11I\/O\u64cd\u4f5c\u7684\u5ef6\u9072\uff0c\u5f9e\u800c\u63d0\u9ad8\u6a21\u578b\u8a13\u7df4\u7684\u901f\u5ea6\u3002<\/p>\n<h2 id=\"%e7%b5%90%e8%ab%96-aysxQTTJgn\">\u7d50\u8ad6<\/h2>\n<p>\u5167\u5b58\u6578\u64da\u5eabR\u4f5c\u70ba\u4e00\u7a2e\u9ad8\u6548\u7684\u6578\u64da\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\uff0c\u80fd\u5920\u986f\u8457\u63d0\u9ad8\u6578\u64da\u8655\u7406\u7684\u901f\u5ea6\u548c\u6548\u7387\u3002\u96a8\u8457\u6578\u64da\u91cf\u7684\u589e\u9577\u548c\u5be6\u6642\u5206\u6790\u9700\u6c42\u7684\u4e0a\u5347\uff0c\u5167\u5b58\u6578\u64da\u5eab\u7684\u61c9\u7528\u5c07\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u666e\u904d\u3002\u5c0d\u65bc\u5e0c\u671b\u63d0\u5347\u6578\u64da\u8655\u7406\u80fd\u529b\u7684\u4f01\u696d\u4f86\u8aaa\uff0c\u9078\u64c7\u5408\u9069\u7684\u5167\u5b58\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\u5c07\u662f\u672a\u4f86\u6210\u529f\u7684\u95dc\u9375\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5c0d\u65bc\u5982\u4f55\u5229\u7528\u5167\u5b58\u6578\u64da\u5eab\u4f86\u63d0\u5347\u60a8\u7684\u696d\u52d9\u6548\u7387\u611f\u8208\u8da3\uff0c\u6216\u8005\u60f3\u4e86\u89e3\u66f4\u591a\u95dc\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u53ca\u5176\u4ed6\u96f2\u670d\u52d9\u7684\u8cc7\u8a0a\uff0c\u6b61\u8fce\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22\u5167\u5b58\u6578\u64da\u5eabR\u7684\u9ad8\u6548\u6578\u64da\u52a0\u901f\u5b58\u5132\u6280\u8853\uff0c\u63d0\u5347\u6578\u64da\u8655\u7406\u901f\u5ea6\uff0c\u512a\u5316\u6027\u80fd\uff0c\u5be6\u73fe\u5373\u6642\u6578\u64da\u8a2a\u554f\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-170035","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/170035","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=170035"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/170035\/revisions"}],"predecessor-version":[{"id":170036,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/170035\/revisions\/170036"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=170035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=170035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=170035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}