{"id":215982,"date":"2020-11-17T22:09:34","date_gmt":"2020-11-17T14:09:34","guid":{"rendered":"http:\/\/4563.org\/?p=215982"},"modified":"2020-11-17T22:09:34","modified_gmt":"2020-11-17T14:09:34","slug":"%e8%bf%99%e7%a7%8d%e6%83%85%e5%86%b5%e7%94%a8-jsonb-%e4%bf%9d%e5%ad%98%e5%a5%bd%e8%bf%98%e6%98%af%e7%94%a8%e8%a1%a8%e4%bf%9d%e5%ad%98%e5%a5%bd%e5%91%a2","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=215982","title":{"rendered":"\u8fd9\u79cd\u60c5\u51b5\u7528 jsonb \u4fdd\u5b58\u597d\u8fd8\u662f\u7528\u8868\u4fdd\u5b58\u597d\u5462"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8fd9\u79cd\u60c5\u51b5\u7528 jsonb \u4fdd\u5b58\u597d\u8fd8\u662f\u7528\u8868\u4fdd\u5b58\u597d\u5462               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : FightPig <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e00\u4e2a\u8868\u662f table1,\u53e6\u4e00\u4e2a\u8868\u662f table2\uff0c table1:<\/p>\n<pre><code>id:int name: varchar <\/code><\/pre>\n<p>table2<\/p>\n<pre><code>id:int table1_id:int content: varchar <\/code><\/pre>\n<p>\u5982\u6709\u4e00\u6761 table1 \u8bb0\u5f55\uff0c\u53ef\u80fd\u4e0b\u9762\u6709\u51e0\u5343\u6761 table2 \u8bb0\u5f55\uff0c\u5f53 table1 \u8868\u4e0d\u505c\u589e\u52a0\uff0c\u6211\u53d1\u73b0 table2 \u8868\u6570\u636e\u6700\u540e\u80fd\u8fbe\u5230\u51e0\u4ebf\u6761\uff0c\u7136\u540e\u5982\u679c\u628a table1 \u6539\u6210<\/p>\n<p>talbe1: id: int name: varchar items: jsonb<\/p>\n<p>\u6bd4\u5982\u8fd9\u6837\u4fdd\u5b58, table1 \u4e2d\u628a\u5173\u8054\u4fdd\u5b58\u6210\u8fd9\u6837<\/p>\n<pre><code>items: [{content: \"content1\"}, {content: 'content2'}.....] <\/code><\/pre>\n<p>\u8fd9\u6837\uff0c\u5982\u679c table1 \u6709 100 \u4e07\u6761\uff0c\u4e0d\u7528\u751f\u6210 table2 \u7684 100 \u4e07*\u51e0\u5343\u6761\uff0c\u4e0d\u77e5\u9053\u8fd9\u6837\u884c\u4e0d\u884c\uff1f\u8fd9\u6837 table2 \u4e0d\u4f1a\u51fa\u73b0\u51e0\u4ebf\u751a\u81f3\u51e0\u5341\u4ebf\u6761\u6570\u636e\uff0c\u4e3b\u8981\u6211\u662f\u62c5\u5fc3\u8fd9\u4e2a\u4e0a\u51e0\u4ebf\u901f\u5ea6\u4f1a\u53d8\u5f88\u6162\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4387212\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : echowuhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u53ef\u53d6\u30021. \u80af\u5b9a\u4f1a\u66f4\u6162\uff0c\u53d6\u51b3\u4e8e\u4f60\u67e5\u8be2\u7684\u5185\u5bb9\u3002<br \/>2. \u4ec5 content \u4e00\u4e2a\u8bcd\uff0c\u4e00\u4ebf\u6761\u8bb0\u5f55\u5c31\u589e\u52a0\u4e86\u5feb 650M \u7684\u7a7a\u95f4\u5360\u7528\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u5f04\u4e2a\u51e0\u4e07\u6761\u8bb0\u5f55\u6d4b\u8bd5\u4e00\u4e0b\uff0c\u6211\u53ea\u662f\u731c\u60f3\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4387213\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : echowuhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u67e5\u4e86\u4e00\u4e0b\uff0cjsonb \u4e5f\u6709 size limit\uff0cwhich is 255 MB.<\/p>\n<p>https:\/\/stackoverflow.com\/questions\/12632871\/<\/p>\n<p>\u5982\u679c\u5185\u5bb9\u6bd4\u8f83\u591a\uff0c\u4e0d\u80fd\u7528\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4387214\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : FightPig <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @echowuhao \u8c22\u8c22\uff0c\u4e0a\u9762\u8bf4\u7684\u6709\u70b9\u9519\uff0c\u73b0\u5728 table1 \u8fd9\u4e2a\u8868\u4e0d\u505c\u589e\u957f\uff0c\u5927\u7ea6\u540e\u671f\u6709 100w \u6761\u591a\uff0c\u4e00\u4e2a table1 \u6700\u591a\u5173\u8054 2000 \u591a\u6761 table2 \u6570\u636e\u5427\uff0c\u8fd9\u6837\u4e00\u7b97\uff0ctable2 \u8fd9\u6570\u636e\u91cf\u6709\u70b9\u592a\u5927\uff0c\u5982\u679c\u4fdd\u5b58\u6210 jsonb\uff0c\u90a3\u8fd9\u6837\u4e5f\u5c31\u53ea\u6709 100w \u591a\u6761 table1\uff0c\u611f\u89c9\u67e5\u8be2\u5e94\u8be5\u6bd4\u67e5\u8be2 100w*2000 \u8fd9\u6837\u7684\u6570\u91cf\u597d\u67e5\u8be2\uff0c\u4e3b\u8981\u662f table2 \u8fd9\u4e2a\u8868\u4e0d\u65ad\u81a8\u80c0\uff0c\u5982\u679c\u4fdd\u5b58\u6210 jsonb \u5f62\u5f0f\u7684\uff0c\u6ca1\u6709 1 \u4ebf\u6761\u4e86\uff0c\u53ea\u6709 table1 \u7684\u6761\u6570 100w \u591a\u5427\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4387215\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : echowuhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u5b9e\u9645\u6d4b\u4e00\u4e0b\u3002\u8868\u867d\u7136 row size \u591a\u4e86\u4e00\u70b9\uff0c\u4f46\u662f postgres \u53ef\u4ee5\u6709\u66f4\u591a\u4fe1\u606f\u4f18\u5316\uff0c\u4f60\u5806\u5230 jsonb \u91cc\u9762\uff0cpostgres \u80fd\u77e5\u9053\u7684\u4fe1\u606f\u66f4\u5c11\uff0c\u67e5\u8be2\u7684\u65f6\u5019\u5c31\u8981\u9ebb\u70e6\u4e86\u3002<\/p>\n<p>\u6211\u4e2a\u4eba\u6ca1\u6709\u505a\u8fc7\u90a3\u4e48\u5927\u7684\u8868\uff0c\u6240\u4ee5\u53ea\u80fd\u7406\u8bba\u8bf4\u4e00\u4e0b\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4387216\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : echowuhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @FightPig \u6ca1\u6709\u4e00\u4ebf\u6761\u4e86\uff0c\u4f46\u662f content \u5b57\u7b26\u51fa\u73b0\u7684\u6b21\u6570\u4e0d\u662f table1 row size \u800c\u662f table 2 \u7684\u3002\u4f60\u4e4b\u524d\u53ea\u5bf8\u8fd9\u4e2a\u5b57\u7b26\u4e00\u6b21\uff0c\u5c31\u662f\u5217\u540d\uff0c\u4f46\u662f\u4f60\u5b58\u5230 jsonb \u91cc\u9762\u4e0d\u662f\u4e00\u767e\u4e07\u6b21\uff0c\u800c\u662f\u4e00\u4ebf\u6b21\u3002\u53ea\u4e00\u4ebf\u6b21\u662f\u51ed\u7a7a\u591a\u51fa\u6765\u7684\u5b58\u50a8\u7a7a\u95f4\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4387217\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : emeab <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5148\u786e\u5b9a table2 \u9700\u4e0d\u9700\u8981\u5355\u72ec\u67e5\u8be2 \u5982\u679c\u4e0d\u9700\u8981\u53ef\u4ee5\u7528 jsonb<br \/>json \u5b58\u50a8\u8d77\u6765\u5360\u7528\u7684\u7a7a\u95f4\u4f1a\u6bd4\u8f83\u5927                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4387218\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sjzzz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u79cd\u6700\u7ec8\u8fd8\u662f\u8981\u770b \u540e\u7eed\u7684\u4e1a\u52a1\u903b\u8f91 \u5149\u5206\u6790\u8868\u7ed3\u6784\u610f\u4e49\u4e0d\u5927\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4387219\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : FightPig <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @echowuhao \u55ef\uff0c\u6211\u5355\u72ec\u63d2\u5165 1 \u4ebf\u6761\u8bd5\u4e86\u4e0b\uff0c\u5728\u52a0\u4e86\u5916\u952e\u7d22\u5f15\u4e0b\uff0c\u67e5\u8be2 \u8fd8\u884c\uff0c\u6bd5\u7adf\u4e00\u6761\u8bb0\u5f55\u53ea\u5173\u8054 2000 \u591a\u6761 table2\uff0c<br \/>@emeab table2 \u8981\u66f4\u65b0\uff0c\u6bd4\u5982\u8981\u6539\u4e0b{content1: &#8216;content1&#8217;, content2: &#8216;content2&#8217;}\u66f4\u65b0\u6210{content1: &#8216;content1111&#8217;, content2: &#8216;content2&#8217;}\uff0c\u67e5\u8be2\u7684\u8bdd\uff0c\u53ea\u662f\u8981\u53d6\u51fa \u8fd9\u4e2a jsonb \u7684 key \u6210\u4e00\u4e2a\u6570\u7ec4 [&#8216;content1&#8242;,&#8217;content2&#8217;] ,\u7136\u540e\u7528\u8fd9\u4e2a\u6570\u7ec4\u53bb\u67e5\u53e6\u4e00\u5f20\u8868\u91cc\u7684\u6570\u636e \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4387220\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liprais <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u80af\u5b9a\u5206\u5f00\u554a\uff0c\u4e0d\u7136\u4f60 update \u522b\u7684\u5b57\u6bb5\u7684\u65f6\u5019 jsonb \u4e5f\u88ab\u8bfb\u4e86\u4e00\u904d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4387221\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : FightPig <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @liprais <br \/>@sjzzz \u653e\u5f03 jsonb \u4e86\uff0c\u5728\u6211\u8fd9\u4e24\u5929\u6d4b\u8bd5\uff0c\u52a0\u5165 2000 \u9879\u540e\uff0c \u67e5\u8be2\u8868\u65f6\u6162\u7684\u4e0d\u884c\uff0cgoogle \u770b\u4e86\u4e0b\u597d\u50cf\u662f pg \u7684 jsonb \u7528\u4e86 TOAST\uff0c\u6362\u6210\u4e86 mongodb \u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u79cd\u60c5\u51b5\u7528 jsonb \u4fdd\u5b58\u597d\u8fd8\u662f&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/215982"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=215982"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/215982\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=215982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=215982"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=215982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}