{"id":61659,"date":"2026-01-18T10:41:44","date_gmt":"2026-01-18T02:41:44","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/61659.html"},"modified":"2026-01-18T10:41:44","modified_gmt":"2026-01-18T02:41:44","slug":"postgresql%e5%ae%9e%e6%88%98%ef%bc%9a%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6-postgresql-conf-%e8%af%a6%e8%a7%a3%e5%8f%8a%e5%ae%89%e8%a3%85%e5%90%8e%e5%bf%85%e9%a1%bb%e8%b0%83%e6%95%b4%e7%9a%84%e5%85%b3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/61659.html","title":{"rendered":"PostgreSQL\u5b9e\u6218\uff1a\u914d\u7f6e\u6587\u4ef6 postgresql.conf \u8be6\u89e3\u53ca\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684\u5173\u952e\u53c2\u6570"},"content":{"rendered":"<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>\n<ul>\n<li>\u4e00\u3001postgresql.conf \u57fa\u7840\u77e5\u8bc6<\/li>\n<li>\n<ul>\n<li>1.1 \u6587\u4ef6\u4f4d\u7f6e<\/li>\n<li>1.2 \u914d\u7f6e\u8bed\u6cd5<\/li>\n<li>1.3 \u914d\u7f6e\u5c42\u7ea7\u4e0e\u4f18\u5148\u7ea7<\/li>\n<li>1.4 \u4f7f\u7528\u5efa\u8bae<\/li>\n<\/ul>\n<\/li>\n<li>\u4e8c\u3001\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684 10 \u4e2a\u5173\u952e\u53c2\u6570<\/li>\n<li>\n<ul>\n<li>2.1 shared_buffers<\/li>\n<li>2.2 effective_cache_size<\/li>\n<li>2.3 work_mem<\/li>\n<li>2.4 maintenance_work_mem<\/li>\n<li>2.5 max_connections<\/li>\n<li>2.6 checkpoint_completion_target<\/li>\n<li>2.7 wal_buffers<\/li>\n<li>2.8 random_page_cost \u4e0e seq_page_cost<\/li>\n<li>2.9 log_statement \u4e0e log_min_duration_statement<\/li>\n<li>2.10 listen_addresses<\/li>\n<\/ul>\n<\/li>\n<li>\u4e09\u3001\u5176\u4ed6\u91cd\u8981\u53c2\u6570\u5206\u7c7b\u8be6\u89e3<\/li>\n<li>\n<ul>\n<li>3.1 \u5185\u5b58\u76f8\u5173<\/li>\n<li>3.2 WAL \u4e0e\u53ef\u9760\u6027<\/li>\n<li>3.3 \u67e5\u8be2\u4e0e\u4f18\u5316\u5668<\/li>\n<li>3.4 \u590d\u5236\u4e0e\u9ad8\u53ef\u7528<\/li>\n<\/ul>\n<\/li>\n<li>\u56db\u3001\u914d\u7f6e\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5<\/li>\n<li>\n<ul>\n<li>4.1 \u4f7f\u7528 ALTER SYSTEM \u7edf\u4e00\u7ba1\u7406<\/li>\n<li>4.2 \u5206\u79bb\u81ea\u5b9a\u4e49\u914d\u7f6e<\/li>\n<li>4.3 \u76d1\u63a7\u914d\u7f6e\u751f\u6548\u72b6\u6001<\/li>\n<li>4.4 \u5907\u4efd\u539f\u59cb\u914d\u7f6e<\/li>\n<\/ul>\n<\/li>\n<li>\u4e94\u3001\u5178\u578b\u573a\u666f\u914d\u7f6e\u6848\u4f8b<\/li>\n<li>\n<ul>\n<li>5.1 OLTP \u751f\u4ea7\u670d\u52a1\u5668&#xff08;32GB RAM, SSD&#xff09;<\/li>\n<li>5.2 \u6570\u636e\u4ed3\u5e93&#xff08;64GB RAM, \u5927\u91cf\u805a\u5408\u67e5\u8be2&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\u516d\u3001\u5e38\u89c1\u9519\u8bef\u4e0e\u6392\u67e5<\/li>\n<li>\n<ul>\n<li>6.1 \u4fee\u6539\u540e\u672a\u751f\u6548<\/li>\n<li>6.2 \u5185\u5b58\u6ea2\u51fa&#xff08;OOM&#xff09;<\/li>\n<li>6.3 \u6027\u80fd\u672a\u63d0\u5347<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u672c\u6587\u5c06\u7cfb\u7edf\u6027\u5730\u89e3\u6790 postgresql.conf \u7684\u7ed3\u6784\u3001\u5e38\u7528\u53c2\u6570\u542b\u4e49&#xff0c;\u5e76\u91cd\u70b9\u6307\u51fa\u65b0\u5b89\u88c5 PostgreSQL \u540e\u5fc5\u987b\u8c03\u6574\u7684\u82e5\u5e72\u5173\u952e\u53c2\u6570&#xff0c;\u5e2e\u52a9 DBA \u548c\u5f00\u53d1\u8005\u5feb\u901f\u5b8c\u6210\u751f\u4ea7\u7ea7\u521d\u59cb\u5316\u914d\u7f6e\u3002\u9002\u7528\u4e8e PostgreSQL 12 \u53ca\u4ee5\u4e0a\u7248\u672c&#xff08;\u4e3b\u6d41 LTS \u7248\u672c&#xff09;\u3002<\/p>\n<p>PostgreSQL \u7684\u5f3a\u5927\u4e0d\u4ec5\u6e90\u4e8e\u5176\u5148\u8fdb\u7684\u5185\u6838\u67b6\u6784&#xff0c;\u4e5f\u5f97\u76ca\u4e8e\u9ad8\u5ea6\u53ef\u5b9a\u5236\u7684\u8fd0\u884c\u65f6\u914d\u7f6e\u3002\u5176\u4e2d&#xff0c;postgresql.conf \u662f PostgreSQL \u6700\u6838\u5fc3\u7684\u914d\u7f6e\u6587\u4ef6&#xff0c;\u51e0\u4e4e\u63a7\u5236\u7740\u6570\u636e\u5e93\u5b9e\u4f8b\u7684\u6240\u6709\u884c\u4e3a\u2014\u2014\u4ece\u5185\u5b58\u5206\u914d\u3001\u8fde\u63a5\u7ba1\u7406\u3001\u65e5\u5fd7\u8bb0\u5f55\u5230\u67e5\u8be2\u4f18\u5316\u4e0e\u590d\u5236\u673a\u5236\u3002\u6b63\u786e\u7406\u89e3\u548c\u8c03\u6574\u8be5\u6587\u4ef6\u4e2d\u7684\u53c2\u6570&#xff0c;\u662f\u4fdd\u969c\u6570\u636e\u5e93\u6027\u80fd\u3001\u7a33\u5b9a\u6027\u4e0e\u5b89\u5168\u6027\u7684\u5173\u952e\u3002<\/p>\n<h3>\u4e00\u3001postgresql.conf \u57fa\u7840\u77e5\u8bc6<\/h3>\n<h4>1.1 \u6587\u4ef6\u4f4d\u7f6e<\/h4>\n<p>postgresql.conf \u4f4d\u4e8e PostgreSQL \u7684\u6570\u636e\u76ee\u5f55&#xff08;PGDATA&#xff09;\u4e2d&#xff0c;\u5178\u578b\u8def\u5f84\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>Linux (APT\/YUM): \/etc\/postgresql\/16\/main\/postgresql.conf \u6216 \/var\/lib\/pgsql\/16\/data\/postgresql.conf<\/li>\n<li>Windows: C:\\\\Program Files\\\\PostgreSQL\\\\16\\\\data\\\\postgresql.conf<\/li>\n<li>macOS (Homebrew): \/opt\/homebrew\/var\/postgresql&#064;16\/postgresql.conf<\/li>\n<\/ul>\n<p>\u53ef\u901a\u8fc7 SQL \u67e5\u8be2\u786e\u8ba4&#xff1a;<\/p>\n<p><span class=\"token keyword\">SHOW<\/span> config_file<span class=\"token punctuation\">;<\/span><\/p>\n<h4>1.2 \u914d\u7f6e\u8bed\u6cd5<\/h4>\n<ul>\n<li>\u6bcf\u884c\u4e00\u4e2a\u53c2\u6570&#xff0c;\u683c\u5f0f\u4e3a parameter &#061; value<\/li>\n<li>\u6ce8\u91ca\u4ee5 # \u5f00\u5934<\/li>\n<li>\u503c\u53ef\u5e26\u5f15\u53f7&#xff08;\u5b57\u7b26\u4e32&#xff09;&#xff0c;\u4e5f\u53ef\u4e0d\u5e26&#xff08;\u6570\u5b57\u3001\u5e03\u5c14\u503c&#xff09;<\/li>\n<li>\u4fee\u6539\u540e\u90e8\u5206\u53c2\u6570\u9700\u91cd\u542f\u751f\u6548&#xff0c;\u90e8\u5206\u4ec5\u9700\u91cd\u8f7d&#xff08;reload&#xff09;<\/li>\n<\/ul>\n<p>\u5224\u65ad\u662f\u5426\u9700\u91cd\u542f&#xff1a;<\/p>\n<p><span class=\"token keyword\">SELECT<\/span> name<span class=\"token punctuation\">,<\/span> context <span class=\"token keyword\">FROM<\/span> pg_settings <span class=\"token keyword\">WHERE<\/span> name <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;shared_buffers&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">&#8212; context \u503c\u8bf4\u660e&#xff1a;<\/span><br \/>\n<span class=\"token comment\">&#8212; &#039;postmaster&#039; \u2192 \u5fc5\u987b\u91cd\u542f<\/span><br \/>\n<span class=\"token comment\">&#8212; &#039;sighup&#039;     \u2192 \u91cd\u8f7d\u5373\u53ef&#xff08;pg_ctl reload \u6216 SELECT pg_reload_conf()&#xff09;<\/span><br \/>\n<span class=\"token comment\">&#8212; &#039;user&#039;       \u2192 \u4f1a\u8bdd\u7ea7&#xff0c;SET \u5373\u53ef<\/span><\/p>\n<h4>1.3 \u914d\u7f6e\u5c42\u7ea7\u4e0e\u4f18\u5148\u7ea7<\/h4>\n<p>PostgreSQL \u652f\u6301\u591a\u7ea7\u914d\u7f6e&#xff0c;\u4f18\u5148\u7ea7\u4ece\u9ad8\u5230\u4f4e\u4e3a&#xff1a;<\/p>\n<li>ALTER SYSTEM SET&#xff08;\u5199\u5165 postgresql.auto.conf&#xff09;<\/li>\n<li>\u547d\u4ee4\u884c\u542f\u52a8\u53c2\u6570&#xff08;\u5982 -c shared_buffers&#061;512MB&#xff09;<\/li>\n<li>postgresql.conf \u6587\u4ef6<\/li>\n<li>\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c<\/li>\n<p>\u63a8\u8350\u4f7f\u7528 ALTER SYSTEM \u7ba1\u7406\u751f\u4ea7\u914d\u7f6e&#xff0c;\u4fbf\u4e8e\u8ffd\u8e2a\u53d8\u66f4\u3002<\/p>\n<h4>1.4 \u4f7f\u7528\u5efa\u8bae<\/h4>\n<p>postgresql.conf \u662f PostgreSQL \u6027\u80fd\u8c03\u4f18\u7684\u201c\u603b\u5f00\u5173\u201d\u3002\u65b0\u5b89\u88c5\u540e\u7684\u9ed8\u8ba4\u914d\u7f6e\u4ec5\u9002\u7528\u4e8e\u5b66\u4e60\u548c\u6d4b\u8bd5&#xff0c;\u7edd\u4e0d\u80fd\u76f4\u63a5\u7528\u4e8e\u751f\u4ea7\u73af\u5883\u3002DBA \u5fc5\u987b\u6839\u636e\u786c\u4ef6\u8d44\u6e90\u3001\u4e1a\u52a1\u8d1f\u8f7d\u7c7b\u578b&#xff08;OLTP\/OLAP&#xff09;\u3001\u53ef\u9760\u6027\u8981\u6c42\u7b49\u56e0\u7d20&#xff0c;\u7cfb\u7edf\u6027\u5730\u8c03\u6574\u5185\u5b58\u3001\u8fde\u63a5\u3001WAL\u3001\u65e5\u5fd7\u7b49\u5173\u952e\u53c2\u6570\u3002<\/p>\n<p>\u7136\u540e\u5e94\u5efa\u7acb\u76d1\u63a7\u4f53\u7cfb&#xff08;\u5982 Prometheus &#043; pg_exporter&#xff09;&#xff0c;\u6301\u7eed\u89c2\u5bdf\u6570\u636e\u5e93\u884c\u4e3a&#xff0c;\u5e76\u57fa\u4e8e\u5b9e\u9645\u8d1f\u8f7d\u8fed\u4ee3\u4f18\u5316\u914d\u7f6e\u3002\u8bb0\u4f4f&#xff1a;\u6ca1\u6709\u201c\u6700\u4f73\u914d\u7f6e\u201d&#xff0c;\u53ea\u6709\u201c\u6700\u9002\u5408\u5f53\u524d\u573a\u666f\u201d\u7684\u914d\u7f6e\u3002<\/p>\n<p>\u6700\u540e\u5efa\u8bae\u7ed3\u5408 pg_stat_statements\u3001EXPLAIN \u548c\u7cfb\u7edf\u76d1\u63a7\u5de5\u5177&#xff0c;\u6df1\u5165\u5206\u6790\u67e5\u8be2\u6027\u80fd&#xff0c;\u771f\u6b63\u91ca\u653e PostgreSQL \u7684\u5f3a\u5927\u6f5c\u80fd\u3002<\/p>\n<h3>\u4e8c\u3001\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684 10 \u4e2a\u5173\u952e\u53c2\u6570<\/h3>\n<p>\u65b0\u5b89\u88c5\u7684 PostgreSQL \u4f7f\u7528\u4fdd\u5b88\u9ed8\u8ba4\u503c&#xff0c;\u9002\u5408\u5c0f\u578b\u5f00\u53d1\u73af\u5883&#xff0c;\u4f46\u7edd\u4e0d\u9002\u7528\u4e8e\u751f\u4ea7\u3002\u4ee5\u4e0b\u662f\u5fc5\u987b\u6839\u636e\u670d\u52a1\u5668\u8d44\u6e90\u548c\u4e1a\u52a1\u9700\u6c42\u8c03\u6574\u7684\u6838\u5fc3\u53c2\u6570\u3002<\/p>\n<h4>2.1 shared_buffers<\/h4>\n<p>\u4f5c\u7528&#xff1a;PostgreSQL \u7528\u4e8e\u7f13\u5b58\u6570\u636e\u9875\u7684\u5171\u4eab\u5185\u5b58\u5927\u5c0f\u3002 \u9ed8\u8ba4\u503c&#xff1a;128MB&#xff08;\u6781\u5c0f&#xff09; \u5efa\u8bae\u503c&#xff1a;\u7269\u7406\u5185\u5b58\u7684 25%&#xff08;\u4e0d\u8d85\u8fc7 8GB&#xff0c;\u9664\u975e\u8d85\u5927\u5185\u5b58\u7cfb\u7edf&#xff09; \u7c7b\u578b&#xff1a;postmaster&#xff08;\u9700\u91cd\u542f&#xff09;<\/p>\n<p>\u793a\u4f8b&#xff08;32GB \u5185\u5b58\u670d\u52a1\u5668&#xff09;&#xff1a;<\/p>\n<p> shared_buffers &#061; 8GB<\/p>\n<p>\u539f\u7406&#xff1a;<\/p>\n<ul>\n<li>\u8fc7\u5c0f \u2192 \u9891\u7e41\u8bfb\u78c1\u76d8&#xff0c;I\/O \u6210\u74f6\u9888<\/li>\n<li>\u8fc7\u5927 \u2192 \u64cd\u4f5c\u7cfb\u7edf\u9875\u7f13\u5b58\u88ab\u6324\u538b&#xff0c;\u53cd\u800c\u964d\u4f4e\u6027\u80fd<\/li>\n<li>PostgreSQL \u4f9d\u8d56 OS \u7f13\u5b58 &#043; \u81ea\u8eab shared_buffers \u53cc\u5c42\u7f13\u5b58&#xff0c;25% \u662f\u7ecf\u9a8c\u5e73\u8861\u70b9<\/li>\n<\/ul>\n<hr \/>\n<h4>2.2 effective_cache_size<\/h4>\n<p>\u4f5c\u7528&#xff1a;\u544a\u77e5\u67e5\u8be2\u89c4\u5212\u5668\u64cd\u4f5c\u7cfb\u7edf\u53ef\u7528\u7684\u78c1\u76d8\u7f13\u5b58\u5927\u5c0f&#xff08;\u975e\u5b9e\u9645\u5206\u914d\u5185\u5b58&#xff09;\u3002 \u9ed8\u8ba4\u503c&#xff1a;4GB \u5efa\u8bae\u503c&#xff1a;\u7269\u7406\u5185\u5b58\u7684 50%~75% \u7c7b\u578b&#xff1a;sighup&#xff08;\u91cd\u8f7d\u751f\u6548&#xff09;<\/p>\n<p>\u793a\u4f8b&#xff08;32GB \u5185\u5b58&#xff09;&#xff1a;<\/p>\n<p> effective_cache_size &#061; 24GB<\/p>\n<p>\u6ce8\u610f&#xff1a;\u6b64\u53c2\u6570\u4ec5\u5f71\u54cd\u6267\u884c\u8ba1\u5212\u9009\u62e9&#xff0c;\u4e0d\u5206\u914d\u5b9e\u9645\u5185\u5b58\u3002<\/p>\n<hr \/>\n<h4>2.3 work_mem<\/h4>\n<p>\u4f5c\u7528&#xff1a;\u5355\u4e2a\u64cd\u4f5c&#xff08;\u5982\u6392\u5e8f\u3001\u54c8\u5e0c\u8868\u3001\u4f4d\u56fe\u626b\u63cf&#xff09;\u53ef\u4f7f\u7528\u7684\u6700\u5927\u5185\u5b58\u91cf\u3002 \u9ed8\u8ba4\u503c&#xff1a;4MB \u5efa\u8bae\u503c&#xff1a;<\/p>\n<ul>\n<li>OLTP&#xff1a;4~16MB<\/li>\n<li>OLAP\/\u590d\u6742\u67e5\u8be2&#xff1a;64~256MB&#xff08;\u9700\u8c28\u614e&#xff09;<\/li>\n<\/ul>\n<p>\u8ba1\u7b97\u516c\u5f0f&#xff1a;<\/p>\n<p>\u603b\u5185\u5b58\u6d88\u8017 \u2248 max_connections \u00d7 work_mem \u00d7 \u5e76\u53d1\u590d\u6742\u64cd\u4f5c\u6570<\/p>\n<p>\u793a\u4f8b&#xff08;100 \u8fde\u63a5&#xff0c;OLTP&#xff09;&#xff1a;<\/p>\n<p> work_mem &#061; 8MB<\/p>\n<p>\u6700\u574f\u60c5\u51b5\u5185\u5b58\u5360\u7528&#xff1a;100 \u00d7 8MB &#061; 800MB&#xff08;\u53ef\u63a5\u53d7&#xff09;<\/p>\n<p>\u98ce\u9669&#xff1a;\u8bbe\u5f97\u8fc7\u9ad8\u4f1a\u5bfc\u81f4\u5185\u5b58\u6ea2\u51fa&#xff08;OOM&#xff09;&#xff0c;\u5c24\u5176\u5728\u9ad8\u5e76\u53d1\u4e0b\u3002<\/p>\n<hr \/>\n<h4>2.4 maintenance_work_mem<\/h4>\n<p>\u4f5c\u7528&#xff1a;\u7ef4\u62a4\u64cd\u4f5c&#xff08;VACUUM\u3001CREATE INDEX\u3001ALTER TABLE&#xff09;\u53ef\u7528\u7684\u6700\u5927\u5185\u5b58\u3002 \u9ed8\u8ba4\u503c&#xff1a;64MB \u5efa\u8bae\u503c&#xff1a;1~2GB&#xff08;\u4e0d\u8d85\u8fc7\u7269\u7406\u5185\u5b58\u7684 10%&#xff09; \u7c7b\u578b&#xff1a;sighup<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p> maintenance_work_mem &#061; 2GB<\/p>\n<p>\u4f18\u52bf&#xff1a;\u63d0\u5347\u7d22\u5f15\u521b\u5efa\u3001\u81a8\u80c0\u6e05\u7406\u901f\u5ea6&#xff0c;\u51cf\u5c11\u9501\u6301\u6709\u65f6\u95f4\u3002<\/p>\n<hr \/>\n<h4>2.5 max_connections<\/h4>\n<p>\u4f5c\u7528&#xff1a;\u5141\u8bb8\u7684\u6700\u5927\u5e76\u53d1\u8fde\u63a5\u6570\u3002 \u9ed8\u8ba4\u503c&#xff1a;100 \u5efa\u8bae\u503c&#xff1a;<\/p>\n<ul>\n<li>\u5c0f\u578b\u5e94\u7528&#xff1a;50~100<\/li>\n<li>\u4e2d\u5927\u578b\u5e94\u7528&#xff1a;\u914d\u5408\u8fde\u63a5\u6c60&#xff08;\u5982 PgBouncer&#xff09;&#xff0c;\u8bbe\u4e3a 200~500<\/li>\n<li>\u8d85\u9ad8\u5e76\u53d1&#xff1a;\u4ecd\u5efa\u8bae \u2264 1000&#xff0c;\u907f\u514d\u4e0a\u4e0b\u6587\u5207\u6362\u5f00\u9500<\/li>\n<\/ul>\n<p>\u91cd\u8981\u539f\u5219&#xff1a;<\/p>\n<p>\u4e0d\u8981\u76f4\u63a5\u63d0\u9ad8 max_connections \u6765\u5e94\u5bf9\u9ad8\u5e76\u53d1&#xff0c;\u800c\u5e94\u4f7f\u7528\u8fde\u63a5\u6c60\u3002<\/p>\n<p>\u6bcf\u4e2a\u8fde\u63a5\u6d88\u8017\u7ea6 10MB \u5185\u5b58&#xff08;\u542b work_mem&#xff09;&#xff0c;1000 \u8fde\u63a5\u4ec5\u57fa\u7840\u5f00\u9500\u5c31\u8fbe 10GB\u3002<\/p>\n<hr \/>\n<h4>2.6 checkpoint_completion_target<\/h4>\n<p>\u4f5c\u7528&#xff1a;\u63a7\u5236\u68c0\u67e5\u70b9&#xff08;checkpoint&#xff09;\u6301\u7eed\u65f6\u95f4\u5360 checkpoint_timeout \u7684\u6bd4\u4f8b\u3002 \u9ed8\u8ba4\u503c&#xff1a;0.9&#xff08;\u5373 90%&#xff09; \u5efa\u8bae\u503c&#xff1a;0.9&#xff08;\u4fdd\u6301\u9ed8\u8ba4\u6216\u7565\u9ad8&#xff09; \u7c7b\u578b&#xff1a;sighup<\/p>\n<p> checkpoint_completion_target &#061; 0.9<\/p>\n<p>\u539f\u7406&#xff1a;<\/p>\n<ul>\n<li>\u68c0\u67e5\u70b9\u5c06\u810f\u9875\u5237\u5165\u78c1\u76d8<\/li>\n<li>\u8f83\u957f\u7684\u5b8c\u6210\u65f6\u95f4&#xff08;\u5982 90% of 5min &#061; 4.5min&#xff09;\u53ef\u5e73\u6ed1 I\/O \u8d1f\u8f7d&#xff0c;\u907f\u514d\u201cI\/O \u5c16\u5cf0\u201d<\/li>\n<li>\u5bf9 SSD \u5f71\u54cd\u8f83\u5c0f&#xff0c;\u4f46\u5bf9 HDD \u81f3\u5173\u91cd\u8981<\/li>\n<\/ul>\n<hr \/>\n<h4>2.7 wal_buffers<\/h4>\n<p>\u4f5c\u7528&#xff1a;WAL&#xff08;Write-Ahead Logging&#xff09;\u65e5\u5fd7\u5728\u5185\u5b58\u4e2d\u7684\u7f13\u51b2\u533a\u5927\u5c0f\u3002 \u9ed8\u8ba4\u503c&#xff1a;-1&#xff08;\u81ea\u52a8\u8bbe\u4e3a shared_buffers \u7684 1\/32&#xff0c;\u6700\u5c0f 64kB&#xff0c;\u6700\u5927 16MB&#xff09; \u5efa\u8bae\u503c&#xff1a;\u901a\u5e38\u4fdd\u6301\u9ed8\u8ba4\u5373\u53ef&#xff1b;\u82e5\u9891\u7e41\u5199\u5165&#xff0c;\u53ef\u663e\u5f0f\u8bbe\u4e3a 16MB \u7c7b\u578b&#xff1a;postmaster<\/p>\n<p> wal_buffers &#061; 16MB<\/p>\n<p>\u6ce8\u610f&#xff1a;WAL \u7f13\u51b2\u533a\u6ee1\u6216\u4e8b\u52a1\u63d0\u4ea4\u65f6\u4f1a\u5237\u76d8&#xff0c;\u8fc7\u5927\u6536\u76ca\u6709\u9650\u3002<\/p>\n<hr \/>\n<h4>2.8 random_page_cost \u4e0e seq_page_cost<\/h4>\n<p>\u4f5c\u7528&#xff1a;\u67e5\u8be2\u89c4\u5212\u5668\u4f30\u7b97\u968f\u673a\u8bfb\u4e0e\u987a\u5e8f\u8bfb\u7684\u76f8\u5bf9\u4ee3\u4ef7\u3002 \u9ed8\u8ba4\u503c&#xff1a;<\/p>\n<ul>\n<li>seq_page_cost &#061; 1.0<\/li>\n<li>random_page_cost &#061; 4.0<\/li>\n<\/ul>\n<p>\u5efa\u8bae\u503c&#xff08;\u9488\u5bf9 SSD&#xff09;&#xff1a;<\/p>\n<p>random_page_cost &#061; 1.1<br \/>\nseq_page_cost &#061; 1.0<\/p>\n<p>\u539f\u7406&#xff1a;<\/p>\n<ul>\n<li>HDD \u4e0a\u968f\u673a\u8bfb\u8fdc\u6162\u4e8e\u987a\u5e8f\u8bfb&#xff08;\u6545\u9ed8\u8ba4 4.0&#xff09;<\/li>\n<li>SSD \u968f\u673a\u8bfb\u6027\u80fd\u63a5\u8fd1\u987a\u5e8f\u8bfb&#xff0c;\u5e94\u964d\u4f4e random_page_cost&#xff0c;\u4fc3\u4f7f\u89c4\u5212\u5668\u66f4\u503e\u5411\u7d22\u5f15\u626b\u63cf<\/li>\n<\/ul>\n<hr \/>\n<h4>2.9 log_statement \u4e0e log_min_duration_statement<\/h4>\n<p>\u4f5c\u7528&#xff1a;\u63a7\u5236 SQL \u65e5\u5fd7\u8bb0\u5f55\u7b56\u7565\u3002 \u9ed8\u8ba4\u503c&#xff1a;log_statement &#061; &#039;none&#039;&#xff0c;log_min_duration_statement &#061; -1&#xff08;\u4e0d\u8bb0\u5f55&#xff09;<\/p>\n<p>\u751f\u4ea7\u5efa\u8bae&#xff1a;<\/p>\n<p>log_statement &#061; &#039;none&#039;                  # \u4e0d\u8bb0\u5f55\u6240\u6709\u8bed\u53e5&#xff08;\u6027\u80fd\u5f00\u9500\u5927&#xff09;<br \/>\nlog_min_duration_statement &#061; 1000       # \u8bb0\u5f55\u6267\u884c\u65f6\u95f4 \u22651\u79d2 \u7684\u6162\u67e5\u8be2<br \/>\nlog_directory &#061; &#039;log&#039;<br \/>\nlog_filename &#061; &#039;postgresql-%Y-%m-%d.log&#039;<br \/>\nlogging_collector &#061; on<br \/>\nlog_rotation_age &#061; 1d<\/p>\n<p>\u7528\u9014&#xff1a;<\/p>\n<ul>\n<li>\u6162\u67e5\u8be2\u5206\u6790<\/li>\n<li>\u5b89\u5168\u5ba1\u8ba1&#xff08;\u53ef\u9009 log_statement &#061; &#039;mod&#039; \u8bb0\u5f55 DDL\/DML&#xff09;<\/li>\n<\/ul>\n<hr \/>\n<h4>2.10 listen_addresses<\/h4>\n<p>\u4f5c\u7528&#xff1a;\u6307\u5b9a\u76d1\u542c\u7684\u7f51\u7edc\u63a5\u53e3\u3002 \u9ed8\u8ba4\u503c&#xff1a;localhost&#xff08;\u4ec5\u672c\u5730\u8bbf\u95ee&#xff09;<\/p>\n<p>\u751f\u4ea7\u5efa\u8bae&#xff1a;<\/p>\n<p>listen_addresses &#061; &#039;*&#039;          # \u5141\u8bb8\u6240\u6709 IP \u8fde\u63a5&#xff08;\u914d\u5408\u9632\u706b\u5899&#xff09;<br \/>\n# \u6216<br \/>\nlisten_addresses &#061; &#039;localhost,192.168.1.100&#039;  # \u6307\u5b9a IP<\/p>\n<p>\u5b89\u5168\u8b66\u544a&#xff1a;<\/p>\n<ul>\n<li>\u5f00\u653e\u524d\u52a1\u5fc5\u914d\u7f6e pg_hba.conf \u9650\u5236\u8bbf\u95ee\u6e90<\/li>\n<li>\u4e0d\u8981\u76f4\u63a5\u66b4\u9732\u5230\u516c\u7f51<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e09\u3001\u5176\u4ed6\u91cd\u8981\u53c2\u6570\u5206\u7c7b\u8be6\u89e3<\/h3>\n<h4>3.1 \u5185\u5b58\u76f8\u5173<\/h4>\n<table>\n<tr>\u53c2\u6570\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>huge_pages<\/td>\n<td>\u82e5\u7cfb\u7edf\u542f\u7528\u5927\u9875\u5185\u5b58&#xff0c;\u8bbe\u4e3a on \u53ef\u51cf\u5c11 TLB \u5f00\u9500&#xff08;Linux&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>temp_buffers<\/td>\n<td>\u4e34\u65f6\u8868\u7f13\u5b58&#xff0c;\u9ed8\u8ba4 8MB&#xff0c;\u4e00\u822c\u65e0\u9700\u8c03\u6574<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>3.2 WAL \u4e0e\u53ef\u9760\u6027<\/h4>\n<table>\n<tr>\u53c2\u6570\u5efa\u8bae\u503c\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>wal_level<\/td>\n<td>replica \u6216 logical<\/td>\n<td>\u903b\u8f91\u590d\u5236\u6216\u6d41\u590d\u5236\u5fc5\u9700<\/td>\n<\/tr>\n<tr>\n<td>max_wal_size<\/td>\n<td>2~4GB<\/td>\n<td>\u63a7\u5236 WAL \u6587\u4ef6\u6700\u5927\u603b\u91cf&#xff0c;\u5f71\u54cd\u68c0\u67e5\u70b9\u9891\u7387<\/td>\n<\/tr>\n<tr>\n<td>min_wal_size<\/td>\n<td>1GB<\/td>\n<td>\u9632\u6b62 WAL \u6587\u4ef6\u8fc7\u65e9\u56de\u6536<\/td>\n<\/tr>\n<tr>\n<td>fsync<\/td>\n<td>on&#xff08;\u9ed8\u8ba4&#xff09;<\/td>\n<td>\u7981\u6b62\u5173\u95ed&#xff01;\u5426\u5219\u5d29\u6e83\u53ef\u80fd\u4e22\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td>synchronous_commit<\/td>\n<td>on&#xff08;\u9ed8\u8ba4&#xff09;<\/td>\n<td>\u5982\u53ef\u5bb9\u5fcd\u5c11\u91cf\u4e22\u5931&#xff0c;\u8bbe\u4e3a off \u63d0\u5347\u5199\u6027\u80fd<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>3.3 \u67e5\u8be2\u4e0e\u4f18\u5316\u5668<\/h4>\n<table>\n<tr>\u53c2\u6570\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>default_statistics_target<\/td>\n<td>\u9ed8\u8ba4 100&#xff0c;\u590d\u6742\u67e5\u8be2\u53ef\u589e\u81f3 500~1000&#xff08;\u914d\u5408 ANALYZE&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>from_collapse_limit \/ join_collapse_limit<\/td>\n<td>\u63a7\u5236 JOIN \u91cd\u6392\u6df1\u5ea6&#xff0c;\u9ed8\u8ba4 8&#xff0c;\u590d\u6742\u67e5\u8be2\u53ef\u63d0\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>enable_seqscan \/ enable_indexscan<\/td>\n<td>\u8c03\u8bd5\u7528&#xff0c;\u751f\u4ea7\u52ff\u7981\u7528<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>3.4 \u590d\u5236\u4e0e\u9ad8\u53ef\u7528<\/h4>\n<table>\n<tr>\u53c2\u6570\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>max_replication_slots<\/td>\n<td>\u903b\u8f91\u590d\u5236\u69fd\u6570\u91cf&#xff0c;\u9ed8\u8ba4 10<\/td>\n<\/tr>\n<tr>\n<td>max_wal_senders<\/td>\n<td>WAL \u53d1\u9001\u8fdb\u7a0b\u6570&#xff0c;\u9ed8\u8ba4 10&#xff0c;\u6d41\u590d\u5236\u9700 \u22652<\/td>\n<\/tr>\n<tr>\n<td>hot_standby<\/td>\n<td>\u4ece\u5e93\u5141\u8bb8\u53ea\u8bfb\u67e5\u8be2&#xff0c;\u9ed8\u8ba4 on<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u56db\u3001\u914d\u7f6e\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5<\/h3>\n<h4>4.1 \u4f7f\u7528 ALTER SYSTEM \u7edf\u4e00\u7ba1\u7406<\/h4>\n<p>\u907f\u514d\u76f4\u63a5\u7f16\u8f91 postgresql.conf&#xff0c;\u6539\u7528 SQL \u547d\u4ee4&#xff1a;<\/p>\n<p><span class=\"token keyword\">ALTER<\/span> SYSTEM <span class=\"token keyword\">SET<\/span> shared_buffers <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;8GB&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">ALTER<\/span> SYSTEM <span class=\"token keyword\">SET<\/span> work_mem <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;8MB&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> pg_reload_conf<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">&#8212; \u91cd\u8f7d\u751f\u6548&#xff08;\u82e5\u652f\u6301&#xff09;<\/span><\/p>\n<p>\u53d8\u66f4\u8bb0\u5f55\u5728 postgresql.auto.conf&#xff0c;\u6e05\u6670\u53ef\u8ffd\u6eaf\u3002<\/p>\n<h4>4.2 \u5206\u79bb\u81ea\u5b9a\u4e49\u914d\u7f6e<\/h4>\n<p>\u5728 postgresql.conf \u672b\u5c3e\u52a0\u5165&#xff1a;<\/p>\n<p>include_dir &#039;conf.d&#039;<\/p>\n<p>\u7136\u540e\u5728 conf.d\/ \u76ee\u5f55\u4e0b\u521b\u5efa custom.conf\u3001memory.conf \u7b49&#xff0c;\u4fbf\u4e8e\u7248\u672c\u63a7\u5236\u548c\u6a21\u5757\u5316\u7ba1\u7406\u3002<\/p>\n<h4>4.3 \u76d1\u63a7\u914d\u7f6e\u751f\u6548\u72b6\u6001<\/h4>\n<p><span class=\"token comment\">&#8212; \u67e5\u770b\u5f53\u524d\u8fd0\u884c\u503c<\/span><br \/>\n<span class=\"token keyword\">SHOW<\/span> shared_buffers<span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\">&#8212; \u67e5\u770b\u662f\u5426\u9700\u91cd\u542f<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> name<span class=\"token punctuation\">,<\/span> setting<span class=\"token punctuation\">,<\/span> boot_val<span class=\"token punctuation\">,<\/span> reset_val<span class=\"token punctuation\">,<\/span> source<span class=\"token punctuation\">,<\/span> context<br \/>\n<span class=\"token keyword\">FROM<\/span> pg_settings<br \/>\n<span class=\"token keyword\">WHERE<\/span> name <span class=\"token operator\">IN<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;shared_buffers&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;work_mem&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>4.4 \u5907\u4efd\u539f\u59cb\u914d\u7f6e<\/h4>\n<p>\u4fee\u6539\u524d\u5907\u4efd&#xff1a;<\/p>\n<p><span class=\"token function\">cp<\/span> postgresql.conf postgresql.conf.bak.<span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">date<\/span> &#043;%Y%m%d<span class=\"token variable\">)<\/span><\/span><\/p>\n<hr \/>\n<h3>\u4e94\u3001\u5178\u578b\u573a\u666f\u914d\u7f6e\u6848\u4f8b<\/h3>\n<h4>5.1 OLTP \u751f\u4ea7\u670d\u52a1\u5668&#xff08;32GB RAM, SSD&#xff09;<\/h4>\n<p>shared_buffers &#061; 8GB<br \/>\neffective_cache_size &#061; 24GB<br \/>\nwork_mem &#061; 8MB<br \/>\nmaintenance_work_mem &#061; 2GB<br \/>\nmax_connections &#061; 200<br \/>\ncheckpoint_completion_target &#061; 0.9<br \/>\nrandom_page_cost &#061; 1.1<br \/>\nlog_min_duration_statement &#061; 1000<br \/>\nlogging_collector &#061; on<br \/>\nlog_directory &#061; &#039;log&#039;<br \/>\nlog_filename &#061; &#039;postgresql-%Y-%m-%d.log&#039;<\/p>\n<h4>5.2 \u6570\u636e\u4ed3\u5e93&#xff08;64GB RAM, \u5927\u91cf\u805a\u5408\u67e5\u8be2&#xff09;<\/h4>\n<p>shared_buffers &#061; 16GB<br \/>\neffective_cache_size &#061; 48GB<br \/>\nwork_mem &#061; 128MB          # \u6ce8\u610f\u5e76\u53d1\u63a7\u5236<br \/>\nmaintenance_work_mem &#061; 4GB<br \/>\nmax_connections &#061; 50      # \u4f4e\u5e76\u53d1\u9ad8\u5185\u5b58<br \/>\nrandom_page_cost &#061; 1.1<\/p>\n<hr \/>\n<h3>\u516d\u3001\u5e38\u89c1\u9519\u8bef\u4e0e\u6392\u67e5<\/h3>\n<h4>6.1 \u4fee\u6539\u540e\u672a\u751f\u6548<\/h4>\n<ul>\n<li>\u68c0\u67e5 context \u662f\u5426\u9700\u91cd\u542f<\/li>\n<li>\u67e5\u770b\u65e5\u5fd7\u662f\u5426\u6709\u8bed\u6cd5\u9519\u8bef&#xff1a;FATAL: invalid value for parameter &#034;work_mem&#034;: &#034;8M&#034;<\/li>\n<\/ul>\n<h4>6.2 \u5185\u5b58\u6ea2\u51fa&#xff08;OOM&#xff09;<\/h4>\n<ul>\n<li>\u68c0\u67e5 work_mem \u00d7 max_connections \u662f\u5426\u8d85\u9650<\/li>\n<li>\u4f7f\u7528 top \u6216 htop \u76d1\u63a7\u5185\u5b58<\/li>\n<li>\u542f\u7528 log_temp_files &#061; 0 \u8bb0\u5f55\u4e34\u65f6\u6587\u4ef6\u4f7f\u7528<\/li>\n<\/ul>\n<h4>6.3 \u6027\u80fd\u672a\u63d0\u5347<\/h4>\n<ul>\n<li>\u786e\u8ba4\u662f\u5426\u547d\u4e2d\u7d22\u5f15&#xff08;EXPLAIN ANALYZE&#xff09;<\/li>\n<li>\u68c0\u67e5 random_page_cost \u662f\u5426\u9002\u914d\u5b58\u50a8\u7c7b\u578b<\/li>\n<li>\u786e\u4fdd autovacuum \u6b63\u5e38\u8fd0\u884c&#xff08;\u907f\u514d\u81a8\u80c0&#xff09;<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u76ee\u5f55\u4e00\u3001postgresql.conf \u57fa\u7840\u77e5\u8bc61.1 \u6587\u4ef6\u4f4d\u7f6e1.2 \u914d\u7f6e\u8bed\u6cd51.3 \u914d\u7f6e\u5c42\u7ea7\u4e0e\u4f18\u5148\u7ea71.4 \u4f7f\u7528\u5efa\u8bae\u4e8c\u3001\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684 10 \u4e2a\u5173\u952e\u53c2\u65702.1 shared_buffers2.2 effective_cache_size2.3 work_mem2.4 maintenance_work_mem2.5 max_connections2.6 checkpoint_completion_target2.7 wal_buffers2.8 random_page<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[954,100],"topic":[],"class_list":["post-61659","post","type-post","status-publish","format-standard","hentry","category-server","tag-postgresql","tag-100"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PostgreSQL\u5b9e\u6218\uff1a\u914d\u7f6e\u6587\u4ef6 postgresql.conf \u8be6\u89e3\u53ca\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684\u5173\u952e\u53c2\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/61659.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL\u5b9e\u6218\uff1a\u914d\u7f6e\u6587\u4ef6 postgresql.conf \u8be6\u89e3\u53ca\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684\u5173\u952e\u53c2\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u76ee\u5f55\u4e00\u3001postgresql.conf \u57fa\u7840\u77e5\u8bc61.1 \u6587\u4ef6\u4f4d\u7f6e1.2 \u914d\u7f6e\u8bed\u6cd51.3 \u914d\u7f6e\u5c42\u7ea7\u4e0e\u4f18\u5148\u7ea71.4 \u4f7f\u7528\u5efa\u8bae\u4e8c\u3001\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684 10 \u4e2a\u5173\u952e\u53c2\u65702.1 shared_buffers2.2 effective_cache_size2.3 work_mem2.4 maintenance_work_mem2.5 max_connections2.6 checkpoint_completion_target2.7 wal_buffers2.8 random_page\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/61659.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-18T02:41:44+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/61659.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/61659.html\",\"name\":\"PostgreSQL\u5b9e\u6218\uff1a\u914d\u7f6e\u6587\u4ef6 postgresql.conf \u8be6\u89e3\u53ca\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684\u5173\u952e\u53c2\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-18T02:41:44+00:00\",\"dateModified\":\"2026-01-18T02:41:44+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/61659.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/61659.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/61659.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL\u5b9e\u6218\uff1a\u914d\u7f6e\u6587\u4ef6 postgresql.conf \u8be6\u89e3\u53ca\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684\u5173\u952e\u53c2\u6570\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PostgreSQL\u5b9e\u6218\uff1a\u914d\u7f6e\u6587\u4ef6 postgresql.conf \u8be6\u89e3\u53ca\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684\u5173\u952e\u53c2\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/61659.html","og_locale":"zh_CN","og_type":"article","og_title":"PostgreSQL\u5b9e\u6218\uff1a\u914d\u7f6e\u6587\u4ef6 postgresql.conf \u8be6\u89e3\u53ca\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684\u5173\u952e\u53c2\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u76ee\u5f55\u4e00\u3001postgresql.conf \u57fa\u7840\u77e5\u8bc61.1 \u6587\u4ef6\u4f4d\u7f6e1.2 \u914d\u7f6e\u8bed\u6cd51.3 \u914d\u7f6e\u5c42\u7ea7\u4e0e\u4f18\u5148\u7ea71.4 \u4f7f\u7528\u5efa\u8bae\u4e8c\u3001\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684 10 \u4e2a\u5173\u952e\u53c2\u65702.1 shared_buffers2.2 effective_cache_size2.3 work_mem2.4 maintenance_work_mem2.5 max_connections2.6 checkpoint_completion_target2.7 wal_buffers2.8 random_page","og_url":"https:\/\/www.wsisp.com\/helps\/61659.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-18T02:41:44+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/61659.html","url":"https:\/\/www.wsisp.com\/helps\/61659.html","name":"PostgreSQL\u5b9e\u6218\uff1a\u914d\u7f6e\u6587\u4ef6 postgresql.conf \u8be6\u89e3\u53ca\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684\u5173\u952e\u53c2\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-18T02:41:44+00:00","dateModified":"2026-01-18T02:41:44+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/61659.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/61659.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/61659.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"PostgreSQL\u5b9e\u6218\uff1a\u914d\u7f6e\u6587\u4ef6 postgresql.conf \u8be6\u89e3\u53ca\u5b89\u88c5\u540e\u5fc5\u987b\u8c03\u6574\u7684\u5173\u952e\u53c2\u6570"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/61659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=61659"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/61659\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=61659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=61659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=61659"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=61659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}