{"id":184,"date":"2021-06-23T00:07:44","date_gmt":"2021-06-22T16:07:44","guid":{"rendered":"https:\/\/dasmz.com\/?p=184"},"modified":"2021-06-23T00:16:15","modified_gmt":"2021-06-22T16:16:15","slug":"%e9%a1%b9%e7%9b%ae%e7%bc%96%e5%8f%b7-project-paf5-%e4%b9%8b-postgresql-13-3%e6%95%b0%e6%8d%ae%e5%ba%93%e8%ae%be%e8%ae%a1-%e6%a0%b8%e5%bf%83%e6%95%b0%e6%8d%ae%e8%a1%a8%e8%ae%be%e8%ae%a1-2021-6-22","status":"publish","type":"post","link":"https:\/\/dasmz.com\/?p=184","title":{"rendered":"\u9879\u76ee\u7f16\u53f7~\/project\/PAF5 \u4e4b PostgreSQL 13.3\u6570\u636e\u5e93\u8bbe\u8ba1 \u6838\u5fc3\u6570\u636e\u8868\u8bbe\u8ba1 2021-6-22"},"content":{"rendered":"\n<p>\n\u9879\u76ee\u7f16\u53f7~\/project\/PAF5 \u4e4b \u6570\u636e\u5e93\u8bbe\u8ba1 <br>\n\u9879\u76ee\u6570\u636e\u5e93 PostgreSQL 13.3 <br>\n\u6838\u5fc3\u6570\u636e\u8868\u8bbe\u8ba1 <br>\n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\" style=\"border:1px solid black\">\nCREATE TABLE mdata (\nidx bigserial not null primary key,         \/\/ \u81ea\u589e\u7684\u5927\u8303\u56f4\u6574\u6570 \u5927\u5e8f\u5217\u6570\u5b57 1 \u5230 9223372036854775807\nserver_ip inet not null,                    \/\/ \u91cd\u8981\u2605 \u670d\u52a1\u5668IP\u5730\u5740 \u7f51\u7edc\u5730\u5740inet\u7c7b\u578b  xx.xx.xx.xx\/32 \u5982\u679c\u5176\u4ed6\u7c7b\u578b\u7684\u6570\u636e\u5e93 \u8be5\u5b57\u6bb5\u4fee\u6539\u4e3atext\nserver_port integer not null,               \/\/ \u91cd\u8981\u2605 \u670d\u52a1\u5668\u7aef\u53e3 \u6570\u5b57 -2147483648 \u5230 +2147483647\nvtype varchar(6) not null,                  \/\/ \u91cd\u8981\u2605 \u9650\u5236\u957f\u5ea6\u4e3a6\u4e2a\u5b57\u7b26 \u5b57\u7b26\u4e32 \u679a\u4e3e http https socks4 socks5 \nauth varchar(6) not null default 'NoAuth',  \/\/ \u662f\u5426\u9700\u8981\u8ba4\u8bc1 \u957f\u5ea6\u4e3a6\u4e2a\u5b57\u7b26 \u679a\u4e3e NoAuth Auth \u6682\u65f6\u4e0d\u8003\u8651\u9700\u8981\u8ba4\u8bc1\u7684\u6570\u636e\nauth_name text,                             \/\/ \u8ba4\u8bc1\u9700\u8981\u7684\u7528\u6237\u540d \u53ef\u4e3a\u7a7a \u7c7b\u578b\u6587\u672c\nauth_pass text,                             \/\/ \u8ba4\u8bc1\u9700\u8981\u7684\u5bc6\u7801 \u53ef\u4e3a\u7a7a \u7c7b\u578b\u6587\u672c\nstatus varchar(1) not null default 'N',     \/\/ \u91cd\u8981\u2605 \u9650\u5236\u957f\u5ea6\u4e3a1\u4e2a\u5b57\u7b26 \u8868\u793a\u53ef\u7528\u72b6\u6001 \u5b57\u7b26\u4e32 \u679a\u4e3e Y N \u9ed8\u8ba4\u503c\u4e3aN \ncnt integer not null default 0,             \/\/ \u91cd\u8981\u2605 \u68c0\u6d4b\u603b\u6b21\u6570 \u6570\u5b57 1 \u5230 +2147483647\ny_cnt integer not null default 0,           \/\/ \u91cd\u8981\u2605 \u68c0\u6d4b\u6210\u529f\u6b21\u6570 \u6570\u5b57 1 \u5230 +2147483647\nn_cnt integer not null default 0,           \/\/ \u91cd\u8981\u2605 \u68c0\u6d4b\u5931\u8d25\u6b21\u6570 \u6570\u5b57 1 \u5230 +2147483647\nconstncnt integer not null default 0,       \/\/ \u91cd\u8981\u2605 \u8fde\u7eed\u68c0\u6d4b\u5230\u5931\u8d25\u7684\u6b21\u6570 \u5982\u679c\u5f53\u6b21\u68c0\u6d4bstatus\u662fY \u8be5\u503c\u7f6e0 \u5982\u679c\u662fN \u8be5\u503c\u51cf1\nrsp_time real default 0.0,                  \/\/ \u54cd\u5e94\u65f6\u95f4 \u5355\u4f4dms \u9ed8\u8ba4\u503c 0.0\ndownload_speed real default 0.0,            \/\/ \u4e0b\u8f7d\u901f\u5ea6 \u5355\u4f4dkB\/s \u53c2\u8003\u503c 86.32KB\/s \u9ed8\u8ba4\u503c 0.0\nupload_speed real default 0.0,              \/\/ \u4e0b\u8f7d\u901f\u5ea6 \u5355\u4f4dkB\/s \u9ed8\u8ba4\u503c 0.0\nlocation varchar(6),                        \/\/ \u91cd\u8981\u2605 \u56fd\u5bb6\u5730\u533a \u53c2\u8003ISO-3166-1 \u4e24\u4f4d\u5b57\u6bcd\u4ee3\u7801  https:\/\/zh.wikipedia.org\/wiki\/%E5%9C%8B%E5%AE%B6%E5%9C%B0%E5%8D%80%E4%BB%A3%E7%A2%BC\nlocation_more text,                         \/\/ \u56fd\u5bb6\u5730\u533a \u66f4\u591a\u4fe1\u606f\u7684\u8bf4\u660e \u6bd4\u5982\u6807\u8bb0\u57ce\u5e02\u7684\u4fe1\u606f\nisp text,                                   \/\/ IP\u6240\u5c5e\u7684\u8fd0\u8425\u5546\u4fe1\u606f\nanonymity varchar(1) default 'N',           \/\/ \u662f\u5426\u4e3a\u9ad8\u533f\u540d \u5b57\u7b26\u4e32 \u679a\u4e3e Y N  \u9ed8\u8ba4\u503c\u4e3aN \ninsert_time timestamp without time zone default (now()),   \/\/ \u91cd\u8981\u2605 \u8bb0\u5f55\u6570\u636e\u8bb0\u5f55\u5165\u5e93\u7684\u65f6\u95f4 \u683c\u5f0f\u6837\u5f0f YYYY-MM-DD HH-MI-SS\nupdate_time text,                           \/\/ \u91cd\u8981\u2605 \u8bb0\u5f55\u6570\u636e\u8bb0\u5f55\u66f4\u65b0\u7684\u65f6\u95f4 \u683c\u5f0f\u6837\u5f0f YYYY-MM-DD HH-MI-SS\nremark text                                 \/\/ \u5176\u4ed6\u5fc5\u8981\u7684\u5907\u6ce8\u4fe1\u606f\n);\n\n<\/pre>\n\n\n\n<p>\n\u589e\u52a0\u8868\u7684\u5f52\u5c5e\uff0c\u6570\u636e\u552f\u4e00\u7d22\u5f15\u7b49\u5173\u952e\u6743\u9650\u6b65\u9aa4\n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\" style=\"border:1px solid black\">\nCREATE UNIQUE INDEX idx_mdata_main on mdata (server_ip, server_port, vtype);   \/\/ \u521b\u5efa\u552f\u4e00\u7684\u5173\u952e\u5b57\u6bb5\u7d22\u5f15\nALTER TABLE public.mdata OWNER TO apguser;  \/\/ \u5b89\u5168\u9700\u8981 \u66f4\u6539\u6570\u636e\u5230\u666e\u901a\u7528\u6237\n<\/pre>\n\n\n\n<p>\n\u5b9e\u9645\u843d\u5730\u7684\u64cd\u4f5c \n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\" style=\"border:1px solid black\">\npostgres@pve-debian-server-02:~$ psql -d apgdb\npsql (13.3 (Debian 13.3-1.pgdg100+1))\napgdb=# \\d\nDid not find any relations.\napgdb=# CREATE TABLE mdata (\napgdb(# idx bigserial not null primary key,\napgdb(# server_ip inet not null,\napgdb(# server_port integer not null,\napgdb(# vtype varchar(6) not null,\napgdb(# auth varchar(6) not null default 'NoAuth',\napgdb(# auth_name text,\napgdb(# auth_pass text,\napgdb(# status varchar(1) not null default 'N',\napgdb(# cnt integer not null default 0,\napgdb(# y_cnt integer not null default 0,\napgdb(# n_cnt integer not null default 0,\napgdb(# constncnt integer not null default 0,\napgdb(# rsp_time real default 0.0,\napgdb(# download_speed real default 0.0,\napgdb(# upload_speed real default 0.0,\napgdb(# location varchar(6),\napgdb(# location_more text,\napgdb(# isp text,\napgdb(# anonymity varchar(1) default 'N',\napgdb(# insert_time timestamp without time zone default (now()),\napgdb(# update_time text,\napgdb(# remark text\napgdb(# );\nCREATE TABLE\napgdb=# \\d\n public | mdata         | table    | postgres\n public | mdata_idx_seq | sequence | postgres\n\napgdb=# CREATE UNIQUE INDEX idx_mdata_main on mdata (server_ip, server_port, vtype);\nCREATE INDEX\napgdb=# ALTER TABLE public.mdata OWNER TO apguser;\nALTER TABLE\napgdb=# \napgdb=# \napgdb=# \\d\n public | mdata         | table    | apguser\n public | mdata_idx_seq | sequence | apguser\n\napgdb=# \napgdb=# insert into mdata(server_ip, server_port, vtype) values('37.49.127.234',1080,'socks5');\nINSERT 0 1\napgdb=# select server_ip, server_port, vtype, status, cnt, y_cnt, n_cnt, constncnt, location, insert_time, update_time from mdata limit 3;\n   server_ip   | server_port | vtype  | status | cnt | y_cnt | n_cnt | constncnt | location |        insert_time         | update_time \n---------------+-------------+--------+--------+-----+-------+-------+-----------+----------+----------------------------+-------------\n 172.21.22.3   |        8080 | socks5 | N      |   0 |     0 |     0 |         0 |          | 2021-06-22 12:12:59.439876 | \n 175.1.22.3    |        8080 | http   | N      |   0 |     0 |     0 |         0 |          | 2021-06-22 12:12:59.447857 | \n 24.249.199.12 |        4145 | socks5 | N      |   0 |     0 |     0 |         0 |          | 2021-06-22 12:12:59.451406 | \n(3 rows)\n\napgdb=# \n<\/pre>\n\n\n\n<p>\n\u6ce8\u91ca1 \u5982\u679c\u9700\u8981\u5b66\u4e60PostgreSQL\u7684\u5b89\u88c5\uff0c\u5219\u8bf7\u53c2\u8003&#8221;<a href=\"https:\/\/dasmz.com\/?p=168\">\u5728Debian10\u7cfb\u7edf\u4e0a,\u5b89\u88c5\u548c\u4f7f\u7528PostgreSQL\u6570\u636e\u5e93 2021-06-15 https:\/\/dasmz.com\/?p=168<\/a>&#8221;\n<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"574\" height=\"446\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2020\/12\/DONATE.jpg\" alt=\"Donate\" class=\"wp-image-18\" style=\"border:2px solid yellow\"\/><figcaption>\u4e91\u4e5e\u8ba8<\/figcaption><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u9879\u76ee\u7f16\u53f7~\/project\/PAF5 \u4e4b \u6570\u636e\u5e93\u8bbe\u8ba1 \u9879\u76ee\u6570\u636e\u5e93 PostgreSQL 13.3 \u6838\u5fc3\u6570\u636e\u8868\u8bbe [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/184"}],"collection":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=184"}],"version-history":[{"count":3,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/184\/revisions"}],"predecessor-version":[{"id":188,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/184\/revisions\/188"}],"wp:attachment":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}