{
  "version": "https://jsonfeed.org/version/1", 
  "title": "PostgreSQL", 
  "description": "The world's most advanced open source database.", 
  "home_page_url": "https://www.v2ex.com/go/postgresql", 
  "feed_url": "https://www.v2ex.com/feed/postgresql.json", 
  "icon": "https://cdn.v2ex.com/navatar/9be4/0cee/365_large.png?m=1524176193", 
  "favicon": "https://cdn.v2ex.com/navatar/9be4/0cee/365_normal.png?m=1524176193", 
  "items": [
    {
      "author": {
        "url": "https://www.v2ex.com/member/woodfizky", 
        "name": "woodfizky", 
        "avatar": "https://cdn.v2ex.com/avatar/87a6/dfbc/621021_large.png?m=1774945282"
      }, 
      "url": "https://www.v2ex.com/t/1185366", 
      "title": "\u9002\u914d\u4fe1\u521b\u6570\u636e\u5e93\u7684\u4eba\u7684\u7cbe\u795e\u72b6\u6001 be like", 
      "id": "https://www.v2ex.com/t/1185366", 
      "date_published": "2026-01-13T13:18:32+00:00", 
      "content_html": "<p>\u9002\u914d\u8fc7\u7a0b\u4e2d\u53d1\u73b0\uff1a\u5982\u679c\u67d0\u4e2a SQL \u7684\u67e5\u8be2\u6761\u4ef6\u662f some_col != ''\uff0c\u90a3\u4e48\u8fd4\u56de\u7684\u7ed3\u679c\u5c31\u4f1a\u662f\u7a7a</p>\n<p>\u4e8e\u662f\u505a\u4e86\u5982\u4e0b\u7b80\u5355\u5b9e\u9a8c\uff1a\nSQL</p>\n<pre><code class=\"language-SQL\">select\n    case\n        when ('1' != '') then '1'\n        when ('1' = '') then '2'\n        else 'else'\n    end as result_1,\n    ('1' = '')::bool as result_2,\n    ('1' != '')::bool as result_3,\n    ('1' != '' or '1' = '') as always_true_1,\n    ('1' != '1' or '1' = '1') as always_true_2\n</code></pre>\n<p>result:</p>\n<pre><code class=\"language-json\">{\n  \"postgres\": {\n    \"result_1\": \"2\",\n    \"result_2\": false,\n    \"result_3\": true,\n    \"always_true_1\": true,\n    \"always_true_2\": true\n  },\n  \"gaussdb\": {\n    \"result_1\": \"else\",\n    \"result_2\": null,\n    \"result_3\": null,\n    \"always_true_1\": null,\n    \"always_true_2\": true\n  }\n}\n</code></pre>\n<p>\u5b8c\u5168\u4e0d\u660e\u767d\u4e3a\u4ec0\u4e48 gaussdb \u7684\u903b\u8f91\u662f\u8fd9\u6837\u7684\uff0c\u5982\u679c\u6709\u4eba\u77e5\u9053\u53ef\u4ee5\u544a\u8bc9\u6211\u4e00\u4e0b\u5417\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Rooger", 
        "name": "Rooger", 
        "avatar": "https://cdn.v2ex.com/avatar/83db/495c/554382_large.png?m=1752245239"
      }, 
      "url": "https://www.v2ex.com/t/1181536", 
      "title": "\u7528\u4e86\u5341\u51e0\u5e74\u7684 MySQL \u4e86\uff0c\u7a81\u7136\u53d1\u73b0 PostgreSQL \u53ef\u80fd\u66f4\u52a0\u9002\u5408\u6211\uff0c\u5927\u5bb6\u600e\u4e48\u770b\uff1f", 
      "id": "https://www.v2ex.com/t/1181536", 
      "date_published": "2025-12-27T02:54:29+00:00", 
      "content_html": "<p>\u4ece 13 \u5e74\u6bd5\u4e1a\u5f00\u59cb\u5c31\u5f00\u59cb\u4f7f\u7528 MySQL \uff0c\u5f53\u65f6\u4e0d\u7406\u89e3 DBA \u628a\u7528\u6237\u8868\u5206\u6210\u4e86 100 \u5f20\uff0c\u540e\u6765\u5728\u522b\u4eba\u7684\u4e00\u901a\u89e3\u91ca\u4e0b\u4e5f\u6e10\u6e10\u7406\u89e3\u4e86\u3002</p>\n<p>17 \u5e74\u81ea\u5df1\u5f00\u59cb\u4f5c\u4e3a\u4e3b\u7a0b\u8d1f\u8d23\u4e00\u4e2a\u65b0\u9879\u76ee\uff0c\u5f53\u65f6\u56e0\u4e3a\u628a\u7528\u6237\u8868\u5206\u6210 100 \u5f20\u8fd8\u8ddf\u8001\u677f\u5435\u8fc7\u67b6\uff08\u56e0\u4e3a\u5f53\u65f6\u53e6\u5916\u4e00\u4e2a\u9879\u76ee\u7684\u8d1f\u8d23\u4eba\u672c\u8eab\u5c31\u662f\u4e2a\u6df7\u6df7\uff0c\u8fd8\u7ed9\u8001\u677f\u4e00\u901a\u4e71\u8bf4\uff0c\u5f04\u7684\u6211\u7279\u522b\u90c1\u95f7\uff0c\u65e0\u5948\u81ea\u5df1\u5f53\u65f6\u7684\u5fc3\u7406\u7d20\u8d28\u4e0d\u662f\u7279\u522b\u5f3a\u5927\uff09\u3002\u540e\u6765\u6211\u4e5f\u89c9\u5f97 100 \u5f20\u8868\u53ef\u80fd\u592a\u591a\u4e86\uff0c\u53ef\u80fd\u6ca1\u6709\u90a3\u4e48\u591a\u7528\u6237\uff0c\u7d22\u6027\u5c31\u53ea\u5206\u4e86\u5341\u5f20\u3002</p>\n<p>20 \u5e74\u65b0\u7684\u9879\u76ee\uff0c\u5f00\u59cb\u5c1d\u8bd5\u4f7f\u7528 MongoDB \uff0c\u7ecf\u522b\u4eba\u63a8\u8350\uff0c\u8bf4 MongoDB \u600e\u4e48\u9002\u5408\u6e38\u620f\u3002\u5f53\u65f6\u89c9\u5f97\u8fd9\u4e1c\u897f\u597d\u554a\uff0c\u4f46\u662f\u5728\u5b9e\u9645\u4f7f\u7528\u65f6\uff0c\u5e76\u4e0d\u662f\u90a3\u4e48\u7f8e\u597d\u3002</p>\n<p>24 \u5e74\u53e6\u5916\u4e00\u4e2a\u9879\u76ee\uff0c\u8d1f\u8d23\u4eba\u5168\u90e8\u4f7f\u7528\u4e86 MongoDB \uff0c\u4f46\u662f\u7528\u6cd5\u76f8\u5f53\u66b4\u529b\uff0c\u4e5f\u5c31\u662f\u6bcf\u6b21\u5168\u91cf\u5b58\u50a8\u7528\u6237\u7684\u6570\u91cf\u5230 MongoDB \u4e2d\uff0c\u611f\u89c9\u8ddf\u4f7f\u7528 MySQL \u4e5f\u6ca1\u6709\u4ec0\u4e48\u5b9e\u8d28\u6027\u7684\u533a\u522b\u3002</p>\n<p>\u4eca\u5e74\u8d1f\u8d23\u53e6\u5916\u4e00\u4e2a\u9879\u76ee\u65f6\uff0c\u6700\u5f00\u59cb\u8bbe\u8ba1\u8005\u5c06\u7528\u6237\u7684 JSON \u6570\u636e\u5148\u8fdb\u884c base64 encode \uff0c\u7136\u540e\u5f02\u6216\u52a0\u5bc6\u5b58\u50a8\u5230\u4e86 MySQL \u4e2d\u3002\u56e0\u4e3a\u6700\u5f00\u59cb\u7684\u5ba2\u6237\u7aef\u7684\u8bbe\u8ba1\u662f\u7eaf\u5355\u673a\uff0c\u540e\u9762\u52a0\u4e86\u670d\u52a1\u5668\u5b58\u50a8\u7528\u6237\u7684\u5b58\u6863\u800c\u5df2\u3002</p>\n<p>\u65b0\u7684\u9700\u6c42\u662f\u8981\u5c06\u8fd9\u4e2a\u5355\u673a\u7248\u672c\u505a\u6210\u4e00\u4e2a\u8054\u7f51\u7248\u672c\uff0c\u56e0\u4e3a\u6211\u4e4b\u524d\u6709\u5c06\u5355\u673a\u53d8\u6210\u8054\u7f51\u7684\u6210\u529f\u7ecf\u9a8c\uff08\u67d0\u5408\u6210\u6e38\u620f\u53d8\u6210\u8054\u7f51\u7248\u672c\uff0c\u56fd\u5185\u6d41\u6c34\u8fc7\u4e94\u4ebf\uff09\u3002</p>\n<p>\u73b0\u5728\u7684\u5b58\u50a8\u7ed3\u6784\u6ca1\u6709\u89c4\u5212\u8fc7\uff0cJSON \u7ed3\u6784\u4e0b\u9762\u6709\u8d85\u8fc7 200 \u4e2a\u5b57\u6bb5\uff0c\u6d3b\u52a8\u914d\u7f6e\u5360\u7528\u8d85\u8fc7\u4e86 90% \u7684\u5b58\u50a8\u4ee5\u4e0a\uff0c\u5e73\u5747\u7528\u6237\u7684\u5b58\u50a8\u5360\u7528\u5728 100KB \u4ee5\u4e0a\u3002\n\u5b58\u6863\u4e2d\u5b58\u50a8\u6d3b\u52a8\u914d\u7f6e\u7684\u539f\u56e0\uff1a\u6d3b\u52a8\u5f00\u542f\u4e4b\u540e\uff0c\u5219\u914d\u7f6e\u4e0d\u518d\u53d1\u751f\u53d8\u5316\u3002</p>\n<p>\u6211\u91cd\u65b0\u8bbe\u8ba1\u4e86\u5b58\u50a8\u7ed3\u6784\uff0c\u4f7f\u7528 Protobuf \u91cd\u65b0\u8bbe\u8ba1\u4e86\u6570\u636e\u5b58\u50a8\uff0c\u5c06\u6d3b\u52a8\u914d\u7f6e\u6570\u636e\u8ddf\u6e38\u620f\u5b58\u6863\u5206\u79bb\u3002\u6d3b\u52a8\u914d\u7f6e\u5355\u72ec\u5b58\u6863\u5728\u4e00\u5f20\u914d\u7f6e\u8868\uff0c\u7528\u6237\u7684\u5b58\u50a8\u4e2d\u53ea\u8bb0\u5f55\u5bf9\u5e94\u7684\u552f\u4e00 ID \u3002\u540c\u65f6\u63d0\u4f9b\u4e86\u63a5\u53e3\uff0c\u53ef\u80fd\u5c06\u65e7\u7684\u6570\u636e\u8f6c\u6362\u4e3a\u65b0\u7684 Protobuf \u5b58\u50a8\u7ed3\u6784\u3002</p>\n<p>\u7528\u6237\u7684\u6570\u636e\u5b58\u50a8\u4e2d\uff0c\u4f7f\u7528 JSON \u5b58\u50a8\uff0c\u5b58\u50a8\u7684\u5185\u5bb9\u4e3a Protobuf \u5bf9\u5e94\u7684 JSON \u6570\u636e\u3002\u7528\u6237\u66f4\u65b0\u6570\u636e\u65f6\uff0c\u63d0\u4f9b\u4e86 FieldMask \u4ec5\u4fee\u6539\u90e8\u5206\u6570\u636e\uff08\u53ea\u524d\u6bcf\u6b21\u90fd\u662f\u5168\u91cf\u66f4\u65b0\uff09\u3002</p>\n<p>\u5f53\u8fd9\u4e2a\u7248\u672c\u6210\u529f\u4e0a\u7ebf\u4e4b\u540e\uff0c\u6211\u53d1\u73b0\u67d0\u4e9b\u63a5\u53e3\u8c03\u7528\u6bd4\u8f83\u6162\uff0c\u4f8b\u5982\u5728\u7528\u6237\u8f6c\u6362\u5b58\u6863\u65f6\uff0c\u6211\u5c06\u5ba2\u6237\u7aef\u63d0\u4f9b\u7684\u539f\u59cb\u6570\u636e\u3001\u8f6c\u6362\u4e4b\u540e\u7684\u7ed3\u679c\u5b58\u50a8\u5230\u4e86 <code>conversion_logs</code> \u914d\u7f6e\u8868\uff08\u6570\u636e\u7c7b\u578b\u5747\u4e3a JSON \uff09\uff0c\u5185\u7f51\u7684\u865a\u62df\u673a\u4e0a\u5e73\u5747\u8017\u65f6\u4e3a 200ms \u3002\u56e0\u4e3a\u6700\u8fd1\u5728\u7814\u7a76 PostgreSQL \uff0c\u7d22\u6027\u5c31\u8bd5\u4e86\u4e00\u4e0b\u6027\u80fd\u5bf9\u6bd4\uff0c\u7ed3\u679c PG \u53ea\u9700\u8981 20ms \u5de6\u53f3\u3002\u6700\u5173\u952e\u7684\u662f\uff0c\u8868\u7a7a\u95f4\u5b58\u50a8\u7684\u5360\u7528\u4e0a\uff0cPG \u8fdc\u4f4e\u4e8e MySQL \uff0c\u56e0\u4e3a PG \u5b58\u50a8\u4f7f\u7528\u7684\u7c7b\u578b\u4e3a JSONB \u3002</p>\n<p>\u6211\u5c1d\u8bd5\u5bf9\u6bd4\u7eaf TEXT \u5b57\u6bb5\u7684\u8bb0\u5f55\u65f6\uff0cPG \u5360\u7528\u7684\u7a7a\u95f4\u4e5f\u53ea\u6709 MySQL \u7684 1/3 \uff0c\u73b0\u5728\u7684\u6570\u636e\u8868\u73b0\u5c31\u662f\u5728\u5b58\u50a8\u548c\u63d2\u5165\u901f\u5ea6 MySQL \u8fdc\u4f4e\u4e8e PG \u3002\u66f4\u65b0\u7684\u901f\u5ea6\u8fd8\u6ca1\u6709\u5b8c\u5168\u9a8c\u8bc1\u3002</p>\n<pre><code class=\"language-mysql\">SELECT\n  table_name,\n  ROUND((data_length + index_length) / 1024 / 1024, 2) AS total_mb,\n  ROUND(data_length / 1024 / 1024, 2) AS data_mb,\n  ROUND(index_length / 1024 / 1024, 2) AS index_mb\nFROM information_schema.tables\nWHERE table_schema = 'merge_island'\n  AND table_name IN ('conversion_logs','game_saves','activity_saves','activity_config');\n  \n+-----------------+----------+---------+----------+\n| TABLE_NAME      | total_mb | data_mb | index_mb |\n+-----------------+----------+---------+----------+\n| activity_config |   216.83 |  209.55 |     7.28 |\n| activity_saves  |     0.16 |    0.16 |     0.00 |\n| conversion_logs |    70.55 |   70.52 |     0.03 |\n| game_saves      |     7.48 |    7.39 |     0.09 |\n+-----------------+----------+---------+----------+\n</code></pre>\n<pre><code class=\"language-postgresql\">SELECT\n  relname AS table_name,\n  pg_size_pretty(pg_total_relation_size(relid)) AS total_size\nFROM pg_catalog.pg_statio_user_tables\nWHERE relname IN ('conversion_logs','game_saves','activity_saves','activity_config');\ntable_name    | total_size\n-----------------+------------\n activity_config | 32 MB\n activity_saves  | 376 kB\n conversion_logs | 13 MB\n game_saves      | 1976 kB\n</code></pre>\n<p>\u53e6\u5916\u628a\u7528\u6237\u5206\u4e3a 100 \u5f20\u7684\u64cd\u4f5c\u5728 PG \u8fd9\u91cc\u5b8c\u5168\u662f\u53cd\u6a21\u5f0f\u7684\uff0c\u56e0\u4e3a PG \u53f7\u79f0\u5355\u8868\u8f7b\u677e\u8fc7\u4ebf\u3002\u53e6\u5916\u5341\u591a\u5e74\u524d\u7684\u8001\u8bbe\u8ba1\u672c\u5e94\u8be5\u4e5f\u8981\u88ab\u6dd8\u6c70\u4e86\uff0c\u6bd5\u7adf\u73b0\u5728\u90fd\u662f\u4e91\u670d\u52a1\uff0c\u7a7a\u95f4\u5b58\u50a8\u53ef\u4ee5\u8f7b\u677e\u6269\u5145\uff0c\u4e0d\u7528\u518d\u62c5\u5fc3\u8fd9\u4e2a\u95ee\u9898\u3002</p>\n<p>\u6709\u6ca1\u6709\u4f7f\u7528 PG \u6dd8\u6c70 MySQL \u7684\u5927\u4f6c\u6765\u5206\u4eab\u4e00\u4e0b\u81ea\u5df1\u7684\u7ecf\u5386\uff0c\u4e00\u8d77\u5b66\u4e60\u54c8\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/YanSeven", 
        "name": "YanSeven", 
        "avatar": "https://cdn.v2ex.com/avatar/3f22/feff/383743_large.png?m=1775465214"
      }, 
      "url": "https://www.v2ex.com/t/1179663", 
      "date_modified": "2025-12-18T02:35:57+00:00", 
      "content_html": "pg \u662f\u591a\u8fdb\u7a0b\u6a21\u578b\u7684\uff0c\u90a3\u4e48\u6211\u6709\u5982\u4e0b\u51e0\u4e2a\u95ee\u9898\uff1a<br /><br />1. \u5728\u73b0\u5728\u7684\u8f6f\u4ef6\u5b9e\u8df5\u4e2d\uff0c\u603b\u4f53\u800c\u8a00\uff0c\u5927\u578b\u57fa\u7840\u8f6f\u4ef6\u7684\u591a\u7ebf\u7a0b\u6a21\u578b\u662f\u5426\u6bd4\u591a\u8fdb\u7a0b\u66f4\u6709\u4f18\u52bf\u3002<br />2. pg \u6709\u5fc5\u8981\u6539\u6210\u591a\u7ebf\u7a0b\u6a21\u578b\u5417\u3002<br />3. pg \u5b98\u65b9\u6709\u8ba8\u8bba\u8fc7\u6539\u591a\u7ebf\u7a0b\u6a21\u578b\u5417\u3002<br />4. pg \u5982\u679c\u8981\u6539\u7684\u8bdd\uff0c\u54ea\u4e00\u5757\u513f\u662f\u6709\u5fc5\u8981\u6539\u7684\uff0c\u54ea\u4e00\u5757\u513f\u662f\u6ca1\u5fc5\u8981\u6539\u7684\u3002<br />5. pg \u5982\u679c\u8981\u6539\u7684\u8bdd\uff0c\u54ea\u4e00\u5757\u513f\u662f\u597d\u6539\u7684\uff0c\u54ea\u4e00\u5757\u513f\u662f\u4e0d\u597d\u6539\u7684\u3002<br />5. \u6539\u5b8c\u4e4b\u540e\uff0c\u9664\u4e86\u6709\u4e2a\u201c\u5671\u5934\u201d\u7528\u6765\u5199\u5ba3\u4f20\u6587\u7ae0\uff0c\u771f\u7684\u6709\u6536\u76ca\u5417\u3002\u6027\u80fd\u4e0a\uff0c\u8fd0\u7ef4\u4e0a\uff0c\u517c\u5bb9\u6027\u4e0a\u6709\u4ef7\u503c\u5417\u3002", 
      "date_published": "2025-12-18T02:03:11+00:00", 
      "title": "postgresql \u591a\u8fdb\u7a0b\u6539\u591a\u7ebf\u7a0b", 
      "id": "https://www.v2ex.com/t/1179663"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/guiyumin", 
        "name": "guiyumin", 
        "avatar": "https://cdn.v2ex.com/avatar/b03c/324e/527486_large.png?m=1746207275"
      }, 
      "url": "https://www.v2ex.com/t/1175897", 
      "date_modified": "2025-11-30T02:23:16+00:00", 
      "content_html": "<p>\u7b2c\u4e00\u952e\uff0c\u5728\u7b2c\u4e00\u4e2a vps \u91cc\u5b89\u88c5\u8fd9\u4e2a <a href=\"https://github.com/node-pulse/admiral\" rel=\"nofollow\">https://github.com/node-pulse/admiral</a> </p>\n<p>\u6709\u4e00\u4e2a\u4e00\u952e\u811a\u672c\uff0c\u53bb release \u91cc\u53ef\u4ee5\u4e0b\u8f7d</p>\n<p>\u8fd9\u4e2a\u5e73\u53f0\u53ef\u4ee5\u505a\u670d\u52a1\u5668\u76d1\u63a7\uff0c\u53ef\u4ee5\u505a ansible \u81ea\u52a8\u5316\u90e8\u7f72</p>\n<p>\u7b2c\u4e8c\u952e\uff0c\u5c31\u662f\u53bb\u793e\u533a\u5267\u672c\u91cc\u627e\u5230\u8fd9\u4e2a \uff1aPostgreSQL Stack (PostgreSQL + PostgREST + pgweb + Nginx)</p>\n<p>\u7136\u540e\u4e0b\u8f7d</p>\n<p>\u6700\u540e\u4e00\u6b65\u5c31\u662f\u90e8\u7f72\u5230\u7b2c\u4e8c\u4e2a vps</p>\n<p>\u6240\u4ee5\u4f60\u9700\u8981 2 \u4e2a vps</p>\n<p>\u8fd9\u4e2a pg \u670d\u52a1\u5305\u542b</p>\n<ul>\n<li>pg 18.1</li>\n<li>pgweb \u7528\u4e8e ui</li>\n<li>anthelia \u7528\u4e8e 2fa \uff0c\u4e0d\u7136 pgweb \u6ca1\u6709\u9632\u62a4\uff0c\u4f1a\u88ab\u9ed1\uff08\u6211\u88ab\u9ed1\u8fc7\uff09</li>\n</ul>\n<p>\u5982\u679c\u4f60\u53ea\u6709\u4e00\u4e2a vps</p>\n<p>\u53ef\u4ee5\u7528 ansible \u547d\u4ee4\u884c\uff0c\u91cc\u9762\u9700\u8981 3 \u4e2a\u53c2\u6570\uff1a</p>\n<pre><code class=\"language-shell\">ansible-playbook install.yml -i inventory \\\n    -e domain=db.example.com \\\n    -e admin_email=you@example.com \\\n    -e authelia_admin_password=YourSecurePass123\n</code></pre>\n", 
      "date_published": "2025-11-30T01:37:40+00:00", 
      "title": "\u4e8c\u952e\u5b89\u88c5\u4e00\u4e2a postgresql \u670d\u52a1", 
      "id": "https://www.v2ex.com/t/1175897"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/shendaowu", 
        "name": "shendaowu", 
        "avatar": "https://cdn.v2ex.com/avatar/6fa4/0f0c/233858_large.png?m=1771487434"
      }, 
      "url": "https://www.v2ex.com/t/1175308", 
      "date_modified": "2025-11-27T00:33:17+00:00", 
      "content_html": "\u6211\u95ee\u4e86 DeepSeek \uff0c\u5b83\u8bf4 roaringbitmap \u7c7b\u578b\u7684\u503c\u7684\u5143\u7d20\u7684\u53d6\u503c\u8303\u56f4\u5982\u679c\u5f88\u5927\u7684\u8bdd\u4f1a\u5f71\u54cd\u6548\u7387\u3002\u5c31\u662f\u7c7b\u4f3c INSERT INTO tag_content_bitmaps (tag_id, content_bitmap) VALUES(1, rb_build(ARRAY[1,100000])) \u7684\u5185\u5bb9\u67e5\u8be2\u6548\u7387\u4f1a\u4f4e\u4e8e INSERT INTO tag_content_bitmaps (tag_id, content_bitmap) VALUES(1, rb_build(ARRAY[1,2])) \u3002\u7136\u540e\u6211\u5c31\u60f3\u5230\u4e86\u4e00\u4e9b\u82b1\u6d3b\u3002<br /><br />\u9996\u5148\uff0c\u4f7f\u7528\u5173\u7cfb\u578b\u6570\u636e\u5e93\u5efa\u7acb\uff08\u6807\u7b7e id \uff0c\u5185\u5bb9 id \uff09\u590d\u5408\u7d22\u5f15\u4e4b\u540e\u5982\u679c\u6807\u7b7e\u7684\u4f7f\u7528\u7387\u4e0d\u9ad8\u7684\u8bdd\uff0c\u641c\u7d22\u6548\u7387\u8fd8\u662f\u53ef\u4ee5\u7684\uff0c\u4f46\u662f\u5982\u679c\u6807\u7b7e\u7684\u4f7f\u7528\u7387\u5f88\u9ad8\uff0c\u90a3\u4e48\u597d\u50cf\u662f\u56e0\u4e3a\u533a\u5206\u5ea6\u8fc7\u4f4e\uff0c\u6240\u4ee5\u641c\u7d22\u7684\u6548\u7387\u4f1a\u5f88\u4f4e\u3002\u4f46\u662f pg_roaringbitmap \u5bf9\u4e8e\u9ad8\u4f7f\u7528\u7387\u7684\u6807\u7b7e\u6765\u8bf4\u901f\u5ea6\u597d\u50cf\u8fd8\u662f\u633a\u5feb\u7684\u3002\u4f46\u662f\u5c31\u50cf\u524d\u9762\u7b2c\u4e00\u6bb5\u8bf4\u7684\uff0c\u8fd9\u4e2a\u4e5f\u4e0d\u662f\u514d\u8d39\u7684\u3002\u6240\u4ee5\u6211\u4e0d\u592a\u6562\u5168\u90e8\u6807\u7b7e\u90fd\u585e\u5230 roaringbitmap \u7c7b\u578b\u91cc\u3002\u7136\u540e\u662f\u5177\u4f53\u7684\u82b1\u6d3b\u3002<br /><br />\u6807\u7b7e id,\u6807\u7b7e\u540d\u5b57,\u4f7f\u7528\u7387<br />1,\u82f9\u679c,0.3<br />2,\u9999\u8549,0.01<br />3,\u68a8,0.15<br />\u9ad8\u9891\u6807\u7b7e id,\u539f\u6807\u7b7e id<br />1,1 //\u8fd9\u4e2a\u5bf9\u5e94\u82f9\u679c<br />2,3 //\u8fd9\u4e2a\u5bf9\u5e94\u68a8<br /><br />\u4e0d\u8fc7\u8fd9\u8fd8\u6709\u95ee\u9898\uff0c\u5c31\u662f\u5982\u4f55\u7981\u6b62\u9ad8\u9891\u6807\u7b7e\u5efa\u7acb\u7d22\u5f15\uff0c\u56e0\u4e3a\u53cd\u6b63\u4e5f\u4e0d\u4f1a\u7528\uff0c\u8fd8\u4f1a\u5360\u5730\u65b9\u3002\u53ef\u80fd\u6700\u9ad8\u6548\u7684\u65b9\u6cd5\u662f\u5c06\u4f4e\u9891\u6807\u7b7e\u5168\u90fd\u590d\u5236\u5230\u4e00\u4e2a\u65b0\u8868\u91cc\uff1f\u4e0d\u8fc7\u8fd9\u4e2a\u5f88\u53cd\u6a21\u5f0f\uff0c\u4e5f\u4f1a\u5bfc\u81f4\u7ef4\u62a4\u9ebb\u70e6\u3002\u6211\u95ee\u8fc7 DeepSeek \uff0c\u5b83\u7ed9\u7684\u65b9\u6cd5\u611f\u89c9\u6548\u7387\u4e0d\u600e\u4e48\u9ad8\u7684\u6837\u5b50\u3002<br /><br />\u7ed3\u5408\u666e\u901a\u590d\u5408\u7d22\u5f15\u5c31\u662f\u5982\u679c\u8981\u641c\u7d22\u7684\u6807\u7b7e\u540c\u65f6\u5305\u542b\u9ad8\u9891\u6807\u7b7e\u548c\u4f4e\u9891\u6807\u7b7e\u3002\u90a3\u4e48\u5c31\u5148\u5728 roaringbitmap \u91cc\u641c\u7d22\u90a3\u4e9b\u9ad8\u9891\u6807\u7b7e\uff0c\u7136\u540e\u5728\u7ed3\u679c\u4e2d\u641c\u7d22\u6ee1\u8db3\u4f4e\u9891\u6807\u7b7e\u7684\u5185\u5bb9\u3002\u6216\u8005\u53ef\u80fd\u53cd\u8fc7\u6765\u641c\u7d22\u6548\u7387\u66f4\u9ad8\uff1f DeepSeek \u8bf4\u524d\u8005\u6548\u7387\u66f4\u9ad8\u3002<br /><br />\u8fd9\u4e2a\u9ad8\u9891\u548c\u4f4e\u9891\u7684\u5206\u754c\u7ebf\u6709\u6ca1\u6709\u6bd4\u8f83\u597d\u7684\u5efa\u8bae\uff1f\u6211\u76ee\u524d\u5b9a\u7684\u662f 3%\u3002\u56e0\u4e3a DeepSeek \u8bf4 1% \u5230 5% \u7684\u4f7f\u7528\u7387\u7684\u6807\u7b7e\u5efa\u7acb\u7d22\u5f15\u8fd8\u662f\u53ef\u4ee5\u7684\u3002<br /><br />roaringbitmap \u76f8\u5173\u7684\u8868\u7ed3\u6784\uff1a<br /><br />CREATE TABLE tag_content_bitmaps (<br />tag_id BIGINT PRIMARY KEY,<br />content_bitmap roaringbitmap<br />);<br />CREATE TABLE content_tag_bitmaps (<br />content_id BIGINT PRIMARY KEY,<br />tag_bitmap roaringbitmap<br />);<br /><br />\u6216\u8005\u6211\u8fd9\u5957\u82b1\u6d3b\u662f\u4e0d\u662f\u6ca1\u4ec0\u4e48\u5927\u7528\uff1f\u6709\u6ca1\u6709\u66f4\u597d\u7684\u5b9e\u73b0\u52a0\u901f\u6807\u7b7e\u67e5\u8be2\u7684\u65b9\u6cd5\uff1f\u53e6\u5916\u6700\u597d\u662f CPU \u548c\u5185\u5b58\u8981\u6c42\u4f4e\u70b9\uff0cES \u4e4b\u7c7b\u7684\u6211\u6015\u94b1\u5305\u5403\u4e0d\u6d88\u3002<br /><br />\u6211\u8ddf DeepSeek \u804a\u7684\u5185\u5bb9\uff1a <a target=\"_blank\" href=\"https://chat.deepseek.com/share/dkuyx547fddet8vwwi\" rel=\"nofollow noopener\">https://chat.deepseek.com/share/dkuyx547fddet8vwwi</a> \u3002<br /><br />\u6700\u540e\uff0c\u518d\u52a0\u70b9\u6211\u4e2a\u4eba\u7684\u95ee\u9898\uff0c\u7b54\u4e0d\u7b54\u770b\u4f60\u5fc3\u60c5\u3002\u8fd9\u5957\u82b1\u6d3b\u6211\u4e00\u4e2a\u91ce\u751f\u7a0b\u5e8f\u5458\u80fd\u4e0d\u80fd\u628a\u6301\u4f4f\uff1f\u5b9e\u9645\u4f1a\u4e0d\u4f1a\u5f88\u590d\u6742\uff1f\u53e6\u5916\u5177\u4f53\u7684 SQL \u6211\u5e94\u8be5\u80af\u5b9a\u662f\u5199\u4e0d\u660e\u767d\u4e86\uff0c\u6211\u80af\u5b9a\u4f1a\u8ba9 AI \u5199\u3002\u4f46\u662f\u6211\u4f1a\u5199\u6d4b\u8bd5\u3002\u6211\u611f\u89c9\u8fd9\u4e2a\u6d4b\u8bd5\u8fd8\u662f\u6bd4\u8f83\u597d\u5199\u7684\uff0c\u7528\u90a3\u79cd\u6807\u51c6\u7684\u8fd0\u884c\u4e24\u5957\u4ee3\u7801\u5bf9\u6bd4\u7ed3\u679c\u5c31\u884c\u4e86\u3002\u4e00\u5957\u7b80\u5355\u4f4e\u6548\u51e0\u4e4e\u4e0d\u4f1a\u51fa\u9519\uff0c\u4e00\u5957\u590d\u6742\u9ad8\u6548\u53ef\u80fd\u6709\u9519\u3002", 
      "date_published": "2025-11-27T00:06:09+00:00", 
      "title": "\u901a\u8fc7 pg_roaringbitmap \u4f18\u5316\u6807\u7b7e\u67e5\u8be2\u7684\u8bdd\uff0c\u6709\u6ca1\u6709\u5fc5\u8981\u505a\u9ad8\u9891\u6807\u7b7e\u6620\u5c04\u548c\u7ed3\u5408\u666e\u901a\u590d\u5408\u7d22\u5f15\uff1f", 
      "id": "https://www.v2ex.com/t/1175308"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/LeeReamond", 
        "name": "LeeReamond", 
        "avatar": "https://cdn.v2ex.com/avatar/f481/5f03/469082_large.png?m=1713801588"
      }, 
      "url": "https://www.v2ex.com/t/1171344", 
      "date_modified": "2025-11-08T01:57:34+00:00", 
      "content_html": "<p>\u5982\u9898\uff0c\u65b0\u624b\u63a5\u89e6 TimescaleDB \uff0c\u76ee\u524d\u662f\u7528\u8fd9\u5957\u65b9\u6848\u505a\u4e86\u4e00\u5957\u5b58\u97f3\u9891\u4f20\u611f\u5668\u7684\u6570\u636e\u7684\u5de5\u5177\uff0c\u5927\u6982\u6709 100 \u4e2a\u5de6\u53f3\u7684\u4f20\u611f\u5668\uff0c\u5b58\u4e8c\u8fdb\u5236\u6570\u636e\uff0c\u65e5\u589e\u5927\u6982\u5341\u4e07\u884c\u5de6\u53f3\u3002</p>\n<p>\u76ee\u524d\u9047\u5230\u6bd4\u8f83\u5927\u4e00\u4e2a\u95ee\u9898\u662f\uff0c\u5e38\u89c1\u7684\u641c\u7d22\u573a\u666f\u662f\u201c\u641c\u7d22\u4f20\u611f\u5668 A \u5728\u67d0\u6708\u67d0\u65e5\u5230\u67d0\u6708\u67d0\u65e5\u671f\u95f4\u7684\u6240\u6709\u8bb0\u5f55\u201d\u3002\u4f46\u662f\u76ee\u524d\u641c\u7d22\u4f18\u5316\u5668\u662f\u5148\u4ece\u65f6\u95f4\u7684\u603b\u5e8f\u5217\u5f00\u59cb\u67e5\uff0c\u7136\u540e\u518d\u7b5b\u9009\u5176\u4e2d\u7684 A \u4f20\u611f\u5668\u3002\u800c\u6211\u89c9\u5f97\u903b\u8f91\u4e0a\u663e\u7136\u662f\u5148\u641c\u7d22 A \u4f20\u611f\u5668\u518d\u7b5b\u9009\u65f6\u95f4\u66f4\u4f18\u3002</p>\n<p>\u524d\u8005\u4e0d\u5149\u662f\u6162\u7684\u95ee\u9898\uff0c\u800c\u4e14\u73b0\u5728\u6709\u4e2a\u5927\u95ee\u9898\u662f<strong>\u8d70\u65f6\u95f4\u7d22\u5f15\u7684\u8bdd\uff0c\u6bcf\u4e2a\u64cd\u4f5c\u5360\u7528\u9501\u7684\u6570\u91cf\u592a\u591a\u4e86</strong>\uff0c\u5c31\u7b97\u628a\u53c2\u6570\u8c03\u5927\u4e86\uff0c\u65e5\u5e38\u4f7f\u7528\u4e5f<strong>\u7ecf\u5e38\u62a5\u9519</strong>\u3002</p>\n<p>\u95ee\u4e0b\u4e07\u80fd\u7684 v2 \uff0c\u6709\u4ec0\u4e48\u529e\u6cd5\u89e3\u51b3\u5417\uff1f</p>\n<p>\u9644\uff1a\n\u521b\u5efa\u8868\u7684\u547d\u4ee4\uff1a</p>\n<pre><code>CREATE TABLE sensor_data (\n    ts          TIMESTAMPTZ       NOT NULL,\n    sensor_id   INTEGER           NOT NULL,\n    data        VARCHAR(64)       NOT NULL,\n\n    PRIMARY KEY (sensor_id, ts)\n);\n\nSELECT create_hypertable(\n    'sensor_data',\n    'ts',\n    partitioning_column =&gt; 'sensor_id',\n    number_partitions =&gt; 16,  \n    chunk_time_interval =&gt; INTERVAL '7 day' \n);\n</code></pre>\n<p>\u89e3\u91ca\u641c\u7d22\u547d\u4ee4\u5f97\u5230\u5982\u4e0b\u7ed3\u679c\uff1a</p>\n<pre><code>EXPLAIN (ANALYZE, BUFFERS)\nSELECT * FROM sensor_data\nWHERE sensor_id = '001'\n  AND ts &gt;= '2024-12-06 00:00:00+08'::timestamptz\n  AND ts &lt;  '2024-12-07 00:00:00+08'::timestamptz;\n\n\n                                                                           QUERY PLAN                                                                             \n\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n Index Scan using _hyper_3_23024_chunk_sensor_data_ts_idx on _hyper_3_23024_chunk  (cost=0.28..6.71 rows=144 width=45) (actual time=0.032..0.062 rows=144 loops=1)\n   Index Cond: ((ts &gt;= '2024-12-06 00:00:00+08'::timestamp with time zone) AND (ts &lt; '2024-12-07 00:00:00+08'::timestamp with time zone))\n   Filter: (sensor_id = 1)\n   Buffers: shared hit=6\n Planning:\n   Buffers: shared hit=1076 read=1\n Planning Time: 7.689 ms\n Execution Time: 11.201 ms\n(8 rows)\n\n\n</code></pre>\n<p>\u5982\u5404\u4f4d\u6240\u89c1\u7684\u5c31\u662f\u4e0d\u7ba1\u600e\u4e48\u8c03\uff0c\u4e00\u5f00\u59cb\u90fd\u662f\u8d70 ts_idx \u7d22\u5f15\uff0c\u7136\u540e\u518d filter sensor_id</p>\n<p>\u611f\u89c9 timescaleDB \u662f\u4e2a\u597d\u4e1c\u897f\uff0c\u4f46\u662f\u8fd9\u4e2a\u95ee\u9898\u5361\u4f4f\u5b8c\u5168\u6ca1\u6cd5\u7528\u554a\u3002\u62dc\u8c22\u5404\u4f4d</p>\n", 
      "date_published": "2025-11-08T01:44:45+00:00", 
      "title": "PostgreSQL + TimescaleDB \u65b9\u6848\u4e0d\u6309\u4e3b\u952e\u7d22\u5f15\u8d70\uff0c\u6709\u4ec0\u4e48\u529e\u6cd5\u5417\uff1f", 
      "id": "https://www.v2ex.com/t/1171344"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/anivie", 
        "name": "anivie", 
        "avatar": "https://cdn.v2ex.com/avatar/5aa1/52a3/628407_large.png?m=1773838354"
      }, 
      "url": "https://www.v2ex.com/t/1167813", 
      "date_modified": "2025-10-23T04:20:51+00:00", 
      "content_html": "\u4e00\u76f4\u628a mysql \u5f53\u5927\u53f7 excel \u7528\uff0c\u6700\u8fd1\u5f00\u4e86\u4e2a\u65b0\u5751\uff0c\u76f4\u63a5\u4e0a\u4e86 pg \uff0c\u8ba9 AI \u6765\u6307\u5bfc\u6570\u636e\u5e93\u7ba1\u7406\uff0c\u4f46\u662f\u6ca1\u4ec0\u4e48\u7ecf\u9a8c\u4e0d\u77e5\u9053 AI \u7684\u5efa\u8bae\u8be5\u4e0d\u8be5\u9075\u5faa<br />\u6bd4\u5982 AI \u597d\u50cf\u5f88\u9752\u7750\u4e00\u4e2a\u53eb RLS \u7684\u7279\u6027\uff0c\u4e1a\u52a1\u4ee3\u7801\u91cc\u67e5\u8be2\u7684\u65f6\u5019\u90fd\u4e0d\u5e26\u9274\u6743\u6761\u4ef6\u7684\uff0c\u6240\u6709\u9274\u6743\u90fd\u4f9d\u8d56 RLS \u6765\u5b8c\u6210\uff0c\u770b\u4e0a\u53bb\u597d\u50cf\u5f88\u5389\u5bb3\u7684\u6837\u5b50\uff0c\u4e0d\u77e5\u9053\u5751\u5927\u4e0d\u5927\uff1f<br />\u611f\u89c9\u4ee5\u524d\u5b66\u7684\u90a3\u4e9b\u6570\u636e\u5e93\u77e5\u8bc6\u51e0\u4e4e\u6ca1\u4ec0\u4e48\u80fd\u7528\u7684\uff0c\u8d8a\u6765\u8d8a\u8131\u8282\u4e86", 
      "date_published": "2025-10-23T03:20:35+00:00", 
      "title": "\u770b\u770b\u5927\u5bb6\u73b0\u5728\u7528 pg \u7684\u6700\u4f73\u5b9e\u8df5\u662f\u600e\u4e48\u6837\u7684", 
      "id": "https://www.v2ex.com/t/1167813"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/liyafe1997", 
        "name": "liyafe1997", 
        "avatar": "https://cdn.v2ex.com/avatar/524e/7d08/32249_large.png?m=1764082065"
      }, 
      "url": "https://www.v2ex.com/t/1161291", 
      "date_modified": "2025-09-25T00:20:27+00:00", 
      "content_html": "<p>\u5982\u9898\uff0c\u5927\u6982\u6bcf\u4e2a\u4e3b\u6761\u76ee\u4e0b\u9762\u5173\u8054\u6709\u51e0\u5f20\u5230\u4e00\u4e24\u767e\u5f20\u4e0d\u7b49\u7684\u56fe\u7247/\u6587\u6863\u4e4b\u7c7b\u7684\u9644\u4ef6\uff0c\u6bcf\u5f20\u56fe\u6700\u5927 500KB \uff08\u5165\u5e93\u65f6\u8d85\u5927\u4f1a\u81ea\u52a8\u538b\u7f29\uff09\uff0c\u6587\u6863\u4e5f\u662f\u4e0d\u8d85\u8fc7 500KB \u3002</p>\n<p>\u76ee\u524d\u6d4b\u8bd5\u6570\u636e\uff08\u51e0\u5341/\u767e\u6765\u4e2a\u4e3b\u6761\u76ee\uff09\u8dd1\u8d77\u6765\u611f\u89c9\u633a\u9999\u7684\uff0c\u4e5f\u6ca1\u89c1\u4ec0\u4e48\u6027\u80fd\u95ee\u9898\u3002\u7279\u522b\u662f\u8bbe\u7f6e\u597d\u5916\u952e\u548c cascade delete \u4e4b\u540e\uff0c\u4e3b\u6761\u76ee\u5220\u9664\u4f1a\u81ea\u52a8\u628a\u5b58 binary \u7684\u8868\u4e2d\u5173\u8054\u7684\u9644\u4ef6\u4e00\u5e76\u5e72\u6389\uff0c\u6bd4\u653e\u6587\u4ef6\u7cfb\u7edf\u597d\u7ef4\u62a4\u3002\u6587\u4ef6\u7cfb\u7edf\u8fd8\u8981\u81ea\u5df1\u5904\u7406\u6570\u636e\u5173\u8054\u548c\u6e05\u7406\u903b\u8f91\u3002</p>\n<p>\u5c31\u662f\u4e0d\u77e5\u9053\u4ee5\u540e\u6570\u636e\u91cf\u5927\u4e86\u4f1a\u6709\u4ec0\u4e48\u5751\uff0c\u9884\u8ba1\u4e4b\u540e\u4e3b\u6761\u76ee\u6709\u6570\u4e07\u4e2a\u8fd9\u6837\u7684\u91cf\u7ea7\u3002</p>\n", 
      "date_published": "2025-09-23T08:08:29+00:00", 
      "title": "\u7528 PostgreSQL \u5b58\u56fe\u7247\u7b49 binary \u6709\u4ec0\u4e48\u5751\u5417", 
      "id": "https://www.v2ex.com/t/1161291"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Apol1oBelvedere", 
        "name": "Apol1oBelvedere", 
        "avatar": "https://cdn.v2ex.com/avatar/3eaa/16c7/380208_large.png?m=1760590534"
      }, 
      "url": "https://www.v2ex.com/t/1156030", 
      "title": "[\u6c42\u52a9] \u5728\u54ea\u4e2a\u7f51\u5740\u80fd\u591f\u4e0b\u8f7d PostgresSQL 9.3.0 \u7248\u672c\u7684 Windows \u4e8c\u8fdb\u5236\u5b89\u88c5\u5305\uff1f\u5b98\u65b9/ftp/old/binary \u91cc\u6ca1\u6709\u3002", 
      "id": "https://www.v2ex.com/t/1156030", 
      "date_published": "2025-08-31T02:42:11+00:00", 
      "content_html": "[\u6c42\u52a9] \u5728\u54ea\u4e2a\u7f51\u5740\u80fd\u591f\u4e0b\u8f7d PostgresSQL 9.3.0 \u7248\u672c\u7684 Windows \u4e8c\u8fdb\u5236\u5b89\u88c5\u5305\uff1f<br />\u5b98\u65b9/ftp/old/binary \u91cc\u6ca1\u6709\u3002<br /><a target=\"_blank\" href=\"https://mirrors.cloud.tencent.com/postgresql/old/binary/v9.3.0/binary/solaris/solaris11/i386/\" rel=\"nofollow noopener\">https://mirrors.cloud.tencent.com/postgresql/old/binary/v9.3.0/binary/solaris/solaris11/i386/</a><br /><a target=\"_blank\" href=\"https://www.postgresql.org/ftp/old/binary/v9.3.0/binary/solaris/solaris11/i386/\" rel=\"nofollow noopener\">https://www.postgresql.org/ftp/old/binary/v9.3.0/binary/solaris/solaris11/i386/</a><br /><br />\u4e0b\u8f7d\u7684\u53ea\u6709\u7eff\u8272\u7248 exe \u7a0b\u5e8f\uff0c\u6ca1\u6709\u5b89\u88c5\u5305 installer\uff1a<br /><a target=\"_blank\" href=\"https://www.enterprisedb.com/download-postgresql-binaries\" rel=\"nofollow noopener\">https://www.enterprisedb.com/download-postgresql-binaries</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/fox0001", 
        "name": "fox0001", 
        "avatar": "https://cdn.v2ex.com/gravatar/38d5afa82294015541a86339ac95259b?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1132404", 
      "date_modified": "2025-05-17T04:54:15+00:00", 
      "content_html": "<h2>\u80cc\u666f\uff1a</h2>\n<ul>\n<li>\u521b\u5efa\u4e86\u4e00\u4e2a\u5546\u54c1\u63a8\u8350\u7cfb\u7edf\uff0c\u5546\u54c1\u4fe1\u606f\u6309\u5bf9\u5e94\u7684\u5206\u7c7b\uff08 100 \u4e2a\u5de6\u53f3\uff09\u751f\u6210\u4e0d\u540c\u7ef4\u5ea6\u7684\u5411\u91cf\uff0c\u5e76\u4e14\u6309\u5206\u7c7b\u521b\u5efa\u8868\uff08\u5c31\u662f 100 \u4e2a\u5de6\u53f3\u7684\u8868\uff09\uff0c\u4fdd\u5b58\u5546\u54c1\u7684\u5411\u91cf\u3002</li>\n<li>\u5411\u91cf\u7684\u7d22\u5f15\u91c7\u7528<code>hnsw</code>\uff0c\u5411\u91cf\u7c7b\u578b<code>halfvec</code>\uff0c<code>m</code>\u53d6 16 \uff0c<code>ef_construction</code>\u4e3a 100 \uff0c\u8ddd\u79bb\u8ba1\u7b97<code>L2 distance</code>\u3002</li>\n<li>\u8fde\u63a5 PostgreSQL \u7684\u9a71\u52a8\u91c7\u7528<code>asyncpg</code>\uff0c\u5373\u57fa\u4e8e Python \u5f02\u6b65 IO \u7684\u9a71\u52a8\u3002</li>\n<li>PostSQL \u548c pgvector \u53c2\u6570\u5168\u90e8\u9ed8\u8ba4\u3002</li>\n</ul>\n<h2>\u95ee\u9898\uff1a</h2>\n<p>\u4f7f\u7528 48 \u4e2a\u4e0d\u540c\u5206\u7c7b\u7684\u5411\u91cf\uff0c\u5206\u522b\u641c\u7d22\u5bf9\u5e94\u5206\u7c7b\u7684\u76f8\u4f3c\u5546\u54c1\u5411\u91cf\u3002\u5f02\u6b65 IO \u540c\u65f6\u53d1\u9001 48 \u4e2a\u67e5\u8be2\u5411\u91cf\u7684 SQL \u65f6,\u67e5\u8be2\u5f88\u6162\uff0c\u7ea6 700ms~1600ms \uff0c\u800c\u4e14 48 \u4e2a\u67e5\u8be2\u51e0\u4e4e\u540c\u65f6\u8fd4\u56de\u3002</p>\n<h2>\u7b80\u5355\u4f18\u5316\uff1a</h2>\n<p>\u6539\u4e3a\u6bcf\u6b21\u540c\u65f6\u53d1\u9001 4 \u4e2a\u67e5\u8be2\uff0c\u7ea6 200ms \u5b8c\u6210 48 \u4e2a\u67e5\u8be2\u3002</p>\n<h2>\u7591\u95ee\uff1a</h2>\n<ol>\n<li>PostgreSQL \u7684\u5e76\u53d1\u67e5\u8be2\u80fd\u529b\u5e94\u8be5\u6ca1\u8fd9\u4e48\u5dee\uff0c\u662f\u4e0d\u662f\u53c2\u6570\u672a\u8c03\u4f18\uff1f</li>\n<li>\u8fd8\u662f pgvector \u7684\u95ee\u9898\uff1f\u5176\u5411\u91cf\u67e5\u8be2\u7684\u5e76\u53d1\u5904\u7406\u80fd\u529b\u4e0d\u8db3\uff1f</li>\n</ol>\n", 
      "date_published": "2025-05-17T04:52:54+00:00", 
      "title": "[\u8bf7\u6559]pgvector \u7684\u6027\u80fd\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/1132404"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Gabrielle70", 
        "name": "Gabrielle70", 
        "avatar": "https://cdn.v2ex.com/gravatar/ffb0294f700d2e4fa8a1de41ce6f1e67?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1126245", 
      "date_modified": "2025-04-17T12:55:24+00:00", 
      "content_html": "<p>\u5404\u4f4d\u6570\u636e\u5e93\u4e13\u5bb6\u597d\uff0c\n\u6211\u76ee\u524d\u5728\u5f00\u53d1\u4e00\u4e2a\u7cfb\u7edf\uff0c\u5176\u4e2d\u6709\u4e00\u4e2a\u7279\u6b8a\u7684\u6570\u636e\u540c\u6b65\u573a\u666f\u9700\u8981\u5bfb\u6c42\u5efa\u8bae\u3002\n\u7cfb\u7edf\u67b6\u6784\u5982\u4e0b\uff1a</p>\n<p>1 \u4e2a\u4e2d\u592e\u4e3b\u6570\u636e\u5e93\uff08 PostgreSQL \uff09\nN \u53f0\u7b14\u8bb0\u672c\u7535\u8111\uff0c\u6bcf\u53f0\u90fd\u5b89\u88c5\u4e86\u672c\u5730 PostgreSQL \u6570\u636e\u5e93\n\u7b14\u8bb0\u672c\u7535\u8111\u53ef\u80fd\u4f1a\u79bb\u7ebf\u5de5\u4f5c\uff0c\u6bcf\u5929\u90fd\u4f1a\u4ea7\u751f\u65b0\u8bb0\u5f55\n\u7b14\u8bb0\u672c\u9700\u8981\u5b9a\u671f\u4e0e\u4e3b\u6570\u636e\u5e93\u8fdb\u884c\u53cc\u5411\u540c\u6b65</p>\n<p>\u6211\u73b0\u5728\u9762\u4e34\u4e00\u4e2a\u4e3b\u952e\u8bbe\u8ba1\u7684\u9009\u62e9\u95ee\u9898\uff1a\u662f\u4f7f\u7528 UUID \u4f5c\u4e3a\u4e3b\u952e\uff0c\u8fd8\u662f\u7ee7\u7eed\u4f7f\u7528\u81ea\u589e ID \uff1f\n\u6211\u7684\u521d\u6b65\u60f3\u6cd5\u662f\u4f7f\u7528 UUID \u53ef\u80fd\u66f4\u5408\u9002\uff0c\u56e0\u4e3a\uff1a</p>\n<p>\u6bcf\u53f0\u7b14\u8bb0\u672c\u53ef\u4ee5\u72ec\u7acb\u751f\u6210\u5168\u5c40\u552f\u4e00 ID \uff0c\u4e0d\u4f1a\u4e0e\u5176\u4ed6\u8bbe\u5907\u4ea7\u751f\u51b2\u7a81\n\u540c\u6b65\u65f6\u4e0d\u9700\u8981\u5904\u7406\u4e3b\u952e\u51b2\u7a81\u95ee\u9898\n\u4e0d\u9700\u8981\u590d\u6742\u7684\u4e3b\u952e\u6620\u5c04\u6216\u8f6c\u6362\u673a\u5236</p>\n<p>\u800c\u5982\u679c\u4f7f\u7528\u81ea\u589e ID \uff0c\u6211\u62c5\u5fc3\u4f1a\u9047\u5230\u4ee5\u4e0b\u95ee\u9898\uff1a</p>\n<p>\u6bcf\u53f0\u7b14\u8bb0\u672c\u751f\u6210\u7684\u81ea\u589e ID \u4f1a\u91cd\u590d\n\u540c\u6b65\u65f6\u9700\u8981\u89e3\u51b3 ID \u51b2\u7a81\n\u53ef\u80fd\u9700\u8981\u989d\u5916\u7684 ID \u6620\u5c04\u8868</p>\n<p>\u8bf7\u95ee\u5404\u4f4d\u6709\u6ca1\u6709\u5904\u7406\u8fc7\u7c7b\u4f3c\u7684\u5206\u5e03\u5f0f\u6570\u636e\u5e93\u540c\u6b65\u573a\u666f\uff1f UUID \u662f\u5426\u786e\u5b9e\u662f\u66f4\u597d\u7684\u9009\u62e9\uff1f\u6216\u8005\u6709\u5176\u4ed6\u66f4\u4f18\u65b9\u6848\uff1f\u5728\u6027\u80fd\u3001\u5b58\u50a8\u7a7a\u95f4\u548c\u540c\u6b65\u590d\u6742\u5ea6\u4e4b\u95f4\uff0c\u5982\u4f55\u505a\u51fa\u6743\u8861\uff1f\n\u611f\u8c22\u5206\u4eab\u60a8\u7684\u7ecf\u9a8c\u548c\u5efa\u8bae\uff01</p>\n", 
      "date_published": "2025-04-17T09:34:38+00:00", 
      "title": "\u591a\u7b14\u8bb0\u672c\u79bb\u7ebf PostgreSQL \u6570\u636e\u5e93\u540c\u6b65\u95ee\u9898\uff1a UUID vs \u81ea\u589e\u4e3b\u952e", 
      "id": "https://www.v2ex.com/t/1126245"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/annoygaga", 
        "name": "annoygaga", 
        "avatar": "https://cdn.v2ex.com/avatar/4a2c/bdb6/227146_large.png?m=1721825554"
      }, 
      "url": "https://www.v2ex.com/t/1124891", 
      "date_modified": "2025-04-11T23:52:34+00:00", 
      "content_html": "<p>\u5982\u9898\uff0c\u76ee\u524d\u6709\u6709\u9700\u6c42\u5e0c\u671b\u80fd\u591f\u7ed9\u7528\u6237\u5f00\u653e\u4e00\u4e2a SQL \u6570\u636e\u5e93\uff0c\u5f00\u653e SQL \u80fd\u529b\uff08 SaaS \u573a\u666f\u9700\u6c42\uff09\uff0c\u4e0d\u7136\u81ea\u5df1\u5c01\u88c5 SQL \u96be\u53d7\uff0c\u7528\u6237\u4e5f\u96be\u53d7\u3002</p>\n<p>\u5c0f\u5f1f\u5bf9 postgresql \u4e4b\u524d\u53ea\u6709\u4f7f\u7528\u7ecf\u9a8c\uff0c\u5bf9\u5176 user/database/\u6743\u9650\u80fd\u529b\u4e86\u89e3\u4e0d\u591a\uff0c\u7279\u6765\u95ee\u95ee</p>\n<p>chatgpt \u63a8\u8350\uff1a\u4e00\u4e2a PG \u5b9e\u4f8b\uff0cN \u4e2a\u7528\u6237\uff0c\u901a\u8fc7\u4e0d\u540c\u7684 database \u548c user \u8fdb\u884c\u9694\u79bb\uff0c\u524d\u9762\u4e00\u4e2a\u8fde\u63a5\u6c60\u4fdd\u8bc1\u4e00\u4e2a user \u53ea\u80fd\u8fde\u63a5\u67d0\u4e2a database</p>\n<p>\u6211\u60f3\u95ee\u95ee\u8fd9\u4e2a\u65b9\u6848\uff1a</p>\n<ul>\n<li>\n<p>\u5b89\u5168\u6027\u5982\u4f55\uff0c\u80fd\u4fdd\u8bc1\u4e0d\u540c\u7684\u7528\u6237\u4e4b\u95f4\u65e0\u6cd5\u770b\u5230\u5f7c\u6b64\u7684\u6570\u636e\uff0c\u6216\u8005\u5f71\u54cd\u5f7c\u6b64\u7684\u6570\u636e</p>\n</li>\n<li>\n<p>\u591a\u79df\u6237\u4e4b\u524d\u56e0\u4e3a\u662f\u5171\u4eab\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u8d44\u6e90\u4e89\u62a2\u7684\u95ee\u9898\u80fd\u89e3\u51b3\u4e48\uff1f</p>\n</li>\n<li>\n<p>\u8fd9\u4e2a\u65b9\u6848\u8fd0\u7ef4\u4e0a\u6709\u6ca1\u6709\u4ec0\u4e48\u96be\u70b9</p>\n</li>\n<li>\n<p>\u5f00\u653e\u7684 user \u4f1a\u4e0d\u4f1a\u5bf9\u5b9e\u4f8b\u672c\u8eab\u6709\u5176\u4ed6\u5f71\u54cd</p>\n</li>\n</ul>\n<p>\u5c0f\u5f1f\u8fd9\u5757\u7ecf\u9a8c\u786e\u5b9e\u8f83\u5c11\uff0c\u800c chatgpt \u6211\u603b\u611f\u89c9\u4ed6\u6709\u4e9b\u65b9\u6848\u4e0d\u662f\u5f88\u53ef\u4fe1\uff0c\u7279\u6765\u95ee\u95ee\uff0c\u4ee5\u53ca\u6709\u54ea\u5bb6\u7528\u8fd9\u4e2a\u573a\u666f\u5728\u7ebf\u4e0a\u8dd1\u7684\u5417\uff1f</p>\n", 
      "date_published": "2025-04-11T16:37:19+00:00", 
      "title": "PostgreSQL \u901a\u8fc7\u5206 Database \u505a\u591a\u79df\u6237\u53ef\u884c\u5417\uff1f PostgreSQL \u591a\u79df\u6237\u7684\u6b63\u786e\u59ff\u52bf", 
      "id": "https://www.v2ex.com/t/1124891"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/annoygaga", 
        "name": "annoygaga", 
        "avatar": "https://cdn.v2ex.com/avatar/4a2c/bdb6/227146_large.png?m=1721825554"
      }, 
      "url": "https://www.v2ex.com/t/1124522", 
      "date_modified": "2025-04-11T23:58:54+00:00", 
      "content_html": "<p>\u4e4b\u524d\u8fd9\u4e2a\u8ba8\u8bba\u8c8c\u4f3c\u5f88\u591a\u4eba\u8ba8\u8bba\uff0c\u73b0\u5728\u5e0c\u671b\u95ee\u95ee\uff0c\u539f\u56e0\u662f\u76ee\u524d\u6709\u4e00\u4e9b SaaS \u591a\u8868\u7684\u9700\u6c42\uff0c\u5e0c\u671b\u8868\u548c\u5e93\u80fd\u76f8\u5bf9\u66f4\u52a8\u6001\u7684\u542f\u52a8</p>\n<p>\u76ee\u524d\u5927\u5bb6\u628a\u6570\u636e\u5e93\u653e\u5728 k8s \u90fd\u7528\u4ec0\u4e48\u65b9\u6848\u5462\uff1f\u67e5\u5230\u4e86\u4e00\u4e2a</p>\n<p><a href=\"https://github.com/cloudnative-pg/cloudnative-pg\" rel=\"nofollow\">https://github.com/cloudnative-pg/cloudnative-pg</a></p>\n<p>\u4e0d\u77e5\u9053\u9760\u4e0d\u9760\u8c31</p>\n<p>\u8fd9\u4e2a\u5e16\u5b50\u5c31\u4e0d\u8ba8\u8bba\u4e3a\u4ec0\u4e48 postgresql \u8981\u653e\u5728 k8s \u4e86\uff0c\u611f\u89c9\u8fd9\u4e2a\u8bdd\u9898\u592a\u5f15\u6218\u4e86\uff0c\u5c31\u5047\u8bbe\u8981\u653e\uff0c\u4e14</p>\n<p>\u5e0c\u671b\uff1a</p>\n<ul>\n<li>\u5c3d\u53ef\u80fd\u9ad8\u53ef\u7528\u548c\u4e0d\u4e22\u6570\u636e\uff0c\u8be5\u5982\u4f55\u8bbe\u8ba1</li>\n<li>\u8fd0\u7ef4\u6210\u672c\u5c3d\u53ef\u80fd\u7684\u4f4e</li>\n<li>\u53ef\u4ee5\u7eb5\u5411\u6269\u5bb9</li>\n</ul>\n", 
      "date_published": "2025-04-10T09:05:59+00:00", 
      "title": "Postgresql \u653e K8S \u91cc\uff0c\u5927\u5bb6\u76ee\u524d\u90fd\u7528\u7684\u4ec0\u4e48\u65b9\u6848\u5462\uff1f", 
      "id": "https://www.v2ex.com/t/1124522"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/luckzk", 
        "name": "luckzk", 
        "avatar": "https://cdn.v2ex.com/gravatar/102d4c6bd9f6f823e7e389dc58247e54?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1124151", 
      "date_modified": "2025-04-09T04:02:29+00:00", 
      "content_html": "<p>\u6bcf\u65e5\u5907\u4efd\uff0c\n\u5168\u91cf\u5907\u4efd\uff0c\n\u6570\u636e\u5e76\u53d1\u9ad8\uff0c\u4e0d\u80fd\u505c\u673a\uff0c\n\u6570\u636e\u91cf\u5927\u6982\u5728 200G \uff0c\n\u9700\u8981\u9650\u5236\u5907\u4efd\u65f6\u7684 IO \uff0c\u4e0d\u80fd\u5f71\u54cd\u6b63\u5e38\u7684\u6570\u636e\u8bfb\u5199\uff0c\u76ee\u524d\u662f ssd \u4e86\n\u9700\u8981\u52a0\u5bc6\uff0c\n\u9700\u8981\u538b\u7f29\uff0c\n\u540c\u65f6\u6062\u590d\u65f6\u5e94\u7b80\u5355\u5feb\u901f\uff0c\u5907\u4efd\u6587\u4ef6\u5c3d\u91cf\u5360\u7528\u5c0f\u7684\u7a7a\u95f4</p>\n<p>\u76ee\u524d\u91c7\u7528\u7684\u662f pg_dump \u7684\u65b9\u6848\uff0c\u5927\u8868\u5206\u6279\u6b21\u5907\u4efd</p>\n", 
      "date_published": "2025-04-09T02:25:10+00:00", 
      "title": "2025 \u5e74 postgresql \u6709\u4ec0\u4e48\u4f18\u79c0\u7684\u5907\u4efd\u89e3\u51b3\u65b9\u6848", 
      "id": "https://www.v2ex.com/t/1124151"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/zhengfan2016", 
        "name": "zhengfan2016", 
        "avatar": "https://cdn.v2ex.com/gravatar/df526f138d10cac8c95b274c720a6f55?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1123656", 
      "title": "\u6709\u5927\u795e\u7814\u7a76\u8fc7 pg_resetwal \u7684\u539f\u7406\u5417\uff0c\u4e3a\u4ec0\u4e48\u4f1a\u4e22 user \u8868\u7684\u6570\u636e", 
      "id": "https://www.v2ex.com/t/1123656", 
      "date_published": "2025-04-07T02:33:16+00:00", 
      "content_html": "<p>\u524d\u60c5\u63d0\u8981\uff1a <a href=\"https://v2ex.com/t/1123446\" rel=\"nofollow\">https://v2ex.com/t/1123446</a></p>\n<p>\u76ee\u524d\u7684\u60c5\u51b5\u662f\uff0c\u5927\u90e8\u5206\u6570\u636e\u6062\u590d\u4e86\uff0c\u4f46\u662f\u4e00\u4e9b\u884c\u5f7b\u5e95\u6d88\u5931\u4e86\uff0c\u6211\u89c2\u5bdf\u8fc7\uff0c\u5927\u90e8\u5206\u662f user \u8868\u7684\u7528\u6237\u884c\uff0c\u8fd9\u5230\u5e95\u662f\u4e3a\u4ec0\u4e48\uff0c\u8fd9\u4e9b\u884c\u5b58\u7684\u662f\u6211\u7684\u8d26\u53f7\u6570\u636e\uff0c\u5927\u90e8\u5206\u5728\u5f88\u65e9\u4e4b\u524d\u63d2\u5165\u7684(\u7528\u6237\u6ce8\u518c\u65f6\u5c31\u63d2\u5165\u8be5\u884c\u4e86)\uff0c\u6ca1\u9053\u7406\u5b58\u5728 wal \u7f13\u5b58\u672a\u5199\u5165\uff0c</p>\n<p>\u4e3b\u8981\u53d7\u5f71\u54cd\u7684\u6709<a href=\"https://github.com/misskey-dev/misskey\" rel=\"nofollow\">misskey</a>\uff0c<a href=\"https://github.com/logto-io/logto\" rel=\"nofollow\">logto</a>\u8fd9\u4e9b\u7684 user \u8868</p>\n<p>\u6211\u5c1d\u8bd5\u521b\u5efa\u548c\u65e7\u8d26\u53f7\u76f8\u540c\u4e3b\u952e\u7684\u7528\u6237\u7684\u65f6\u5019\u4f1a\u51fa\u73b0 id \u4ee5\u5b58\u5728\u7684\u62a5\u9519\uff0c\u5373\u4f7f\u6570\u636e\u5e93\u6839\u672c\u4e0d\u5b58\u5728\u65e7 id \u7684\u884c\uff0creindex \u4e5f\u4e0d\u884c</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/zhengfan2016", 
        "name": "zhengfan2016", 
        "avatar": "https://cdn.v2ex.com/gravatar/df526f138d10cac8c95b274c720a6f55?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1123446", 
      "date_modified": "2025-04-06T04:08:25+00:00", 
      "content_html": "<p>\u5982\u9898\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u6b7b\u673a\u65ad\u7535\u91cd\u542f\uff0cpostgresql \u62a5\u9519\u4e86\uff0cpostgresql error PANIC: could not locate a valid checkpoint record \uff0c\u6309\u7167\u8fd9\u4e2a\u6559\u7a0b\uff1a</p>\n<p><a href=\"https://stackoverflow.com/questions/8799474/postgresql-error-panic-could-not-locate-a-valid-checkpoint-record\" rel=\"nofollow\">https://stackoverflow.com/questions/8799474/postgresql-error-panic-could-not-locate-a-valid-checkpoint-record</a></p>\n<pre><code>pg_resetwal /var/lib/postgresql/data\n</code></pre>\n<p>\u7ed3\u679c\uff0cpostgresql \u6b63\u5e38\u8fd0\u884c\uff0c\u4f46\u662f\u6570\u636e\u5e93\u7a7a\u4e86\uff0c\u53ea\u5269\u4e0b postgres \u5e93\uff0c\u5176\u4ed6\u6570\u636e\u5e93\u5168\u90e8\u4e22\u5931\u4e86\uff0c\u8fd9\u662f\u56e0\u4e3a\u6267\u884c\u5b8c\u8fd9\u4e2a\u547d\u4ee4\u5bfc\u81f4\u7684\u5417</p>\n", 
      "date_published": "2025-04-05T13:45:13+00:00", 
      "title": "\u6309\u7167 stackoverflow \u6559\u7a0b\u6267\u884c pg_resetwal\uff0c postgresql \u7684\u6570\u636e\u5e93\u88ab\u6e05\u7a7a\u4e86", 
      "id": "https://www.v2ex.com/t/1123446"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/wencan", 
        "name": "wencan", 
        "avatar": "https://cdn.v2ex.com/avatar/0690/9014/5813_large.png?m=1747997681"
      }, 
      "url": "https://www.v2ex.com/t/1121195", 
      "title": "\u6c42\u56fd\u5185\u9ad8\u6027\u4ef7\u6bd4\u7684 postgresql \u670d\u52a1\uff0c\u7eb3\u7c73\u9879\u76ee", 
      "id": "https://www.v2ex.com/t/1121195", 
      "date_published": "2025-03-26T05:41:37+00:00", 
      "content_html": "\u53bb\u5e74\u6211\u597d\u50cf\u95ee\u8fc7\u8fd9\u4e2a\u95ee\u9898<br />\u6700\u7ec8\u6211\u7528 docker \u5728 vps \u4e0a\u8dd1\u4e86\u4e00\u4e2a\u5b9e\u4f8b\u2026\u2026<br /><br />\u8003\u8651\u6709\u9ad8\u6027\u4ef7\u6bd4\u7684\uff0c\u5c31\u4ece docker \u4e0a\u8fc1\u8d70<br />\u8981\u6c42\u652f\u6301\u6269\u5c55\uff0c\u7eed\u8d39\u4e0d\u6da8\u4ef7<br /><br />\u5728\u963f\u91cc\u4e91\u4e0a\u770b\u5230\u6709\u4e00\u5e74 200 \u591a\u7684\uff0c\u4f46\u4ec5\u4ec5\u662f\u7b2c\u4e00\u5e74\uff0c\u7eed\u8d39\u4ef7\u683c 1k \u591a\uff0c\u6240\u4ee5\u6682\u4e0d\u8003\u8651"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Koril", 
        "name": "Koril", 
        "avatar": "https://cdn.v2ex.com/avatar/82b2/a98c/625662_large.png?m=1760412808"
      }, 
      "url": "https://www.v2ex.com/t/1117481", 
      "date_modified": "2025-03-11T10:52:21+00:00", 
      "content_html": "<h2>\u80cc\u666f</h2>\n<p>\u6211\u5728\u81ea\u5df1\u7684\u963f\u91cc\u4e91\u670d\u52a1\u5668\u4e0a\uff08 2C2G \uff0c3M \uff0cDebian 12 \uff09\u88c5\u4e86\u4e00\u4e2a PostgreSQL \uff08 15 \uff09\uff0c\u5b89\u88c5\u540e\uff0c\u4ec5\u4ec5\u505a\u4e86\u4ee5\u4e0b\u914d\u7f6e\u6539\u52a8\uff1a</p>\n<p>pg_hba.conf:</p>\n<p>\u6dfb\u52a0\uff1ahost    all             all             0.0.0.0/0               md5</p>\n<p>postgresql.conf</p>\n<p>\u5f00\u653e\u7aef\u53e3\uff1alisten_addresses = '*'</p>\n<p>\u7ed9 postgres \u8bbe\u7f6e\u4e86\u5bc6\u7801\uff0csudo -i -u postgres -&gt; psql -&gt; \\password</p>\n<hr/>\n<h2>\u5f02\u5e38</h2>\n<p>\u65e0\u8bba\u662f Navicat \u8fd8\u662f Python \u7684 Psycopg2 \u5728\u8d85\u8fc7\u4e00\u5b9a\u65f6\u95f4\uff08\u5927\u6982 3-5 \u5206\u949f\uff09\uff0c\u5c31\u4f1a\u8fde\u63a5\u5931\u6548\u4e86\u3002</p>\n<p>Navicat \u62a5\u9519\u5982\u4e0b\uff1a</p>\n<pre><code>Server closed the connection unexpectedly\nThis probably means the server terminated abnormally before or while processing the request.\n</code></pre>\n<p>Psycopg2 \u62a5\u9519\u5982\u4e0b\uff1a</p>\n<pre><code>psycopg2.OperationalError: server closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.\nserver closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request. \n</code></pre>\n<hr/>\n<h2>\u5df2\u77e5</h2>\n<p>\u670d\u52a1\u5668\u6ca1\u6709\u592a\u5927\u7684\u8d1f\u8f7d\uff0ccpu \uff0c\u5185\u5b58\uff0c\u78c1\u76d8\uff0c\u7f51\u7edc\uff0c\u5360\u7528\u7387\u90fd\u5f88\u4f4e\uff0c\u9664\u4e86 Prometheus/Grafana/nginx \u4e4b\u5916\uff0c\u8fd9\u4e2a\u673a\u5668\u4e0a\u53ea\u6709\u521a\u521a\u5b89\u88c5\u7684 PostgreSQL \u3002</p>\n<p>\u91cd\u65b0\u83b7\u53d6\u8fde\u63a5\uff0c\u80fd\u591f\u6b63\u5e38\u8bbf\u95ee\uff0c\u4f46\u662f\u6211\u4f7f\u7528\u7684 Psycopg2 \u7684 ThreadedConnectionPool \u8fde\u63a5\u6c60\uff0c\u8fde\u63a5\u6c60\u6ca1\u6cd5\u4fdd\u6301\u8fde\u63a5\u4e48\uff1f\u4ee3\u7801\u5982\u4e0b\uff1a</p>\n<pre><code class=\"language-python\">\ndef get_pg_pool(pg_config):\n    pool = psycopg2.pool.ThreadedConnectionPool(\n        minconn=1,\n        maxconn=200,\n        host=pg_config['PG_HOST'],\n        port=pg_config['PG_PORT'],\n        dbname=pg_config['PG_DB'],\n        user=pg_config['PG_USER'],\n        password=pg_config['PG_PASSWORD'],\n        connect_timeout=5,\n    )\n    return pool\n    \n@flask_app.route('/task/log', methods=['GET'])\n    def task_log():\n        task_log_list = []\n        # \u5728\u8fdb\u7a0b\u542f\u52a8\u65f6\uff0c\u7ed9 flask_app \u521d\u59cb\u5316\u4e86\u4e00\u4e2a pg_pool \u5bf9\u8c61\n        conn = flask_app.pg_pool.getconn()\n        try:\n            with conn.cursor() as cur:\n                cur.execute('SELECT * FROM t_log')\n                task_log_list = cur.fetchall()\n        except psycopg2.Error as e:\n            return JsonResult.failed('\u83b7\u53d6\u65e5\u5fd7\u5217\u8868\u5931\u8d25')\n        finally:\n            flask_app.pg_pool.putconn(conn)\n\n        return JsonResult.successful(task_log_list)\n\n</code></pre>\n<hr/>\n<h2>\u95ee\u9898</h2>\n<p>\u8fd9\u4e2a\u95ee\u9898\u662f\u548c Linux \u670d\u52a1\u5668\u914d\u7f6e\u6709\u5173\u5462\uff1f\u8fd8\u662f\u8ddf PostgreSQL \u914d\u7f6e\u6709\u5173\uff1f\u8bf7\u95ee\u5982\u4f55\u6392\u67e5\u548c\u89e3\u51b3\u5462\uff1f</p>\n", 
      "date_published": "2025-03-11T03:10:55+00:00", 
      "title": "\u8bf7\u6559\u4e00\u4e2a\u5173\u4e8e PostgreSQL \u8fde\u63a5\u88ab Server \u5173\u95ed\u7684\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/1117481"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/jinyan01", 
        "name": "jinyan01", 
        "avatar": "https://cdn.v2ex.com/avatar/fff4/5b07/435749_large.png?m=1773651154"
      }, 
      "url": "https://www.v2ex.com/t/1113761", 
      "date_modified": "2025-02-24T03:09:38+00:00", 
      "content_html": "", 
      "date_published": "2025-02-24T03:08:43+00:00", 
      "title": "PostgreSQL 18 JSONB \u589e\u52a0\u80fd\u53d6\u4ee3 MongoDB \u5417\uff1f", 
      "id": "https://www.v2ex.com/t/1113761"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/zjc97816", 
        "name": "zjc97816", 
        "avatar": "https://cdn.v2ex.com/gravatar/4db795abf5e5f644522332596389c88b?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1099147", 
      "title": "PostgreSql", 
      "id": "https://www.v2ex.com/t/1099147", 
      "date_published": "2024-12-20T09:54:48+00:00", 
      "content_html": "<p>PostgreSql \u4ea4\u6d41</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/qviqvi", 
        "name": "qviqvi", 
        "avatar": "https://cdn.v2ex.com/gravatar/402cd361d8b2821d08ec9e1d892940f8?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1098343", 
      "title": "Oracle \u8fc1\u79fb postgreSQL \uff0c\u6709\u4ec0\u4e48\u7ecf\u9a8c\u5206\u4eab", 
      "id": "https://www.v2ex.com/t/1098343", 
      "date_published": "2024-12-17T17:30:33+00:00", 
      "content_html": "<p>\u9a6c\u4e0a\u8981\u8fc1\u79fb\u6570\u636e\u4e86\uff0c\u4e0d\u8fc7\u4ee3\u7801\u548c\u539f oracle \u6570\u636e\u5e93\u90fd\u662f\u7956\u4f20\u7684\uff0c\u7f3a\u4e4f\u6587\u6863\uff0c\u4e0d\u77e5\u9053\u600e\u4e48\u8fc1\u79fb\u6bd4\u8f83\u597d\uff0c\u6c42\u7ecf\u9a8c\u5206\u4eab</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/dzdh", 
        "name": "dzdh", 
        "avatar": "https://cdn.v2ex.com/avatar/1683/7ebf/226307_large.png?m=1757987240"
      }, 
      "url": "https://www.v2ex.com/t/1086318", 
      "title": "\u6709\u4ec0\u4e48\u6743\u9650\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5\u5417", 
      "id": "https://www.v2ex.com/t/1086318", 
      "date_published": "2024-11-04T01:51:05+00:00", 
      "content_html": "<p>\u573a\u666f\u662f\u8fd9\u6837\u3002</p>\n<p>\u4e00\u4e2a\u5e93 owner \u662f user</p>\n<p>\u51e0\u4e2a\u5f00\u53d1\u8005 \u53ea\u6709\u53ea\u8bfb\u548c\u5efa\u8868\u5220\u8868\u6743\u9650 usera/userb</p>\n<p>\u5f00\u53d1\u8005\u81ea\u5df1\u5efa\u7684\u8868\u4f1a\u81ea\u52a8 owner \u7ed9\u81ea\u5df1\u3002\u5bfc\u81f4\u5176\u4ed6\u4eba\u6ca1\u6743\u9650\u3002</p>\n<p>\u963f\u91cc\u4e91 rds-pg \u3002\u6709\u4ec0\u4e48\u89e3\u51b3\u65b9\u6848\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/guzzhao", 
        "name": "guzzhao", 
        "avatar": "https://cdn.v2ex.com/avatar/dde6/1522/248437_large.png?m=1717910920"
      }, 
      "url": "https://www.v2ex.com/t/1080792", 
      "title": "\u8bf7\u6559 PostgreSQL \u548c PostGIS \u4f7f\u7528\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/1080792", 
      "date_published": "2024-10-16T06:15:03+00:00", 
      "content_html": "<p>\u4e3b\u952e\u95ee\u9898, \u4f7f\u7528 serial \u521b\u5efa\u81ea\u589e\u4e3b\u952e\u540e,ddl \u4f1a\u53d8\u6210 int4+nextval,\u6211\u77e5\u9053\u610f\u601d\u4e00\u6837\u4f46\u662f\u8fd9\u6837\u590d\u5236\u7684 ddl \u4e0d\u80fd\u76f4\u63a5\u7528,\u80fd\u4e0d\u80fd\u6709\u597d\u7684\u5904\u7406\u65b9\u6cd5. \u4f7f\u7528 uuid?<br/>\n\u521b\u5efa\u7684 geography \u7c7b\u578b\u7528 Java \u5b9e\u4f53\u600e\u4e48\u5b9a\u4e49,\u67e5\u8be2\u7684\u65f6\u5019\u4f7f\u7528 postgis \u7684 PGgeography,\u4f46\u662f\u65b0\u589e\u8ba9\u524d\u7aef\u4f20\u4ec0\u4e48\u683c\u5f0f\u600e\u4e48\u5904\u7406</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/yustation", 
        "name": "yustation", 
        "avatar": "https://cdn.v2ex.com/gravatar/a6b26496372965d940c4ad745748b767?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1075950", 
      "title": "pg \u7684\u6beb\u79d2\u7ea7\u65f6\u95f4\u6233\u8f6c\u6362", 
      "id": "https://www.v2ex.com/t/1075950", 
      "date_published": "2024-09-26T04:12:13+00:00", 
      "content_html": "<pre><code class=\"language-sql\">select to_timestamp('1672531200000'::bigint / 1000) AT TIME ZONE 'UTC-8';\n</code></pre>\n<p>\u7ed3\u679c\u4e3a 2023-01-01 08:00:00</p>\n<pre><code class=\"language-sql\">select to_timestamp('1672531200000'::bigint / 1000) AT TIME ZONE 'UTC+8';\n</code></pre>\n<p>\u7ed3\u679c\u4e3a 2022-12-31 16:00:00</p>\n<p>\u4e3a\u4ec0\u4e48'UTC-8'\u624d\u662f\u5317\u4eac\u65f6\u95f4?</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Koril", 
        "name": "Koril", 
        "avatar": "https://cdn.v2ex.com/avatar/82b2/a98c/625662_large.png?m=1760412808"
      }, 
      "url": "https://www.v2ex.com/t/1072744", 
      "date_modified": "2024-09-13T23:13:37+00:00", 
      "content_html": "<h2>\u95ee\u9898\u63cf\u8ff0</h2>\n<p>\u5404\u4f4d\u5927\u4f6c\uff0c\u6709\u4e2a\u95ee\u9898\u8bf7\u6559\u4e0b\n\u6211\u5728\u672c\u5730\uff08 Windows11 \uff09\u5b89\u88c5\u4e86\u4e00\u4e2a PostgreSQL \uff0c\u4e00\u5207\u90fd\u662f\u9ed8\u8ba4\u503c\u5b89\u88c5</p>\n<p>\u6211\u901a\u8fc7\u4ee5\u4e0b\u8bed\u53e5\u67e5\u5230 max connections \u7684\u503c\u662f 100</p>\n<pre><code>show max_connections; -- \u8fd4\u56de 100\n</code></pre>\n<p>\u6211\u731c\u6d4b\u8fd9\u4e2a\u5e94\u8be5\u5c31\u662f PG \u9ed8\u8ba4\u7684\u6700\u5927\u8fde\u63a5\u6570\uff0c\u7136\u540e\u6211\u7528 Python \u5199\u4e86\u4e00\u4e2a\u811a\u672c\uff0c\u5faa\u73af\u83b7\u53d6 connection\uff1a</p>\n<pre><code class=\"language-python\">import psycopg2\nimport time\n\ndef get_db_conn():\n    conn = psycopg2.connect(host='localhost',port=5432,database='study_demo',user='postgres',password='123456')\n    return conn\n\ndef main():\n    conn_list = list()\n    for i in range(100):\n        print(f'\u83b7\u53d6\u7b2c {i} \u4e2a\u8fde\u63a5')\n        try:\n            conn_list.append(get_db_conn())\n        except Exception:\n            print(f'\u83b7\u53d6\u7b2c {i} \u4e2a\u8fde\u63a5\u5931\u8d25')\n    print(f'\u6210\u529f\u83b7\u53d6 {len(conn_list)} \u4e2a\u8fde\u63a5')\n    time.sleep(60)\n    \nif __name__ == '__main__':\n    main()\n</code></pre>\n<p>\u7136\u540e\u4ee3\u7801\u663e\u793a\u83b7\u53d6\u5230\u4e86 95 \u4e2a\u8fde\u63a5\uff0c\u7136\u540e\u6211\u901a\u8fc7\u4ee5\u4e0b SQL \u83b7\u53d6\u8fde\u63a5\u6570</p>\n<pre><code>select count(*) from pg_stat_activity; -- \u8fd4\u56de 105\n</code></pre>\n<p>\u6211\u9884\u6d4b\u7684\u503c\u5e94\u8be5\u662f\uff1a</p>\n<ol>\n<li>Python \u83b7\u53d6\u5230 90 \u4e2a\u8fde\u63a5\uff08\u56e0\u4e3a\u6267\u884c Python \u811a\u672c\u524d\uff0c\u5c31\u6709 10 \u4e2a\u8fde\u63a5\u4e86\uff0c\u8fd9\u51e0\u4e2a\u8fde\u63a5\u53ef\u80fd\u662f\u5f00\u4e86 Navicat \u548c pgAdmin4 \u7684\u7f18\u6545\uff09</li>\n<li>pg stat activity \u6700\u540e\u5e94\u8be5\u6b63\u597d\u662f 100 \u6216\u8005 99 \uff08\u7559\u4e00\u4e2a\u8fde\u63a5\u7ed9\u8d85\u7ea7\u7528\u6237\uff1f\uff09</li>\n</ol>\n<p>\u4f46\u662f\u7ed3\u679c\u5b8c\u5168\u4e0d\u4e00\u6837\uff0c105 \u660e\u663e\u8d85\u8fc7\u4e86\uff0c\u8fd9\u591a\u51fa\u6765\u7684 5 \u4e2a\u662f\u5982\u4f55\u5f97\u5230\u7684\uff1f</p>\n", 
      "date_published": "2024-09-13T10:04:05+00:00", 
      "title": "\u5173\u4e8e PostgreSQL \u4e2d\u7684 max_connections \u548c pg_stat_activity \u7684\u7591\u60d1", 
      "id": "https://www.v2ex.com/t/1072744"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/wencan", 
        "name": "wencan", 
        "avatar": "https://cdn.v2ex.com/avatar/0690/9014/5813_large.png?m=1747997681"
      }, 
      "url": "https://www.v2ex.com/t/1072470", 
      "date_modified": "2024-09-12T22:40:05+00:00", 
      "content_html": "\u4e00\u4e2a\u5c0f\u670d\u52a1<br />\u56fd\u5916\u6709\u514d\u8d39\u7684\uff0c\u8fd8\u6709\u65b0\u52a0\u5761\u8282\u70b9\uff0c\u4f46\u7a33\u5b9a\u6027\u4e0d\u6e05\u695a<br />\u963f\u91cc\u4e91 postgresql serverless \u4e00\u5e74\u4e0b\u6765\u597d\u50cf\u4e5f\u51e0\u5343\u8d77\u6b65<br />\u4e0d\u77e5\u9053\u56fd\u5185\u6700\u9ad8\u9ad8\u6027\u4ef7\u6bd4\u7684\u662f\u54ea\u5bb6", 
      "date_published": "2024-09-12T22:39:30+00:00", 
      "title": "\u76ee\u524d\u56fd\u5185\u6700\u9ad8\u6027\u4ef7\u6bd4\u7684 postgresql \u670d\u52a1\u662f\uff1f", 
      "id": "https://www.v2ex.com/t/1072470"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/fffq", 
        "name": "fffq", 
        "avatar": "https://cdn.v2ex.com/gravatar/c532ce725b10d767f990b74d8780eb9a?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1067432", 
      "date_modified": "2024-08-26T11:45:41+00:00", 
      "content_html": "<p>\u770b\u7f51\u4e0a\u7684 blog \uff0c\u597d\u9ebb\u70e6\u554a\uff0cpostgres \u5c31\u4e0d\u80fd\u51fa\u4e2a\u7248\u672c\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u51cf\u5c11\u6216\u6d88\u9664\u4eba\u5de5\u914d\u7f6e\u5e72\u9884\uff1f</p>\n", 
      "date_published": "2024-08-24T03:17:34+00:00", 
      "title": "\u65b0\u624b\uff0c\u8bf7\u95ee postgres \u600e\u4e48\u914d\u7f6e vacuum", 
      "id": "https://www.v2ex.com/t/1067432"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/qviqvi", 
        "name": "qviqvi", 
        "avatar": "https://cdn.v2ex.com/gravatar/402cd361d8b2821d08ec9e1d892940f8?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1062183", 
      "title": "\u5b66\u4e60 PostgreSQL\uff0c\u6709\u4ec0\u4e48\u8d44\u6599\u63a8\u8350\uff1f", 
      "id": "https://www.v2ex.com/t/1062183", 
      "date_published": "2024-08-03T01:42:15+00:00", 
      "content_html": "<p>\u6709 Oracle \u548c MySQL \u7ecf\u9a8c\uff0c\u4ee5\u540e\u53ef\u80fd\u8f6c Postgre \uff0c\u4f46 PostgreSQL \u8d44\u6599\u597d\u5c11\uff0c\u6c42\u63a8\u8350</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/dwu8555", 
        "name": "dwu8555", 
        "avatar": "https://cdn.v2ex.com/avatar/80ef/3e1b/293789_large.png?m=1734394843"
      }, 
      "url": "https://www.v2ex.com/t/1055573", 
      "title": "Apache AGE \u548c Neo4j \u54ea\u4e2a\u66f4\u597d\uff1f", 
      "id": "https://www.v2ex.com/t/1055573", 
      "date_published": "2024-07-08T02:52:14+00:00", 
      "content_html": "<p>\u6211\u633a\u559c\u6b22 PostgreSQL \u7684\uff0c\u4e0d\u60f3\u5207\u6362\u5176\u4ed6\u7684\u6570\u636e\u5e93</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/dwu8555", 
        "name": "dwu8555", 
        "avatar": "https://cdn.v2ex.com/avatar/80ef/3e1b/293789_large.png?m=1734394843"
      }, 
      "url": "https://www.v2ex.com/t/1055527", 
      "title": "\u6709\u6ca1\u6709\u50cf Citus \u90a3\u6837\u65b9\u4fbf\u5206\u7247\u7684\u56fe\u6570\u636e\u5e93?", 
      "id": "https://www.v2ex.com/t/1055527", 
      "date_published": "2024-07-08T00:56:02+00:00", 
      "content_html": ""
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/itx10237", 
        "name": "itx10237", 
        "avatar": "https://cdn.v2ex.com/avatar/b106/0131/623098_large.png?m=1720230147"
      }, 
      "url": "https://www.v2ex.com/t/1055254", 
      "title": "\u600e\u6837\u4f7f\u7528 C \u8bed\u8a00\u8bbf\u95ee PostgreSQL \u96c6\u7fa4\uff1f", 
      "id": "https://www.v2ex.com/t/1055254", 
      "date_published": "2024-07-06T01:35:32+00:00", 
      "content_html": "<p>\u5b98\u7f51 <a href=\"https://www.postgresql.org/docs/14/libpq-connect.html\" rel=\"nofollow\">https://www.postgresql.org/docs/14/libpq-connect.html</a> \u7684\u6587\u6863\u4f3c\u4e4e\u6ca1\u6709\u63d0\u4f9b\u8bbf\u95ee PostgreSQL \u96c6\u7fa4\u7684 api \u3002\u5927\u5bb6\u80fd\u5e2e\u5fd9\u63d0\u4f9b\u4e00\u4e0b\u8d44\u6599\u5417\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/gosky", 
        "name": "gosky", 
        "avatar": "https://cdn.v2ex.com/gravatar/786267342d5e7b4c7bd7891c52200d49?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1051235", 
      "date_modified": "2024-06-20T09:25:49+00:00", 
      "content_html": "\u4e00\u53f0\u4f4e\u914d\u670d\u52a1\u5668<br /><br />\u8dd1\u4e86\u4e00\u5957 mysql+wordpress \uff0c\u53ef\u4ee5\u8bf4\uff0c\u4ec0\u4e48\u8bbf\u95ee\u91cf\u90fd\u6ca1\u6709\u3002wordpress \u5c31\u542f\u7528\u4e86 mobile \u63d2\u4ef6\u548c\u53cd\u5783\u573e\u8bc4\u8bba\u63d2\u4ef6<br />\u4e00\u4e2a postgresql \u5b9e\u4f8b \u4e00\u5957\u722c\u866b\u811a\u672c\u5728\u7528\uff0c\u5b58\u50a8\u7684\u6570\u636e\u91cf\u80af\u5b9a\u6bd4 mysql \u5927\u5f97\u591a<br />mysql \u5360\u7528\u5185\u5b58\u51e0\u767e M \uff0cpostgresql \u5374\u6ca1\u89c1\u5230\u51fa\u73b0\u5728 top \u91cc<br /><br />\u6240\u4ee5\uff0cmysql \u672c\u8eab\u5c31\u76f8\u5bf9\u5360\u5185\u5b58\uff1f<br /><br />\u5982\u679c\u628a\u8fd9\u4e2a\u6ca1\u4ec0\u4e48\u8bbf\u95ee\u7684 wordpress \u7684\u6570\u636e\u5e93\uff0c\u5207\u6362\u5230 polardb mysql \uff0c\u6309\u5b58\u50a8\u7a7a\u95f4\u8ba1\u8d39\uff0c\u6027\u4ef7\u6bd4\u5982\u4f55\uff1f", 
      "date_published": "2024-06-20T09:25:18+00:00", 
      "title": "\u5c0f\u7cfb\u7edf \u6570\u636e\u5e93 mysql \u548c postgresql \u6bd4\u5bf9 \u548c wordpress \u6570\u636e\u5e93\u6280\u672f\u9009\u578b", 
      "id": "https://www.v2ex.com/t/1051235"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/lucasj", 
        "name": "lucasj", 
        "avatar": "https://cdn.v2ex.com/avatar/1980/4586/557057_large.png?m=1747977598"
      }, 
      "url": "https://www.v2ex.com/t/1050830", 
      "title": "PostgreSQL \u6ca1\u6709 on update current_timestamp \u611f\u89c9\u597d\u9ebb\u70e6", 
      "id": "https://www.v2ex.com/t/1050830", 
      "date_published": "2024-06-19T05:10:03+00:00", 
      "content_html": "<p>\u4e4b\u524d\u4e00\u76f4\u7528 MySQL \uff0c\u6700\u8fd1\u4e00\u4e2a\u65b0\u9879\u76ee\u7528\u7684\u662f PostgreSQL \u3002</p>\n<p>PostgreSQL \u6ca1\u6709 <code>on update current_timestamp</code> \u53ea\u80fd\u901a\u8fc7\u89e6\u53d1\u5668\u6765\u5b9e\u73b0\u3002</p>\n<p>\u8fd9\u6837\u7684\u8bdd\u6bcf\u4e2a\u8868\u90fd\u8981\u521b\u5efa\u4e00\u4e2a trigger \uff0c\u611f\u89c9\u597d\u9ebb\u70e6\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/yustation", 
        "name": "yustation", 
        "avatar": "https://cdn.v2ex.com/gravatar/a6b26496372965d940c4ad745748b767?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1046815", 
      "title": "\u4e3b\u4ece\u540c\u6b65\u4f7f\u7528\u7684\u7aef\u53e3\u53f7\u53ef\u4ee5\u548c\u6570\u636e\u5e93\u7aef\u53e3\u53f7\u4e0d\u540c\u5417\uff1f", 
      "id": "https://www.v2ex.com/t/1046815", 
      "date_published": "2024-06-04T12:58:20+00:00", 
      "content_html": "<p>\u8bf7\u6559\u5404\u4f4d\uff0c\u4e24\u53f0\u4e3b\u673a\u4e0a\u7684 pgsql \uff0c\u914d\u7f6e\u4e86\u4e3b\u4ece\u540c\u6b65\uff0c\u600e\u6837\u914d\u7f6e\u624d\u80fd\u8ba9\u4e24\u4e2a\u6570\u636e\u5e93\u4e92\u901a\u4f7f\u7528\u7684\u7aef\u53e3\u53f7\u4e0e\u6570\u636e\u5e93\u672c\u8eab\u8fde\u63a5\u4f7f\u7528\u7684\u7aef\u53e3\u53f7\u4e0d\u540c\u5462\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/teli", 
        "name": "teli", 
        "avatar": "https://cdn.v2ex.com/gravatar/e2d0410ad1743108f0131e1ccb3ac0c6?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1044093", 
      "date_modified": "2024-05-26T11:19:32+00:00", 
      "content_html": "<p>\u5ba2\u6237\u7aef\u662f DBeaver \u3002<br/>\nPostgreSQL \u662f\u963f\u91cc\u4e91\u4e91\u670d\u52a1\u5668\u7684 docker \u8dd1\u7684\u4e0a\u3002<br/>\n\u5361\u7684\u64cd\u4f5c\u6709\uff1a\u521b\u5efa\u8868\u3001\u7b80\u5355\u7684\u67e5\u8be2<br/>\n\u5361\u7684\u8868\u73b0\u4e3a\uff1a\u4e00\u76f4\u5361\u5728\u90a3\uff0c\u4e00\u76f4\u65e0\u8fd4\u56de\uff0c\u53d6\u6d88\u90fd\u5361  \u3002\u8981\u4e48\u5e72\u561b\u90fd\u5361\uff0c\u8981\u4e48\u90fd\u4e0d\u5361</p>\n<p>\u53e6\u5916\u8fd8\u6709\u53e6\u4e00\u4e2a\u811a\u672c\u5728\u8bbf\u95ee\u6570\u636e\u5e93\uff0c\u64cd\u4f5c\u6709\u4e0b\u9762\u4e24\u4e2a\uff1a   </p>\n<pre><code>SELECT COUNT(*) FROM public.XXX WHERE qa_code = %s\n</code></pre>\n<pre><code>INSERT INTO public.XXX\n(qa_code, department, title, description, answer)\nVALUES(%s, %s, %s, %s, %s)\n</code></pre>\n<p>\u4e4b\u524d\u73a9 CockroachDB \uff0c\u4e5f\u9047\u5230\u8fc7\u4e00\u6837\u7684\u60c5\u51b5</p>\n", 
      "date_published": "2024-05-26T11:19:06+00:00", 
      "title": "\u4e3a\u4ec0\u4e48\u6709\u65f6 PostgreSQL \u6709\u65f6\u4f1a\u8868\u73b0\u5f97\u6bd4\u8f83\u5361\uff1f", 
      "id": "https://www.v2ex.com/t/1044093"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/teli", 
        "name": "teli", 
        "avatar": "https://cdn.v2ex.com/gravatar/e2d0410ad1743108f0131e1ccb3ac0c6?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1043881", 
      "title": "\u7b2c\u4e00\u6b21\u4f7f\u7528 PostgreSQL\uff0c\u8fde\u5efa\u8868\u90fd\u4e0d\u4f1a\uff0c\u8bf7\u6559\u70b9\u7ecf\u9a8c", 
      "id": "https://www.v2ex.com/t/1043881", 
      "date_published": "2024-05-25T07:46:09+00:00", 
      "content_html": "<p>\u8003\u8651 ai \u65f6\u4ee3\u4e86\u3002\u4e3a\u4e86\u7528\u4e0a pgvector \uff0c\u5c1d\u8bd5\u63a5\u4e0b\u6765\u628a\u4e3b\u6570\u636e\u5e93\u76f4\u63a5\u6362\u7528 pg \u3002</p>\n<p>\u8bf7\u6559\u70b9\u7ecf\u9a8c</p>\n<ol>\n<li>\u81ea\u589e\u957f\u4e3b\u952e\uff0c\u600e\u4e48\u8bbe\u7f6e\u4e3a\u597d\uff1f\u4e4b\u524d mysql \u90fd\u662f bitint \u81ea\u589e\u957f</li>\n<li>collate \u600e\u4e48\u9009\uff1f\u4e4b\u524d mysql \u90fd\u662f utfmb4 \u3002\u7f51\u4e0a\u8bf4\u5e94\u8be5 zh_CN-utf8 \u3002docker \u5b89\u88c5\u7684\uff0c\u6839\u672c\u6ca1 zh_CN-utf \u9009\u3002\u597d\u50cf\u8981\u81ea\u5df1\u6253\u5305\u955c\u50cf\u624d\u6709\u3002\n\u6ca1 3 \u4e86\u3002\u5efa\u8868\u90fd\u4e0d\u4f1a\u5efa\u3002\u8fd8\u6709\u4ec0\u4e48\u5176\u5b83\u5751\uff0c\u8fd8\u8bf7\u76f4\u63a5\u76f8\u544a\u3002</li>\n</ol>\n<p>\u4e4b\u524d mysql \u65f6\uff0cupdate_time \u662f\u81ea\u52a8\u66f4\u65b0\u3002postgres \u597d\u50cf\u4e0d\u80fd\u81ea\u52a8\u66f4\u65b0\uff0c\u6709\u4ec0\u4e48\u597d\u7684\u66ff\u4ee3\u65b9\u6848\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/wanniwa", 
        "name": "wanniwa", 
        "avatar": "https://cdn.v2ex.com/avatar/b5bd/0c79/362568_large.png?m=1691310579"
      }, 
      "url": "https://www.v2ex.com/t/1041239", 
      "date_modified": "2024-05-16T02:52:53+00:00", 
      "content_html": "\u6bd4\u5982\u8fd9\u79cd\u67e5\u8be2\u6709\u6ca1\u6709\u5c01\u88c5\u597d\u7684 select * from xxx where tags @&gt; ARRAY[tag1,tag2,tag3]", 
      "date_published": "2024-05-16T02:52:35+00:00", 
      "title": "Java \u6709\u6ca1\u6709\u9488\u5bf9 PostgreSQL \u597d\u7528\u4e00\u70b9\u7684 ORM", 
      "id": "https://www.v2ex.com/t/1041239"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/JackyTsang", 
        "name": "JackyTsang", 
        "avatar": "https://cdn.v2ex.com/gravatar/fb4f5f6a3eb2dd16dbbb3df26cc21a8b?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1041038", 
      "date_modified": "2024-05-15T10:02:48+00:00", 
      "content_html": "\u53ef\u80fd\u6211\u7406\u89e3\u5f97\u6bd4\u8f83\u7b80\u5355\uff0c\u5c31\u662f\u5047\u8bbe\u4e00\u4e2a\u751f\u4ea7\u7684 PostgreSQL \u6570\u636e\u5e93\u7684 A \u3001B \u3001C \u5e93\uff0c\u90fd\u5b9e\u65f6\u6216 Cron \u5b9a\u65f6\u5730\u540c\u6b65\u5230\u53e6\u5916\u4e00\u4e2a PostgreSQL \u6570\u636e\u5e93\u7684 A \u3001B \u3001C \u5e93\u3002<br /><br />\u7f51\u4e0a\u641c\u7d22\u90fd\u662f\u90fd\u662f\u5565\u5927\u6570\u636e\u76f8\u5173\u7684\u5185\u5bb9\uff0c\u4ec0\u4e48 ETL \u3001CDC \u3001ODS...\u770b\u4e0d\u61c2\uff0c\u4e14\u611f\u89c9\u6709\u4e9b\u6740\u9e21\u7528\u725b\u5200\uff1f\u8fd8\u662f\u8bf4\u53ef\u80fd\u641c\u7d22\u7684\u5173\u952e\u8bcd\u4e0d\u884c\uff1f\u6211\u4e3b\u8981\u7684\u76ee\u7684\u662f\u63d0\u4f9b\u7ed9\u7b2c\u4e09\u65b9\u5199\u89c6\u56fe\u7528\u7684\uff0c\u70c2\u89c6\u56fe\u5bf9\u6570\u636e\u5e93\u6027\u80fd\u7684\u5f71\u54cd\u5927\u5bb6\u5e94\u8be5\u90fd\u77e5\u9053\uff0c\u4ed6\u4eec\u641e\u7838\u4e86\u90fd\u4e0d\u4f1a\u5f71\u54cd\u5230\u751f\u4ea7\u5e93\u3002<br /><br />\u56e0\u4e3a\u6d89\u53ca\u5230\u589e\u5220\u6539\u67e5\uff0c\u80af\u5b9a\u6709\u8bfb\u5199\uff0c\u4e5f\u6ca1\u6cd5\u53bb\u505a\u4e00\u4e2a\u751f\u4ea7\u5e93\u7684\u6d41\u590d\u5236\u4ece\u5e93\u7ed9\u4eba\u5bb6\u7528\u3002<br /><br />\u603b\u7ed3\u4e00\u4e0b\u6211\u8981\u7684\u529f\u80fd\u53ef\u80fd\u662f\u7c7b\u4f3c Navicat \u4e0a\u7684 \u201c\u7ed3\u6784\u540c\u6b65\u201d \u4e0e \u201c\u6570\u636e\u540c\u6b65\u201d\uff0c\u7136\u540e\u5b83\u662f\u7b80\u5355\u7684\uff0c\u547d\u4ee4\u884c\u7684\uff0c\u53ef\u81ea\u52a8\u5316\u7684\u3002<br /><br />\u8c22\u8c22\u5927\u5bb6\u3002", 
      "date_published": "2024-05-15T08:19:30+00:00", 
      "title": "\u8bf7\u6559\uff0c\u6709\u65e0\u7b80\u5355\u6613\u7528\u7684 PostgreSQL \u8868\u7ed3\u6784\u3001\u6570\u636e\u7684\u540c\u6b65\u5de5\u5177\uff1f", 
      "id": "https://www.v2ex.com/t/1041038"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/wanchenyi", 
        "name": "wanchenyi", 
        "avatar": "https://cdn.v2ex.com/avatar/e0d0/a588/521281_large.png?m=1657375668"
      }, 
      "url": "https://www.v2ex.com/t/1039248", 
      "date_modified": "2024-05-10T01:49:12+00:00", 
      "content_html": "<p>PostgreSQL \u542f\u52a8\u5931\u8d25\uff0c\u62a5\u9519\u548c\u4e0b\u9762\u7c7b\u4f3c</p>\n<p>2022-05-29 21:52:22.926 CST [35270] LOG:  starting PostgreSQL 14.3 on x86_64-pc-linux-gnu,\ncompiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit\n2022-05-29 21:52:22.927 CST [35270] LOG:  listening on IPv6 address \"::1\", port 5432\n2022-05-29 21:52:22.927 CST [35270] LOG:  listening on IPv4 address \"127.0.0.1\", port 5432\n2022-05-29 21:52:22.929 CST [35270] LOG:  listening on Unix socket \"/var/run/postgresql/.s.PGSQL.5432\"\n2022-05-29 21:52:22.931 CST [35270] LOG:  listening on Unix socket \"/tmp/.s.PGSQL.5432\"\n2022-05-29 21:52:22.936 CST [35272] LOG:  database system was interrupted; last known up at 2022-05-28 21:36:11 CST\n2022-05-29 21:52:23.049 CST [35272] LOG:  invalid primary checkpoint record\n2022-05-29 21:52:23.049 CST [35272] PANIC:  could not locate a valid checkpoint record\n2022-05-29 21:52:24.211 CST [35270] LOG:  startup process (PID 35272) was terminated by signal 6: Aborted\n2022-05-29 21:52:24.211 CST [35270] LOG:  aborting startup due to startup process failure\n2022-05-29 21:52:24.218 CST [35270] LOG:  database system is shut down</p>\n<p>\u6839\u636e\u7f51\u4e0a\u67e5\u8be2\u7684\u5230\u4fe1\u606f\uff0c\u201c\u91cd\u8bbe wal\u201d\u5373\u53ef\u89e3\u51b3\u201d\uff0c\u4f46\u8fd9\u6837\u64cd\u4f5c\u53ef\u80fd\u4f1a\u4e22\u5931\u6570\u636e\uff0c\u60f3\u77e5\u9053\u5982\u4f55\u5224\u65ad\u5927\u6982\u4f1a\u4e22\u5931\u54ea\u4e9b\u6570\u636e\uff0c\u56e0\u4e3a\u662f\u751f\u4ea7\u73af\u5883\uff0c\u9700\u8981\u8bc4\u4f30\u4e00\u4e0b\uff0c\u57a6\u6c42\u5404\u4f4d\u53d1\u8868\u81ea\u5df1\u7684\u770b\u6cd5 \uff0c\u4e0d\u80dc\u611f\u6fc0\u3002</p>\n", 
      "date_published": "2024-05-09T13:09:11+00:00", 
      "title": "PostgreSQL \u542f\u52a8\u5931\u8d25", 
      "id": "https://www.v2ex.com/t/1039248"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/wzw", 
        "name": "wzw", 
        "avatar": "https://cdn.v2ex.com/avatar/c72a/cf0f/78954_large.png?m=1699319258"
      }, 
      "url": "https://www.v2ex.com/t/1036625", 
      "date_modified": "2024-04-29T10:53:50+00:00", 
      "content_html": "<p>\u76ee\u524d\u9700\u8981\u4e0a\u65b0\u9879\u76ee, \u7528\u4e86 PostgreSQL, \u8fd9\u6837\u7684\u8bbe\u7f6e\u662f\u4e0d\u662f\u6b63\u5e38\u60c5\u51b5\u4e0b, \u6700\u7b80\u5355\u6700\u5408\u9002?</p>\n<p>\u8c22\u8c22</p>\n<pre><code>pg_createcluster 16 main --locale=C --encoding=UTF8 --start\n</code></pre>\n<p>===</p>\n<p>\u770b\u5230\u8fd9\u7bc7\u6587\u7ae0</p>\n<p>PG \u4e2d\u7684\u672c\u5730\u5316\u6392\u5e8f\u89c4\u5219\n<a href=\"https://pigsty.io/zh/blog/admin/collate/\" rel=\"nofollow\">https://pigsty.io/zh/blog/admin/collate/</a></p>\n<p>\u91cc\u9762\u63d0\u5230:</p>\n<p>\u4e3a\u4ec0\u4e48 Pigsty \u5728\u521d\u59cb\u5316 Postgres \u6570\u636e\u5e93\u65f6\u9ed8\u8ba4\u6307\u5b9a\u4e86 locale=C \u4e0e encoding=UTF8</p>\n<p>\u7b54\u6848\u5176\u5b9e\u5f88\u7b80\u5355\uff0c\u9664\u975e\u771f\u7684\u660e\u786e\u77e5\u9053\u81ea\u5df1\u4f1a\u7528\u5230 LOCALE \u76f8\u5173\u529f\u80fd\uff0c\u5426\u5219\u5c31\u6839\u672c\u4e0d\u5e94\u8be5\u914d\u7f6e C.UTF8 \u4e4b\u5916\u7684\u4efb\u4f55\u5b57\u7b26\u7f16\u7801\u4e0e\u672c\u5730\u5316\u6392\u5e8f\u89c4\u5219\u9009\u9879</p>\n", 
      "date_published": "2024-04-29T02:02:50+00:00", 
      "title": "PostgreSQL \u6570\u636e\u5e93 \u6b63\u5e38\u60c5\u51b5\u4e0b\u6307\u5b9a\u4e86 locale=C \u4e0e encoding=UTF8 (\u6700\u7b80\u5355)", 
      "id": "https://www.v2ex.com/t/1036625"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/mingwiki", 
        "name": "mingwiki", 
        "avatar": "https://cdn.v2ex.com/avatar/a2f7/0209/282577_large.png?m=1743062267"
      }, 
      "url": "https://www.v2ex.com/t/1036295", 
      "title": "\u9519\u8bef\u8fc1\u79fb pgsql \u5bfc\u81f4\u65e5\u5fd7\u62a5 warning\uff0c\u8bf7\u95ee\u5982\u4f55\u89e3\u51b3\uff1f", 
      "id": "https://www.v2ex.com/t/1036295", 
      "date_published": "2024-04-28T02:28:39+00:00", 
      "content_html": "<p>\u6362\u7cfb\u7edf\u7684\u65f6\u5019\u56fe\u7b80\u5355\u8111\u5b50\u62bd\u62bd\u4e86\uff0c\u76f4\u63a5 tar czf /var/lib/postgresql \u3002\u540e\u89e3\u538b\u653e\u5230\u65b0\u7cfb\u7edf/var/lib \u76ee\u5f55\u4e0b,\u6ca1\u6709\u7528 dump pgloader \u4e4b\u7c7b\u7684\u5de5\u5177\u3002\u73b0\u5728\u6240\u6709\u7684 database \u4e00\u76f4\u62a5\u540c\u4e00\u4e2a\u9519\uff0c\u4e0d\u91cd\u5efa\u6240\u6709\u6570\u636e\u5e93\u53ef\u4ee5\u89e3\u51b3\u5417\uff1f\n\u62a5\u9519\u5982\u4e0b\uff0c\u67e5\u8be2 gemini/gpt3.5 \u65e0\u679c\uff0c\u5c1d\u8bd5<code>ALTER DATABASE xxx REFRESH COLLATION VERSION;</code>\u663e\u793a invalid collation version. \u8bf7\u95ee\u5927\u4f6c\u4eec\u5982\u4f55\u89e3\u51b3\uff1f</p>\n<pre><code>\"2024-04-28 10:07:27.248 CST [3392] WARNING: database \\\"template1\\\" has no actual collation version, but a version was recorded\",\n\"2024-04-28 10:07:39.298 CST [3393] WARNING: database \\\"postgres\\\" has no actual collation version, but a version was recorded\",\n\"2024-04-28 10:07:49.150 CST [3398] WARNING: database \\\"vaultwarden\\\" has no actual collation version, but a version was recorded\",\n\"2024-04-28 10:07:49.150 CST [3399] WARNING: database \\\"vaultwarden\\\" has no actual collation version, but a version was recorded\",\n\"2024-04-28 10:07:51.323 CST [3400] WARNING: database \\\"vaultwarden\\\" has no actual collation version, but a version was recorded\",\n\"2024-04-28 10:08:03.244 CST [3401] WARNING: database \\\"miniflux\\\" has no actual collation version, but a version was recorded\",\n\"2024-04-28 10:08:15.275 CST [3402] WARNING: database \\\"core\\\" has no actual collation version, but a version was recorded\",\n</code></pre>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/coinbase", 
        "name": "coinbase", 
        "avatar": "https://cdn.v2ex.com/avatar/6968/2696/667684_large.png?m=1715427512"
      }, 
      "url": "https://www.v2ex.com/t/1028253", 
      "title": "\u4ece Mongodb \u5230 PostgreSQL \u7684\u5927\u8fc1\u79fb", 
      "id": "https://www.v2ex.com/t/1028253", 
      "date_published": "2024-03-29T13:48:10+00:00", 
      "content_html": "<p><a href=\"https://infisical.com/blog/postgresql-migration-technical\" rel=\"nofollow\">https://infisical.com/blog/postgresql-migration-technical</a></p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Comyn", 
        "name": "Comyn", 
        "avatar": "https://cdn.v2ex.com/avatar/91b2/7ea7/374049_large.png?m=1775814584"
      }, 
      "url": "https://www.v2ex.com/t/1027812", 
      "title": "\u6709\u65e0 pg \u7684\u5165\u95e8\u7cbe\u8fdb\u535a\u5ba2\u6216\u8005\u89c6\u9891\u63a8\u8350", 
      "id": "https://www.v2ex.com/t/1027812", 
      "date_published": "2024-03-28T07:46:38+00:00", 
      "content_html": ""
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/sirthisman", 
        "name": "sirthisman", 
        "avatar": "https://cdn.v2ex.com/avatar/cc63/200f/354803_large.png?m=1559783972"
      }, 
      "url": "https://www.v2ex.com/t/1019809", 
      "title": "\u6709\u4ec0\u4e48\u4e0d\u901a\u8fc7\u5199\u811a\u672c\u7684\u65b9\u5f0f\uff0c\u5c06 postgreSQL \u7684\u5efa\u8868\u8bed\u53e5\u8f6c\u6362\u4e3a doris \u7684\u5efa\u8868\u8bed\u53e5\u5417\uff1f", 
      "id": "https://www.v2ex.com/t/1019809", 
      "date_published": "2024-03-01T07:02:47+00:00", 
      "content_html": "<p>\u6c42\u52a9\uff0c\u6211\u4eec\u8981\u505a\u4ece hawq \u5f15\u64ce\uff08\u5efa\u8868\u8bed\u53e5\u662f postgreSQL \u683c\u5f0f\uff09\u5230 Starrocks \uff08\u5efa\u8868\u8bed\u53e5\u662f doris \u683c\u5f0f\uff09\u6570\u636e\u5e93\u7684\u6570\u636e\u8fc1\u79fb\u3002\u5927\u6982\u6570\u767e\u5f20\u8868\u3002\u9700\u8981\u5728 Starrocks \u4e2d\u540c\u6b65\u5bf9\u5e94\u8868\u7ed3\u6784\u3002\u8bf7\u6559\u4e0b\u5404\u4f4d\u6709\u4ec0\u4e48\u5de5\u5177\u53ef\u4ee5\u6279\u91cf\u8f6c\u6362\u5efa\u8868\u8bed\u53e5\u4e48\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/coinbase", 
        "name": "coinbase", 
        "avatar": "https://cdn.v2ex.com/avatar/6968/2696/667684_large.png?m=1715427512"
      }, 
      "url": "https://www.v2ex.com/t/1016671", 
      "title": "\u65b0\u7684 PostgreSQL \u8bed\u8a00\u63d2\u4ef6 PL/PRQL", 
      "id": "https://www.v2ex.com/t/1016671", 
      "date_published": "2024-02-19T14:10:05+00:00", 
      "content_html": "<p><a href=\"https://github.com/kaspermarstal/plprql\" rel=\"nofollow\">https://github.com/kaspermarstal/plprql</a></p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/qweruiop", 
        "name": "qweruiop", 
        "avatar": "https://cdn.v2ex.com/avatar/d6c7/d64e/634178_large.png?m=1704960981"
      }, 
      "url": "https://www.v2ex.com/t/1014708", 
      "date_modified": "2024-02-07T14:44:32+00:00", 
      "content_html": "<p>\u73b0\u5728\u6709 2 \u5f20\u8868\uff1astudent \u548c transactions</p>\n<p>student \u957f\u8fd9\u6837\uff1a</p>\n<table>\n<thead>\n<tr>\n<th>id</th>\n<th>name</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n<td>a</td>\n</tr>\n<tr>\n<td>2</td>\n<td>b</td>\n</tr>\n<tr>\n<td>3</td>\n<td>c</td>\n</tr>\n</tbody></table><p>transactions </p>\n<table>\n<thead>\n<tr>\n<th>id</th>\n<th>student_id</th>\n<th>updated_at</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n<td>1</td>\n<td>2024-02-06T16:41:05+08:00</td>\n</tr>\n<tr>\n<td>2</td>\n<td>1</td>\n<td>2024-02-06T13:41:05+08:00</td>\n</tr>\n<tr>\n<td>3</td>\n<td>2</td>\n<td>2024-02-06T12:41:05+08:00</td>\n</tr>\n</tbody></table><p>\u73b0\u5728\u60f3\u5728 postgres \u91cc\u9762\u7528\u4e00\u4e2a sql \uff0c\u67e5\u51fa\u6bcf\u4e2a\u7528\u6237\u7684 transaction \u6570\u91cf\uff0c\u5e76\u4e14\u628a\u6ca1\u6709\u7684\u591a\u4e00\u884c\u4e3a 0 \u3002</p>\n<pre><code>SELECT s.id AS student_id, s.name, COUNT(t.id) AS transactions_count\nFROM student s\nLEFT JOIN transactions t ON s.id = t.student_id\nGROUP BY s.id, s.name;\n</code></pre>\n<p>\u4f46\u662f\u8fd9\u6837\uff0c\u67e5\u51fa\u6765\u7684\u7ed3\u679c\u662f</p>\n<table>\n<thead>\n<tr>\n<th>student_id</th>\n<th>name</th>\n<th>transactions_count</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n<td>a</td>\n<td>2</td>\n</tr>\n<tr>\n<td>2</td>\n<td>b</td>\n<td>1</td>\n</tr>\n</tbody></table><p>\u4f46\u662f\u6211\u4eec\u9700\u8981\u67e5\u51fa\u7684\u7ed3\u679c\u662f</p>\n<table>\n<thead>\n<tr>\n<th>student_id</th>\n<th>name</th>\n<th>transactions_count</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n<td>a</td>\n<td>2</td>\n</tr>\n<tr>\n<td>2</td>\n<td>b</td>\n<td>1</td>\n</tr>\n<tr>\n<td>3</td>\n<td>c</td>\n<td>0</td>\n</tr>\n</tbody></table><p>\u6c42\u6559\u5404\u4f4d\u9ad8\u624b\u6307\u70b9\u4e0b\u8fd9\u4e2a sql \u600e\u4e48\u5199\u3002\u3002\u3002</p>\n", 
      "date_published": "2024-02-06T08:47:45+00:00", 
      "title": "\u8bf7\u6559\u4e00\u4e2a\u7ecf\u5178\u7684 postgres \u7684 sql \u600e\u4e48\u5199", 
      "id": "https://www.v2ex.com/t/1014708"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/ryan19961996", 
        "name": "ryan19961996", 
        "avatar": "https://cdn.v2ex.com/gravatar/48f9393fadf952117aea6976b1e7f077?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1011215", 
      "title": "\u6d17\u6570\u636e\uff1a\u5982\u4f55\u5c06 Contact \u548c ContactTag \u591a\u5bf9\u591a\u5173\u8054\u8d77\u6765", 
      "id": "https://www.v2ex.com/t/1011215", 
      "date_published": "2024-01-24T07:42:31+00:00", 
      "content_html": "<pre><code>model Contact {\n  id               String              @id @default(cuid())\n  metadata         Json?               @db.JsonB\n  contactTags      ContactTag[]\n  ...\n  @@index([metadata(ops: JsonbPathOps)], type: Gin)\n}\n\nmodel ContactTag {\n  id          String      @id @default(cuid())\n  slug        String\n  contacts    Contact[]\n  ...\n}\n</code></pre>\n<p>\u7531\u4e8e\u5386\u53f2\u9057\u7559\u539f\u56e0\uff0cContact \u548c ContactTag \u4e4b\u524d\u6ca1\u6709\u5173\u8054\u5173\u7cfb\u3002Contact \u7684 metadata \u91cc\u9762\u5197\u4f59\u4e86\u4e00\u4efd tags,\u7c7b\u4f3c {tags:[\"newsletter\",\"new-customer\"]}\u3002\u901a\u8fc7\u6807\u7b7e\u7b5b\u9009 Contact \u7684\u65f6\u5019\uff0c\u662f\u901a\u8fc7 \u67e5\u627e metadata \u7684 tags \u3002\u4f46\u662f\u6548\u7387\u786e\u5b9e\u592a\u4f4e\u4e86, Contact \u8868\u7684\u6570\u91cf\u5f88\u591a\uff0c\u5927\u6982\u662f 1350 \u4e07\u884c\u3002\u6240\u4ee5\u6211\u4eec\u60f3\u989d\u5916\u52a0\u4e00\u4e2a\u8868\u5b58\u50a8\u5173\u8054\u5173\u7cfb\u3002\u8bf7\u6559\u4e00\u4e0b\u5404\u4f4d\u5927\u4f6c\uff0c\u76f8\u5e94\u7684 sql \u600e\u4e48\u5199\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/danielxuforever", 
        "name": "danielxuforever", 
        "avatar": "https://cdn.v2ex.com/avatar/d1cb/3494/572974_large.png?m=1726550412"
      }, 
      "url": "https://www.v2ex.com/t/1010986", 
      "title": "Postgres \u5728\u4e2d\u56fd\u8fd8\u80fd\u8d77\u6765\u4e48\uff1f", 
      "id": "https://www.v2ex.com/t/1010986", 
      "date_published": "2024-01-23T11:45:05+00:00", 
      "content_html": "\u4eca\u5929\uff0c\u641c\u7d22\u4e86\u4e00\u4e0b PG \u548c MySQL \u4e3a\u4ec0\u4e48\u5728\u4e2d\u56fd\u5e02\u573a\u5dee\u8fd9\u4e48\u591a\uff08 10 \u88ab\uff09\u7684\u539f\u56e0\uff0c\u4e3b\u8981\u6709\uff1a<br />* \u5f53\u5e74 pg \u521a\u5f00\u59cb\u6ca1\u6709\u652f\u6301 windows \u8ba9 mysql \u62a2\u4e86\u5148\u673a<br />* \u4e00\u76f4\u4ee5\u6765\u7684\u8fdb\u7a0b\u6a21\u578b\uff0c\u5360\u5185\u5b58\u6bd4\u8f83\u591a<br />* \u867d\u7136\u5565\u90fd\u53ef\u4ee5\u505a\uff0c\u4f46\u662f\u4e5f\u5c31\u610f\u5473\u7740\u66f4\u591a\u8981\u5b66\uff0c\u4f46\u662f\u4e00\u822c\u4eba\u8c01\u7231\u5b66\u4e60\u554a\uff0c\u6253\u5de5\u4eba\u90fd\u60f3\u5b8c\u6210\u4e86\u5c31\u884c\uff0c\u4e3b\u7ba1\u4e5f\u4e0d\u770b\u4f60\u8fd9\u4e9b\u4e1c\u897f\uff0c\u53ea\u770b\u5bf9\u4e1a\u52a1\u5e26\u6765\u4e86\u4ec0\u4e48<br /><br />\u603b\u7ed3\u4e0b\u6765<br /><br />PG \u56e0\u4e3a\u521d\u671f\u7b56\u7565\uff0c\u5931\u53bb\u4e86\u5148\u673a\uff0c\u90a3\u5927\u5bb6\u89c9\u5f97\u5b83\u8fd8\u80fd\u7ffb\u8eab\u4e48\uff1f"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/coinbase", 
        "name": "coinbase", 
        "avatar": "https://cdn.v2ex.com/avatar/6968/2696/667684_large.png?m=1715427512"
      }, 
      "url": "https://www.v2ex.com/t/1008415", 
      "title": "PostgreSQL 17 \u589e\u52a0\u589e\u91cf\u5907\u4efd\u7684\u529f\u80fd", 
      "id": "https://www.v2ex.com/t/1008415", 
      "date_published": "2024-01-13T13:39:11+00:00", 
      "content_html": "<p><a href=\"https://pganalyze.com/blog/5mins-postgres-17-incremental-backups#:%7E:text=Introducing%20incremental%20backups%20in%20Postgres%2017,-I%20was%20very&amp;text=The%20idea%20is%20that%20you,data%20files%20that%20have%20changed\" rel=\"nofollow\">https://pganalyze.com/blog/5mins-postgres-17-incremental-backups#:~:text=Introducing%20incremental%20backups%20in%20Postgres%2017,-I%20was%20very&amp;text=The%20idea%20is%20that%20you,data%20files%20that%20have%20changed</a>.</p>\n<p>\u8c8c\u4f3c\u8fd8\u4e0d\u9519</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/vanpeisi7", 
        "name": "vanpeisi7", 
        "avatar": "https://cdn.v2ex.com/gravatar/6cb3e037607ee40728260d6f64d36f1d?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1006797", 
      "title": "\u6c42\u52a9\uff0c\u5173\u4e8e sql \u67e5\u8be2\u65f6\u95f4\u53d6\u5e76\u96c6\u7684\u60c5\u51b5", 
      "id": "https://www.v2ex.com/t/1006797", 
      "date_published": "2024-01-08T05:36:53+00:00", 
      "content_html": "<p>\u5982\u4e0b,\u8fd9\u79cd\u8be5\u5982\u4f55\u4f18\u5316\uff0c\u6dfb\u52a0 open_time \u548c close_time \u7684\u7d22\u5f15\uff0c\u4f46\u662f\u8fd8\u662f\u6bd4\u8f83\u6162\uff0c\u67e5\u8be2\u65f6\u5019\u5927\u7ea6 500ms.</p>\n<p>select\ncount(1)\nfrom\nswitchcover\nwhere\nopen_time &lt;= '2024-01-07 23:59:59'\nand close_time&gt;= '2024-01-07 00:00:00'\n;</p>\n"
    }
  ]
}