{"id":201137,"date":"2020-11-24T07:04:50","date_gmt":"2020-11-23T23:04:50","guid":{"rendered":"http:\/\/4563.org\/?p=201137"},"modified":"2020-11-24T07:04:50","modified_gmt":"2020-11-23T23:04:50","slug":"%e5%9c%a8%e7%99%be%e4%b8%87%e3%80%81%e5%8d%83%e4%b8%87%e7%ba%a7%e6%95%b0%e6%8d%ae%e7%9a%84%e4%b8%80%e5%bc%a0-postgresql-%e8%a1%a8%e4%b8%ad%e5%a6%82%e4%bd%95%e9%ab%98%e6%95%88%e6%90%9c%e7%b4%a2","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=201137","title":{"rendered":"\u5728\u767e\u4e07\u3001\u5343\u4e07\u7ea7\u6570\u636e\u7684\u4e00\u5f20 PostgreSQL \u8868\u4e2d\u5982\u4f55\u9ad8\u6548\u641c\u7d22\u4e00\u4e2a\u6307\u5b9a\u7684\u5185\u5bb9"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5728\u767e\u4e07\u3001\u5343\u4e07\u7ea7\u6570\u636e\u7684\u4e00\u5f20 PostgreSQL \u8868\u4e2d\u5982\u4f55\u9ad8\u6548\u641c\u7d22\u4e00\u4e2a\u6307\u5b9a\u7684\u5185\u5bb9               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : bandian <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5f85\u641c\u7d22\u7684\u5b57\u6bb5\u4e3a json \u7c7b\u578b\uff0c\u8981\u505a\u7684\u662f\u6a21\u7cca\u5339\u914d\u3002<\/p>\n<p>\u5982\u679c\u76f4\u63a5\u4f7f\u7528 like \u5339\u914d\uff0c\u6027\u80fd\u4e0a\u611f\u89c9\u5e94\u8be5\u4f1a\u7206\u70b8\uff0c\u4e0d\u77e5\u9053\u6709\u6ca1\u6709\u4ec0\u4e48\u539f\u751f\u7684\u6bd4\u8f83\u9ad8\u6548\u6216\u8005\u8017\u65f6\u77ed\u7684\u67e5\u8be2\u65b9\u5f0f\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4302387\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : angryfish <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             mysql \u53ef\u4ee5\u521b\u5efa\u865a\u62df\u5b57\u6bb5\uff0c\u6620\u5c04\u8981\u67e5\u8be2\u7684 json \u5b57\u6bb5\uff0c\u4e0d\u77e5\u9053 postgresql \u6709\u6ca1\u6709                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4302388\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : abcfyk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8981\u4e48\u727a\u7272\u5199\u901f\u5ea6\uff0c\u89e3\u6790 json \u51fa\u6765\u518d\u5199\uff0c<br \/>\u8981\u4e48\u727a\u7272\u8bfb\u901f\u5ea6\uff0c\u76f4\u63a5\u5b58 json\uff0c\u8bfb\u7684\u65f6\u5019\u89e3\u6790<\/p>\n<p>\u975e\u8981\u5b58 pg\uff0c\u5c31\u8fd9\u4e24\u4e2a\u65b9\u5411\uff0c\u5176\u4ed6\u7684\u4f18\u5316\u90fd\u662f\u9694\u9774\u6414\u75d2                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4302389\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : MoYi123 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u6e05\u695a\u4f60\u5177\u4f53\u8981\u600e\u6837\u505a\u6a21\u7cca\u67e5\u8be2\uff0c\u4e3e\u51e0\u79cd\u5e38\u89c1\u573a\u666f<br \/>1. \u67e5\u8be2 json \u4e2d\u7684\u7b2c\u4e00\u5c42\u5b58\u5728 key \u4e3a 1 \u7684\u884c\uff0c\u6bd4\u5982{&#8220;1&#8243;:&#8221;abc&#8221;}\uff0c\u9700\u8981\u5728 json \u5217\u5efa gin \u7d22\u5f15<br \/>create index test_data1_gin on test using gin (data1);<br \/>select * from test where data1 ? &#8216;1&#8217;; <\/p>\n<p>2. \u67e5\u8be2 json \u4e2d\u67d0\u4e2a\u5177\u4f53\u952e\u7684\u503c\uff0c\u6bd4\u5982{&#8216;age&#8217;:18},\u9700\u8981\u5bf9 json-&gt;&gt;&#8217;age&#8217;\u5efa\u7d22\u5f15<br \/>create index test_data1_btree on test using btree ((data1 -&gt;&gt; &#8216;age&#8217;));<br \/>select * from test where data1 -&gt;&gt; &#8216;age&#8217; = 18; <\/p>\n<p>3. like &#8216;&#8221;:2&#8217; \u6bd4\u5982'{&#8220;1&#8221;:2}&#8217;\uff0c \u90a3\u8fd9\u4e00\u5217\u4e0d\u5e94\u8be5\u5b58\u4e3a json\uff0c\u5e94\u8be5\u5b58\u4e3a text\uff0c\u7136\u540e\u52a0\u4e0a gin \u7d22\u5f15                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u767e\u4e07\u3001\u5343\u4e07\u7ea7\u6570\u636e\u7684\u4e00\u5f20 Post&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\/201137"}],"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=201137"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/201137\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=201137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=201137"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=201137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}