{"kind": "tool", "major": "18", "item": {"slug": "pgbench", "name": "pgbench", "name_zh": "", "category": "\u5ba2\u6237\u7aef\u7a0b\u5e8f", "summary": "pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5", "aliases": ["pgbench"], "content_hash": "794c49b6cb766a874af9a951be2ef88296b6db702c5c8f0171c2582a30fd34bb", "versions": {"10": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "10.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "38"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-i --initialize"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u540e\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u5b89\u9759\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf 100000 \u884c\u6253\u5370\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u6b64\u901a\u5e38\u6bcf\u79d2\u8f93\u51fa\u5f88\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u6027\u80fd\u826f\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-C --connect"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-d --debug"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/10/pgbench.html", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\uff0c\u4ee5\u53ca\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-P sec --progress= sec"}}, {"summary": "\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u62a5\u544a\u6bcf\u6761\u547d\u4ee4\u7684\u5e73\u5747\u8bed\u53e5\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89c6\u89d2\u770b\u5230\u7684\u6267\u884c\u65f6\u95f4\uff09\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-r --report-latencies"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "--aggregate-interval= seconds"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "--log-prefix= prefix"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "--progress-timestamp"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "--sampling-rate= rate"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/10/pgbench.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/10/pgbench.html", "description": "Required to invoke initialization mode."}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/10/pgbench.html", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming after initialization.", "signature": "-n --no-vacuum", "source_url": "/docs/10/pgbench.html", "description": "Perform no vacuuming after initialization."}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/10/pgbench.html", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware)."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/10/pgbench.html", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables.", "signature": "--foreign-keys", "source_url": "/docs/10/pgbench.html", "description": "Create foreign key constraints between the standard tables."}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/10/pgbench.html", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/10/pgbench.html", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/10/pgbench.html", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/10/pgbench.html", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/10/pgbench.html", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/10/pgbench.html", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "summary": "Print debugging output.", "signature": "-d --debug", "source_url": "/docs/10/pgbench.html", "description": "Print debugging output."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/10/pgbench.html", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/10/pgbench.html", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/10/pgbench.html", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/10/pgbench.html", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/10/pgbench.html", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped ."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/10/pgbench.html", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. The default is simple query protocol. (See Chapter 52 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/10/pgbench.html", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/10/pgbench.html", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the tps since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time.", "signature": "-P sec --progress= sec", "source_url": "/docs/10/pgbench.html", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the tps since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time."}, {"names": ["-r", "--report-latencies"], "summary": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details.", "signature": "-r --report-latencies", "source_url": "/docs/10/pgbench.html", "description": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/10/pgbench.html", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/10/pgbench.html", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/10/pgbench.html", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/10/pgbench.html", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/10/pgbench.html", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/10/pgbench.html", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/10/pgbench.html", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/10/pgbench.html", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/10/pgbench.html", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/10/pgbench.html", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing tps values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual tps)."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/10/pgbench.html", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/10/pgbench.html", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/10/pgbench.html", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/10/pgbench.html", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/10/pgbench.html", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "label": "10.23", "major": "10", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/10/postgresql-10-A4.pdf", "bytes": 12631706, "pages": 2591, "sha256": "34497ab9efb45c5bdf1bd11b9016b5451354feb462fa029cf74557a5fa5fbbc1", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/10/postgresql-10-US.pdf", "bytes": 12531684, "pages": 2724, "sha256": "429cc7133ddf4f97c560aa466dc9caea4b718721a8321e293357037cf0af4733", "built_at": "2026-09-26"}}, "tree": "10", "index": "index.html", "major": "10", "pages": 1085, "release": "10.23", "source_url": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "revision": "f9301feba91e2e2566038a36b8cee0e4402db68989538f88670fddd20b1f78ea", "evidence_kind": "English manual and source declarations", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "sources": [{"url": "https://pg.center/docs/10/pgbench.html", "file": "pgbench.html", "label": "10.23 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "3644d048ded23a631bc21681cc4869f52b734dc66917f8eaaaeda5664d23355d", "language": "en", "original_url": "/docs/10/pgbench.html"}, {"url": "https://pg.center/docs/10/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "e4330732b6acd6c025a1fbdce45574b23d964de847a1b849ea88b98ab628d2e2", "language": "en", "original_url": "/docs/10/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f <span class=\"application\">pgbench</span> \u7684\u5178\u578b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\ntps = 85.184871 (including connections establishing)\ntps = 85.296346 (excluding connections establishing)\n</pre>\n<p lang=\"zh\">\u524d\u516d\u884c\u62a5\u544a\u4e86\u4e00\u4e9b\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u4e0b\u4e00\u884c\u62a5\u544a\u5df2\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u7684\u4e8b\u52a1\u6570\uff08\u540e\u8005\u5c31\u662f\u5ba2\u6237\u7aef\u6570\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u7684\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u5426\u5219\u8fd9\u4e24\u4e2a\u6570\u5e94\u8be5\u76f8\u7b49\u3002\uff08\u5728 <code class=\"option\">-T</code> \u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u7684\u4e8b\u52a1\u6570\u3002\uff09\u6700\u540e\u4e24\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\uff0c\u5206\u522b\u8ba1\u5165\u548c\u4e0d\u8ba1\u5165\u542f\u52a8\u6570\u636e\u5e93\u4f1a\u8bdd\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\uff1a\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u800c\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521d\u59cb\u5316\u540e\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u5b89\u9759\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf 100000 \u884c\u6253\u5370\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u6b64\u901a\u5e38\u6bcf\u79d2\u8f93\u51fa\u5f88\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u6027\u80fd\u826f\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--foreign-keys</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d</code><br/></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span></dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u9ed8\u8ba4\u4e3a\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u8be6\u89c1<a class=\"xref\" href=\"/docs/10/protocol.html\" title=\"\u7b2c\u00a052\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a052\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\uff0c\u4ee5\u53ca\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-latencies</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u62a5\u544a\u6bcf\u6761\u547d\u4ee4\u7684\u5e73\u5747\u8bed\u53e5\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89c6\u89d2\u770b\u5230\u7684\u6267\u884c\u65f6\u95f4\uff09\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5c06\u6570\u5b57\u4e58\u4ee5\u76f8\u5e94\u500d\u6570\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u901a\u7528\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.2\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u529f\u80fd\u3002\u53d8\u91cf\u53ef\u4ee5\u901a\u8fc7\u524d\u9762\u4ecb\u7ecd\u7684\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u7531<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u8bbe\u7684\u53d8\u91cf\u5916\uff0c\u8fd8\u6709\u4e00\u4e9b\u81ea\u52a8\u9884\u8bbe\u7684\u53d8\u91cf\uff0c\u5217\u4e8e<a class=\"xref\" href=\"/docs/10/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0242.\u00a0\u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0242</a>\u4e2d\u3002\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u7684\u503c\u4f18\u5148\u4e8e\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u8bbe\u7f6e\u53d8\u91cf\u540e\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u4e66\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u5c06\u53d8\u91cf\u503c\u63d2\u5165 SQL \u547d\u4ee4\u3002\u5728\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u4e00\u7ec4\u53d8\u91cf\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0242.\u00a0\u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div>\n<br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b\u6574\u6570\u5e38\u91cf\uff08\u4f8b\u5982<code class=\"literal\">5432</code>\uff09\u3001\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff08\u4f8b\u5982<code class=\"literal\">3.14159</code>\uff09\u3001\u53d8\u91cf\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001\u5177\u6709\u901a\u5e38\u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\u7684\u4e00\u5143\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\uff09\u548c\u4e8c\u5143\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u3001<code class=\"literal\">/</code>\u3001<code class=\"literal\">%</code>\uff09\u3001<a class=\"link\" href=\"/docs/10/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n</pre></dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre></dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre></dd>\n<dt><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre></dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/10/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0243.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0243</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/10/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0243.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u51fd\u6570</th>\n<th lang=\"zh\">\u8fd4\u56de\u7c7b\u578b</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n<th lang=\"zh\">\u793a\u4f8b</th>\n<th lang=\"zh\">\u7ed3\u679c</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">abs(<em class=\"replaceable\"><code>a</code></em>)</code></code></td>\n<td lang=\"zh\">\u4e0e<em class=\"replaceable\"><code>a</code></em>\u76f8\u540c</td>\n<td lang=\"zh\">\u7edd\u5bf9\u503c</td>\n<td><code class=\"literal\">abs(-17)</code></td>\n<td><code class=\"literal\">17</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">debug(<em class=\"replaceable\"><code>a</code></em>)</code></code></td>\n<td lang=\"zh\">\u4e0e<em class=\"replaceable\"><code>a</code></em>\u76f8\u540c</td>\n<td lang=\"zh\">\u5c06<em class=\"replaceable\"><code>a</code></em>\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de<em class=\"replaceable\"><code>a</code></em></td>\n<td><code class=\"literal\">debug(5432.1)</code></td>\n<td><code class=\"literal\">5432.1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">double(<em class=\"replaceable\"><code>i</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u8f6c\u6362\u4e3a double</td>\n<td><code class=\"literal\">double(5432)</code></td>\n<td><code class=\"literal\">5432.0</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">greatest(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>...</code></em> ] )</code></code></td>\n<td lang=\"zh\">\u82e5\u4efb\u4e00<em class=\"replaceable\"><code>a</code></em>\u4e3a double\uff0c\u5219\u4e3a double\uff0c\u5426\u5219\u4e3a integer</td>\n<td lang=\"zh\">\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c</td>\n<td><code class=\"literal\">greatest(5, 4, 3, 2)</code></td>\n<td><code class=\"literal\">5</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">int(<em class=\"replaceable\"><code>x</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\">\u8f6c\u6362\u4e3a int</td>\n<td><code class=\"literal\">int(5.4 + 3.8)</code></td>\n<td><code class=\"literal\">9</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">least(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>...</code></em> ] )</code></code></td>\n<td lang=\"zh\">\u82e5\u4efb\u4e00<em class=\"replaceable\"><code>a</code></em>\u4e3a double\uff0c\u5219\u4e3a double\uff0c\u5426\u5219\u4e3a integer</td>\n<td lang=\"zh\">\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c</td>\n<td><code class=\"literal\">least(5, 4, 3, 2.1)</code></td>\n<td><code class=\"literal\">2.1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">pi()</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u5e38\u91cf PI \u7684\u503c</td>\n<td><code class=\"literal\">pi()</code></td>\n<td><code class=\"literal\">3.14159265358979323846</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u5747\u5300\u5206\u5e03\u7684\u968f\u673a\u6574\u6570</td>\n<td><code class=\"literal\">random(1, 10)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random_exponential(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>, <em class=\"replaceable\"><code>parameter</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u670d\u4ece\u6307\u6570\u5206\u5e03\u7684\u968f\u673a\u6574\u6570\uff0c\u89c1\u4e0b\u6587</td>\n<td><code class=\"literal\">random_exponential(1, 10, 3.0)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random_gaussian(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>, <em class=\"replaceable\"><code>parameter</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u670d\u4ece\u9ad8\u65af\u5206\u5e03\u7684\u968f\u673a\u6574\u6570\uff0c\u89c1\u4e0b\u6587</td>\n<td><code class=\"literal\">random_gaussian(1, 10, 2.5)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">sqrt(<em class=\"replaceable\"><code>x</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u5e73\u65b9\u6839</td>\n<td><code class=\"literal\">sqrt(2.0)</code></td>\n<td><code class=\"literal\">1.414213562</code></td>\n</tr>\n</tbody>\n</table>\n</div>\n</div>\n<br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u5373\u6307\u5b9a\u8303\u56f4\u5185\u6240\u6709\u503c\u88ab\u62bd\u5230\u7684\u6982\u7387\u76f8\u7b49\u3002<code class=\"literal\">random_exponential</code>\u548c<code class=\"literal\">random_gaussian</code>\u51fd\u6570\u9700\u8981\u4e00\u4e2a\u989d\u5916\u7684 double \u53c2\u6570\uff0c\u7528\u6765\u51b3\u5b9a\u5206\u5e03\u7684\u5177\u4f53\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p>f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))</p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p>f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)</p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002\u51fa\u4e8e Box-Muller \u53d8\u6362\u6027\u80fd\u65b9\u9762\u7684\u8003\u8651\uff0cparameter \u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.5\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u683c\u5f0f\u5982\u4e0b\uff1a</p>\n<pre class=\"synopsis\"><em class=\"replaceable\"><code>client_id</code></em> <em class=\"replaceable\"><code>transaction_no</code></em> <em class=\"replaceable\"><code>time</code></em> <em class=\"replaceable\"><code>script_no</code></em> <em class=\"replaceable\"><code>time_epoch</code></em> <em class=\"replaceable\"><code>time_us</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>schedule_lag</code></em> </span>]\n</pre>\n<p lang=\"zh\">\u5176\u4e2d\uff0c<em class=\"replaceable\"><code>client_id</code></em> \u8868\u793a\u8fd0\u884c\u8be5\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd\uff0c<em class=\"replaceable\"><code>transaction_no</code></em> \u8bb0\u5f55\u8be5\u4f1a\u8bdd\u5df2\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\uff0c<em class=\"replaceable\"><code>time</code></em> \u662f\u4e8b\u52a1\u7ecf\u8fc7\u7684\u603b\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff0c<em class=\"replaceable\"><code>script_no</code></em> \u6807\u8bc6\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5728\u901a\u8fc7 <code class=\"option\">-f</code> \u6216 <code class=\"option\">-b</code> \u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09\uff0c\u800c <em class=\"replaceable\"><code>time_epoch</code></em>/<em class=\"replaceable\"><code>time_us</code></em> \u5206\u522b\u662f Unix \u7eaa\u5143\u65f6\u95f4\u6233\u548c\u4ee5\u5fae\u79d2\u8ba1\u7684\u504f\u79fb\u91cf\uff08\u9002\u5408\u7528\u6765\u751f\u6210\u5e26\u5c0f\u6570\u79d2\u7684 ISO 8601 \u65f6\u95f4\u6233\uff09\uff0c\u8868\u793a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002<em class=\"replaceable\"><code>schedule_lag</code></em> \u5b57\u6bb5\u662f\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\u3002\u5b83\u4ec5\u5728\u4f7f\u7528 <code class=\"option\">--rate</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5982\u679c\u540c\u65f6\u4f7f\u7528 <code class=\"option\">--rate</code> \u548c <code class=\"option\">--latency-limit</code>\uff0c\u5219\u88ab\u8df3\u8fc7\u4e8b\u52a1\u7684 <em class=\"replaceable\"><code>time</code></em> \u5c06\u62a5\u544a\u4e3a <code class=\"literal\">skipped</code>\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.6\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--aggregate-interval</code> \u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u91c7\u7528\u53e6\u4e00\u79cd\u683c\u5f0f\uff1a</p>\n<pre class=\"synopsis\"><em class=\"replaceable\"><code>interval_start</code></em> <em class=\"replaceable\"><code>num_transactions</code></em> <em class=\"replaceable\"><code>sum_latency</code></em> <em class=\"replaceable\"><code>sum_latency_2</code></em> <em class=\"replaceable\"><code>min_latency</code></em> <em class=\"replaceable\"><code>max_latency</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>sum_lag</code></em> <em class=\"replaceable\"><code>sum_lag_2</code></em> <em class=\"replaceable\"><code>min_lag</code></em> <em class=\"replaceable\"><code>max_lag</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>skipped</code></em> </span>] </span>]\n</pre>\n<p lang=\"zh\">\u5176\u4e2d\uff0c<em class=\"replaceable\"><code>interval_start</code></em> \u662f\u65f6\u95f4\u533a\u95f4\u7684\u5f00\u59cb\u65f6\u95f4\uff08\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a\uff09\uff0c<em class=\"replaceable\"><code>num_transactions</code></em> \u662f\u533a\u95f4\u5185\u7684\u4e8b\u52a1\u6570\uff0c<em class=\"replaceable\"><code>sum_latency</code></em> \u662f\u533a\u95f4\u5185\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c\uff0c<em class=\"replaceable\"><code>sum_latency_2</code></em> \u662f\u533a\u95f4\u5185\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff0c<em class=\"replaceable\"><code>min_latency</code></em> \u662f\u533a\u95f4\u5185\u7684\u6700\u5c0f\u5ef6\u8fdf\uff0c\u800c <em class=\"replaceable\"><code>max_latency</code></em> \u662f\u533a\u95f4\u5185\u7684\u6700\u5927\u5ef6\u8fdf\u3002\u63a5\u4e0b\u6765\u7684\u5b57\u6bb5 <em class=\"replaceable\"><code>sum_lag</code></em>\u3001<em class=\"replaceable\"><code>sum_lag_2</code></em>\u3001<em class=\"replaceable\"><code>min_lag</code></em> \u548c <em class=\"replaceable\"><code>max_lag</code></em> \u4ec5\u5728\u4f7f\u7528 <code class=\"option\">--rate</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5b83\u4eec\u63d0\u4f9b\u5404\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u7edf\u8ba1\uff0c\u5373\u5404\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\u3002\u6700\u540e\u4e00\u4e2a\u5b57\u6bb5 <em class=\"replaceable\"><code>skipped</code></em> \u4ec5\u5728\u8fd8\u4f7f\u7528 <code class=\"option\">--latency-limit</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5b83\u8bb0\u5f55\u56e0\u5f00\u59cb\u65f6\u95f4\u8fc7\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\u3002\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8ba1\u5165\u5176\u63d0\u4ea4\u65f6\u6240\u5728\u7684\u65f6\u95f4\u533a\u95f4\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e9b\u8f93\u51fa\u793a\u4f8b\uff1a</p>\n<pre class=\"screen\">1345828501 5601 1542744 483552416 61 2573\n1345828503 7884 1979812 565806736 60 1479\n1345828505 7208 1979422 567277552 59 1391\n1345828507 7685 1980268 569784714 60 1398\n1345828509 7073 1979779 573489941 236 1411\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.7\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u5ef6\u8fdf</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\u65f6\uff0c<span class=\"application\">pgbench</span>\u4f1a\u6536\u96c6\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u6240\u7ecf\u8fc7\u7684\u4e8b\u52a1\u65f6\u95f4\u3002\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u5b83\u4f1a\u62a5\u544a\u8fd9\u4e9b\u503c\u7684\u5e73\u5747\u503c\uff0c\u79f0\u4e3a\u6bcf\u6761\u8bed\u53e5\u7684\u5ef6\u8fdf\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u4e0e\u4e0b\u9762\u7c7b\u4f3c\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nlatency average = 15.844 ms\nlatency stddev = 2.715 ms\ntps = 618.764555 (including connections establishing)\ntps = 622.977698 (excluding connections establishing)\nscript statistics:\n - statement latencies in milliseconds:\n        0.002  \\set aid random(1, 100000 * :scale)\n        0.005  \\set bid random(1, 1 * :scale)\n        0.002  \\set tid random(1, 10 * :scale)\n        0.001  \\set delta random(-5000, 5000)\n        0.326  BEGIN;\n        0.603  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n        0.454  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n        5.528  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n        7.335  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n        0.371  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n        1.212  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u5e73\u5747\u503c\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.8\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.9\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/10/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.8.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/10/pgbench.html", "method": "same-major semantic node", "sha256": "34279e0bfea61d306e026ddf61826639acc5e60e596e5747c48562c68feec443", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/div[1]/h3[0]", "#PGBENCH/div[6]/div[1]/h3[0]/span[1]", "#PGBENCH/div[6]/div[1]/p[1]", "#PGBENCH/div[6]/div[1]/p[2]", "#PGBENCH/div[6]/div[1]/p[4]", "#PGBENCH/div[6]/div[1]/p[5]", "#PGBENCH/div[6]/div[2]/div[3]/h3[0]", "#PGBENCH/div[6]/div[2]/div[3]/p[1]", "#PGBENCH/div[6]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[6]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[6]/div[2]/div[5]/p[0]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[3]/p[0]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[3]/p[1]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[6]/div[2]/h3[0]", "#PGBENCH/div[6]/div[2]/p[1]", "#PGBENCH/div[6]/div[2]/p[2]", "#PGBENCH/div[6]/div[2]/p[4]", "#PGBENCH/div[6]/div[2]/p[7]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]/td[2]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]/td[2]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]/td[2]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]/td[2]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]/td[2]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]/td[2]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]/td[2]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]/td[4]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]/td[2]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]/td[2]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[0]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[3]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[4]", "#PGBENCH/div[6]/div[3]/div[2]/p[0]", "#PGBENCH/div[6]/div[3]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[6]/div[3]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[6]/div[3]/h3[0]", "#PGBENCH/div[6]/div[3]/p[1]", "#PGBENCH/div[6]/div[3]/p[4]", "#PGBENCH/div[6]/div[3]/p[6]", "#PGBENCH/div[6]/div[3]/p[8]", "#PGBENCH/div[6]/div[4]/h3[0]", "#PGBENCH/div[6]/div[4]/p[10]", "#PGBENCH/div[6]/div[4]/p[2]", "#PGBENCH/div[6]/div[4]/p[4]", "#PGBENCH/div[6]/div[4]/p[5]", "#PGBENCH/div[6]/div[4]/p[7]", "#PGBENCH/div[6]/div[4]/p[9]", "#PGBENCH/div[6]/div[5]/h3[0]", "#PGBENCH/div[6]/div[5]/p[1]", "#PGBENCH/div[6]/div[5]/p[3]", "#PGBENCH/div[6]/div[5]/p[4]", "#PGBENCH/div[6]/div[5]/p[6]", "#PGBENCH/div[6]/div[6]/h3[0]", "#PGBENCH/div[6]/div[6]/p[1]", "#PGBENCH/div[6]/div[6]/p[2]", "#PGBENCH/div[6]/div[6]/p[4]", "#PGBENCH/div[6]/div[6]/p[5]", "#PGBENCH/div[6]/div[7]/h3[0]", "#PGBENCH/div[6]/div[7]/p[1]", "#PGBENCH/div[6]/div[7]/p[2]", "#PGBENCH/div[6]/div[7]/p[4]", "#PGBENCH/div[6]/div[7]/p[5]", "#PGBENCH/div[6]/div[8]/h3[0]", "#PGBENCH/div[6]/div[8]/p[1]", "#PGBENCH/div[6]/h2[0]"]}], "language": "zh", "original_text": {"/versions/10/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/10/facts/0/label": "Documented executable", "/versions/10/facts/0/value": "pgbench", "/versions/10/facts/1/label": "Executable version", "/versions/10/facts/2/label": "Reference inventory", "/versions/10/facts/2/value": "Client applications", "/versions/10/facts/3/label": "Option definition groups", "/versions/10/tables/0/title": "Documented options", "/versions/10/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/10/tables/0/rows/1/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/10/tables/0/rows/2/summary": "Perform no vacuuming after initialization.", "/versions/10/tables/0/rows/3/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/10/tables/0/rows/4/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/10/tables/0/rows/5/summary": "Create foreign key constraints between the standard tables.", "/versions/10/tables/0/rows/6/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/10/tables/0/rows/7/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/10/tables/0/rows/8/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/10/tables/0/rows/9/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/10/tables/0/columns/0/label": "Option and arguments", "/versions/10/tables/0/columns/1/label": "Description", "/versions/10/tables/0/rows/10/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/10/tables/0/rows/11/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/10/tables/0/rows/12/summary": "Print debugging output.", "/versions/10/tables/0/rows/13/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/10/tables/0/rows/14/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/10/tables/0/rows/15/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/10/tables/0/rows/16/summary": "Write information about each transaction to a log file. See below for details.", "/versions/10/tables/0/rows/17/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/10/tables/0/rows/18/summary": "Protocol to use for submitting queries to the server:", "/versions/10/tables/0/rows/19/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/10/tables/0/rows/20/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/10/tables/0/rows/21/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the tps since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time.", "/versions/10/tables/0/rows/22/summary": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details.", "/versions/10/tables/0/rows/23/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/10/tables/0/rows/24/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/10/tables/0/rows/25/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/10/tables/0/rows/26/summary": "Number of transactions each client runs. Default is 10.", "/versions/10/tables/0/rows/27/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/10/tables/0/rows/28/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/10/tables/0/rows/29/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/10/tables/0/rows/30/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/10/tables/0/rows/31/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/10/tables/0/rows/32/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/10/tables/0/rows/33/summary": "The database server's host name", "/versions/10/tables/0/rows/34/summary": "The database server's port number", "/versions/10/tables/0/rows/35/summary": "The user name to connect as", "/versions/10/tables/0/rows/36/summary": "Print the pgbench version and exit.", "/versions/10/tables/0/rows/37/summary": "Show help about pgbench command line arguments, and exit."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "08712359c3cd0e6b9ec0717e280f47cc74faec4a1864f55c1cc7ceeeb166cf61"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming after initialization."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware)."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables."}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "signature": "-d --debug", "description": "Print debugging output."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped ."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. The default is simple query protocol. (See Chapter 52 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the tps since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time."}, {"names": ["-r", "--report-latencies"], "signature": "-r --report-latencies", "description": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing tps values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual tps)."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": []}, "comparison_hash": "95a083376423473d9305181494573fcf638b8b67ee6dc99dcac9d52fac8ff51f", "manual_language": "zh"}, "11": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "11.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "40"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u9009\u5b9a\u7684\u5e38\u89c4\u521d\u59cb\u5316\u6b65\u9aa4\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/11/pgbench.html", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/11/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u5b89\u9759\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf 100000 \u884c\u6253\u5370\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u6b64\u901a\u5e38\u6bcf\u79d2\u8f93\u51fa\u5f88\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u6027\u80fd\u826f\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/11/pgbench.html", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-C --connect"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-d --debug"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/11/pgbench.html", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\uff0c\u4ee5\u53ca\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-P sec --progress= sec"}}, {"summary": "\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u62a5\u544a\u6bcf\u6761\u547d\u4ee4\u7684\u5e73\u5747\u8bed\u53e5\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89c6\u89d2\u770b\u5230\u7684\u6267\u884c\u65f6\u95f4\uff09\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-r --report-latencies"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "--aggregate-interval= seconds"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "--log-prefix= prefix"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 SEED \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 SEED \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "--random-seed= SEED"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "--sampling-rate= rate"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/11/pgbench.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/11/pgbench.html", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/11/pgbench.html", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g (Generate data) Generate data and load it into the standard tables, replacing any data already present. v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/11/pgbench.html", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/11/pgbench.html", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/11/pgbench.html", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware)."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/11/pgbench.html", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/11/pgbench.html", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/11/pgbench.html", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/11/pgbench.html", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/11/pgbench.html", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/11/pgbench.html", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/11/pgbench.html", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/11/pgbench.html", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "summary": "Print debugging output.", "signature": "-d --debug", "source_url": "/docs/11/pgbench.html", "description": "Print debugging output."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/11/pgbench.html", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/11/pgbench.html", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/11/pgbench.html", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/11/pgbench.html", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/11/pgbench.html", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped ."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/11/pgbench.html", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. The default is simple query protocol. (See Chapter 53 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/11/pgbench.html", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/11/pgbench.html", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time.", "signature": "-P sec --progress= sec", "source_url": "/docs/11/pgbench.html", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time."}, {"names": ["-r", "--report-latencies"], "summary": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details.", "signature": "-r --report-latencies", "source_url": "/docs/11/pgbench.html", "description": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/11/pgbench.html", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/11/pgbench.html", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/11/pgbench.html", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/11/pgbench.html", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/11/pgbench.html", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/11/pgbench.html", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/11/pgbench.html", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/11/pgbench.html", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/11/pgbench.html", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for SEED may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for SEED may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= SEED", "source_url": "/docs/11/pgbench.html", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for SEED may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for SEED may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/11/pgbench.html", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/11/pgbench.html", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/11/pgbench.html", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/11/pgbench.html", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/11/pgbench.html", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/11/pgbench.html", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "label": "11.22", "major": "11", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/11/postgresql-11-A4.pdf", "bytes": 13057499, "pages": 2732, "sha256": "41d75855e610d0d9b8802b87dc5b080bef8d7e91c7cf69401fbf8d3cf801b4b5", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/11/postgresql-11-US.pdf", "bytes": 12961189, "pages": 2883, "sha256": "6a8899ef36935a5b7ed2b436207564a567a4ef1eb1c2200195876b8de4d4fa30", "built_at": "2026-09-26"}}, "tree": "11", "index": "index.html", "major": "11", "pages": 1125, "release": "11.22", "source_url": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "revision": "53315ddaf3b3f9e6669fd1edc096bbb2cd4a65ea3e836c89e542b43af9ba3a7f", "evidence_kind": "English manual and source declarations", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "sources": [{"url": "https://pg.center/docs/11/pgbench.html", "file": "pgbench.html", "label": "11.22 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "4835f5ba22a1260485c8be8de5604c32009d6713d28514a317cb806b582457bd", "language": "en", "original_url": "/docs/11/pgbench.html"}, {"url": "https://pg.center/docs/11/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "3a30e696058b118a55cc42892c39671d9bae86f77e1024d5ebcc4688ad9ab4c3", "language": "en", "original_url": "/docs/11/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f <span class=\"application\">pgbench</span> \u7684\u5178\u578b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\ntps = 85.184871 (including connections establishing)\ntps = 85.296346 (excluding connections establishing)\n</pre>\n<p lang=\"zh\">\u524d\u516d\u884c\u62a5\u544a\u4e86\u4e00\u4e9b\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u4e0b\u4e00\u884c\u62a5\u544a\u5df2\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u7684\u4e8b\u52a1\u6570\uff08\u540e\u8005\u5c31\u662f\u5ba2\u6237\u7aef\u6570\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u7684\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u5426\u5219\u8fd9\u4e24\u4e2a\u6570\u5e94\u8be5\u76f8\u7b49\u3002\uff08\u5728 <code class=\"option\">-T</code> \u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u7684\u4e8b\u52a1\u6570\u3002\uff09\u6700\u540e\u4e24\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\uff0c\u5206\u522b\u8ba1\u5165\u548c\u4e0d\u8ba1\u5165\u542f\u52a8\u6570\u636e\u5e93\u4f1a\u8bdd\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u9009\u5b9a\u7684\u5e38\u89c4\u521d\u59cb\u5316\u6b65\u9aa4\u3002<em class=\"replaceable\"><code>init_steps</code></em> \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\uff08\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u5b89\u9759\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf 100000 \u884c\u6253\u5370\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u6b64\u901a\u5e38\u6bcf\u79d2\u8f93\u51fa\u5f88\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u6027\u80fd\u826f\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--foreign-keys</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d</code><br/></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span></dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u9ed8\u8ba4\u4e3a\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u8be6\u89c1<a class=\"xref\" href=\"/docs/11/protocol.html\" title=\"\u7b2c\u00a053\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a053\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\uff0c\u4ee5\u53ca\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-latencies</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u62a5\u544a\u6bcf\u6761\u547d\u4ee4\u7684\u5e73\u5747\u8bed\u53e5\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89c6\u89d2\u770b\u5230\u7684\u6267\u884c\u65f6\u95f4\uff09\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>SEED</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>SEED</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>SEED</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u901a\u7528\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.2\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u529f\u80fd\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u53d8\u91cf\u53ef\u4ee5\u901a\u8fc7\u524d\u9762\u4ecb\u7ecd\u7684\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u7531<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u8bbe\u7684\u53d8\u91cf\u5916\uff0c\u8fd8\u6709\u4e00\u4e9b\u81ea\u52a8\u9884\u8bbe\u7684\u53d8\u91cf\uff0c\u5217\u4e8e<a class=\"xref\" href=\"/docs/11/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0242.\u00a0\u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0242</a>\u4e2d\u3002\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u7684\u503c\u4f18\u5148\u4e8e\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u8bbe\u7f6e\u53d8\u91cf\u540e\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u4e66\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u5c06\u53d8\u91cf\u503c\u63d2\u5165 SQL \u547d\u4ee4\u3002\u5728\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u4e00\u7ec4\u53d8\u91cf\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0242.\u00a0\u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/11/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/11/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/11/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/11/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.17.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/11/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0243.\u00a0\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u6392\u5217\u7684 pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0243</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/11/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0243.\u00a0\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u6392\u5217\u7684 pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u64cd\u4f5c\u7b26</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n<th lang=\"zh\">\u793a\u4f8b</th>\n<th lang=\"zh\">\u7ed3\u679c</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">OR</code></td>\n<td lang=\"zh\">\u903b\u8f91\u6216</td>\n<td><code class=\"literal\">5 or 0</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">AND</code></td>\n<td lang=\"zh\">\u903b\u8f91\u4e0e</td>\n<td><code class=\"literal\">3 and 0</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">NOT</code></td>\n<td lang=\"zh\">\u903b\u8f91\u975e</td>\n<td><code class=\"literal\">not false</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code></td>\n<td lang=\"zh\">\u503c\u6d4b\u8bd5</td>\n<td><code class=\"literal\">1 is null</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">ISNULL|NOTNULL</code></td>\n<td lang=\"zh\">\u7a7a\u503c\u6d4b\u8bd5</td>\n<td><code class=\"literal\">1 notnull</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">=</code></td>\n<td lang=\"zh\">\u7b49\u4e8e</td>\n<td><code class=\"literal\">5 = 4</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&lt;&gt;</code></td>\n<td lang=\"zh\">\u4e0d\u7b49\u4e8e</td>\n<td><code class=\"literal\">5 &lt;&gt; 4</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">!=</code></td>\n<td lang=\"zh\">\u4e0d\u7b49\u4e8e</td>\n<td><code class=\"literal\">5 != 5</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&lt;</code></td>\n<td lang=\"zh\">\u5c0f\u4e8e</td>\n<td><code class=\"literal\">5 &lt; 4</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&lt;=</code></td>\n<td lang=\"zh\">\u5c0f\u4e8e\u6216\u7b49\u4e8e</td>\n<td><code class=\"literal\">5 &lt;= 4</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&gt;</code></td>\n<td lang=\"zh\">\u5927\u4e8e</td>\n<td><code class=\"literal\">5 &gt; 4</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&gt;=</code></td>\n<td lang=\"zh\">\u5927\u4e8e\u6216\u7b49\u4e8e</td>\n<td><code class=\"literal\">5 &gt;= 4</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">|</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u6216</td>\n<td><code class=\"literal\">1 | 2</code></td>\n<td><code class=\"literal\">3</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">#</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u5f02\u6216</td>\n<td><code class=\"literal\">1 # 3</code></td>\n<td><code class=\"literal\">2</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&amp;</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u4e0e</td>\n<td><code class=\"literal\">1 &amp; 3</code></td>\n<td><code class=\"literal\">1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">~</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u975e</td>\n<td><code class=\"literal\">~ 1</code></td>\n<td><code class=\"literal\">-2</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&lt;&lt;</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u5de6\u79fb</td>\n<td><code class=\"literal\">1 &lt;&lt; 2</code></td>\n<td><code class=\"literal\">4</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&gt;&gt;</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u53f3\u79fb</td>\n<td><code class=\"literal\">8 &gt;&gt; 2</code></td>\n<td><code class=\"literal\">2</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">+</code></td>\n<td lang=\"zh\">\u52a0\u6cd5</td>\n<td><code class=\"literal\">5 + 4</code></td>\n<td><code class=\"literal\">9</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">-</code></td>\n<td lang=\"zh\">\u51cf\u6cd5</td>\n<td><code class=\"literal\">3 - 2.0</code></td>\n<td><code class=\"literal\">1.0</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">*</code></td>\n<td lang=\"zh\">\u4e58\u6cd5</td>\n<td><code class=\"literal\">5 * 4</code></td>\n<td><code class=\"literal\">20</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">/</code></td>\n<td lang=\"zh\">\u9664\u6cd5\uff08\u6574\u6570\u4f1a\u622a\u65ad\u7ed3\u679c\uff09</td>\n<td><code class=\"literal\">5 / 3</code></td>\n<td><code class=\"literal\">1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">%</code></td>\n<td lang=\"zh\">\u53d6\u6a21</td>\n<td><code class=\"literal\">3 % 2</code></td>\n<td><code class=\"literal\">1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">-</code></td>\n<td lang=\"zh\">\u53d6\u76f8\u53cd\u6570</td>\n<td><code class=\"literal\">- 2.0</code></td>\n<td><code class=\"literal\">-2.0</code></td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/11/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0244.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0244</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/11/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0244.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u51fd\u6570</th>\n<th lang=\"zh\">\u8fd4\u56de\u7c7b\u578b</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n<th lang=\"zh\">\u793a\u4f8b</th>\n<th lang=\"zh\">\u7ed3\u679c</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">abs(<em class=\"replaceable\"><code>a</code></em>)</code></code></td>\n<td lang=\"zh\">\u4e0e<em class=\"replaceable\"><code>a</code></em>\u76f8\u540c</td>\n<td lang=\"zh\">\u7edd\u5bf9\u503c</td>\n<td><code class=\"literal\">abs(-17)</code></td>\n<td><code class=\"literal\">17</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">debug(<em class=\"replaceable\"><code>a</code></em>)</code></code></td>\n<td lang=\"zh\">\u4e0e<em class=\"replaceable\"><code>a</code></em>\u76f8\u540c</td>\n<td lang=\"zh\">\u5c06<em class=\"replaceable\"><code>a</code></em>\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de<em class=\"replaceable\"><code>a</code></em></td>\n<td><code class=\"literal\">debug(5432.1)</code></td>\n<td><code class=\"literal\">5432.1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">double(<em class=\"replaceable\"><code>i</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u8f6c\u6362\u4e3a double</td>\n<td><code class=\"literal\">double(5432)</code></td>\n<td><code class=\"literal\">5432.0</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">exp(<em class=\"replaceable\"><code>x</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u6307\u6570\u51fd\u6570</td>\n<td><code class=\"literal\">exp(1.0)</code></td>\n<td><code class=\"literal\">2.718281828459045</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">greatest(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>...</code></em> ] )</code></code></td>\n<td lang=\"zh\">\u82e5\u4efb\u4e00<em class=\"replaceable\"><code>a</code></em>\u4e3a double\uff0c\u5219\u4e3a double\uff0c\u5426\u5219\u4e3a integer</td>\n<td lang=\"zh\">\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c</td>\n<td><code class=\"literal\">greatest(5, 4, 3, 2)</code></td>\n<td><code class=\"literal\">5</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">hash(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>seed</code></em> ] )</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">hash_murmur2()</code>\u7684\u522b\u540d</td>\n<td><code class=\"literal\">hash(10, 5432)</code></td>\n<td><code class=\"literal\">-5817877081768721676</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">hash_fnv1a(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>seed</code></em> ] )</code></code></td>\n<td>integer</td>\n<td lang=\"zh\">FNV-1a \u54c8\u5e0c</td>\n<td><code class=\"literal\">hash_fnv1a(10, 5432)</code></td>\n<td><code class=\"literal\">-7793829335365542153</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">hash_murmur2(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>seed</code></em> ] )</code></code></td>\n<td>integer</td>\n<td lang=\"zh\">MurmurHash2 \u54c8\u5e0c</td>\n<td><code class=\"literal\">hash_murmur2(10, 5432)</code></td>\n<td><code class=\"literal\">-5817877081768721676</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">int(<em class=\"replaceable\"><code>x</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\">\u8f6c\u6362\u4e3a int</td>\n<td><code class=\"literal\">int(5.4 + 3.8)</code></td>\n<td><code class=\"literal\">9</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">least(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>...</code></em> ] )</code></code></td>\n<td lang=\"zh\">\u82e5\u4efb\u4e00<em class=\"replaceable\"><code>a</code></em>\u4e3a double\uff0c\u5219\u4e3a double\uff0c\u5426\u5219\u4e3a integer</td>\n<td lang=\"zh\">\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c</td>\n<td><code class=\"literal\">least(5, 4, 3, 2.1)</code></td>\n<td><code class=\"literal\">2.1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">ln(<em class=\"replaceable\"><code>x</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u81ea\u7136\u5bf9\u6570</td>\n<td><code class=\"literal\">ln(2.718281828459045)</code></td>\n<td><code class=\"literal\">1.0</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">mod(<em class=\"replaceable\"><code>i</code></em>, <em class=\"replaceable\"><code>j</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\">\u53d6\u6a21</td>\n<td><code class=\"literal\">mod(54, 32)</code></td>\n<td><code class=\"literal\">22</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">pi()</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u5e38\u91cf PI \u7684\u503c</td>\n<td><code class=\"literal\">pi()</code></td>\n<td><code class=\"literal\">3.14159265358979323846</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">pow(<em class=\"replaceable\"><code>x</code></em>, <em class=\"replaceable\"><code>y</code></em>)</code>, <code class=\"function\">power(<em class=\"replaceable\"><code>x</code></em>, <em class=\"replaceable\"><code>y</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u4e58\u65b9</td>\n<td><code class=\"literal\">pow(2.0, 10)</code>, <code class=\"literal\">power(2.0, 10)</code></td>\n<td><code class=\"literal\">1024.0</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u5747\u5300\u5206\u5e03\u7684\u968f\u673a\u6574\u6570</td>\n<td><code class=\"literal\">random(1, 10)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random_exponential(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>, <em class=\"replaceable\"><code>parameter</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u670d\u4ece\u6307\u6570\u5206\u5e03\u7684\u968f\u673a\u6574\u6570\uff0c\u89c1\u4e0b\u6587</td>\n<td><code class=\"literal\">random_exponential(1, 10, 3.0)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random_gaussian(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>, <em class=\"replaceable\"><code>parameter</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u670d\u4ece\u9ad8\u65af\u5206\u5e03\u7684\u968f\u673a\u6574\u6570\uff0c\u89c1\u4e0b\u6587</td>\n<td><code class=\"literal\">random_gaussian(1, 10, 2.5)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random_zipfian(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>, <em class=\"replaceable\"><code>parameter</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u670d\u4ece Zipfian \u5206\u5e03\u7684\u968f\u673a\u6574\u6570\uff0c\u89c1\u4e0b\u6587</td>\n<td><code class=\"literal\">random_zipfian(1, 10, 1.5)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">sqrt(<em class=\"replaceable\"><code>x</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u5e73\u65b9\u6839</td>\n<td><code class=\"literal\">sqrt(2.0)</code></td>\n<td><code class=\"literal\">1.414213562</code></td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002\u51fa\u4e8e Box-Muller \u53d8\u6362\u6027\u80fd\u65b9\u9762\u7684\u8003\u8651\uff0cparameter \u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u8fd1\u4f3c\u7684\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u4f4d\u4e8e (0, 1) \u65f6\uff0c\u4f7f\u7528\u7684\u8fd1\u4f3c\u7b97\u6cd5\u6765\u81ea Jim Gray \u7b49\u4eba\u7684\u300aQuickly Generating Billion-Record Synthetic Databases\u300b\uff0cSIGMOD 1994\u3002parameter \u4f4d\u4e8e (1, 1000) \u65f6\uff0c\u4f7f\u7528\u62d2\u7edd\u91c7\u6837\u6cd5\uff0c\u4f9d\u636e\u4e3a Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002parameter \u4e3a 1.0 \u65f6\uff0c\u6b64\u5206\u5e03\u6ca1\u6709\u5b9a\u4e49\u3002\u5f53 parameter \u63a5\u8fd1\u4e14\u5927\u4e8e 1.0\uff0c\u540c\u65f6\u53d6\u503c\u8303\u56f4\u8f83\u5c0f\u65f6\uff0c\u6b64\u51fd\u6570\u7684\u6027\u80fd\u8f83\u5dee\u3002</p>\n<p lang=\"zh\">parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8f93\u51fa\u5206\u5e03\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570 <code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code> \u548c <code class=\"literal\">hash_fnv1a</code> \u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u672a\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f7f\u7528 <code class=\"literal\">:default_seed</code> \u7684\u503c\uff0c\u8be5\u503c\u968f\u673a\u521d\u59cb\u5316\uff0c\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c <code class=\"literal\">-D</code> \u9009\u9879\u8bbe\u7f6e\u3002Hash \u51fd\u6570\u53ef\u4ee5\u7528\u6765\u6253\u6563\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f8b\u5982 <code class=\"literal\">random_zipfian</code> \u6216 <code class=\"literal\">random_exponential</code>\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e2d\u53ef\u80fd\u51fa\u73b0\u7684\u5178\u578b\u771f\u5b9e\u5de5\u4f5c\u8d1f\u8f7d\uff0c\u5176\u4e2d\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u4e86\u8fc7\u591a\u7684\u8d1f\u8f7d\uff1a</p>\n<pre class=\"programlisting\">\\set r random_zipfian(0, 100000000, 1.07)\n\\set k abs(hash(:r)) % 1000000\n</pre>\n<p lang=\"zh\">\u67d0\u4e9b\u60c5\u51b5\u4e0b\u9700\u8981\u51e0\u4e2a\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u9690\u5f0f\u79cd\u5b50\u53c2\u6570\u5c31\u80fd\u6d3e\u4e0a\u7528\u573a\uff1a</p>\n<pre class=\"programlisting\">\\set k1 abs(hash(:r, :default_seed + 123)) % 1000000\n\\set k2 abs(hash(:r, :default_seed + 321)) % 1000000\n</pre>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u683c\u5f0f\u5982\u4e0b\uff1a</p>\n<pre class=\"synopsis\"><em class=\"replaceable\"><code>client_id</code></em> <em class=\"replaceable\"><code>transaction_no</code></em> <em class=\"replaceable\"><code>time</code></em> <em class=\"replaceable\"><code>script_no</code></em> <em class=\"replaceable\"><code>time_epoch</code></em> <em class=\"replaceable\"><code>time_us</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>schedule_lag</code></em> </span>]\n</pre>\n<p lang=\"zh\">\u5176\u4e2d\uff0c<em class=\"replaceable\"><code>client_id</code></em> \u8868\u793a\u8fd0\u884c\u8be5\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd\uff0c<em class=\"replaceable\"><code>transaction_no</code></em> \u8bb0\u5f55\u8be5\u4f1a\u8bdd\u5df2\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\uff0c<em class=\"replaceable\"><code>time</code></em> \u662f\u4e8b\u52a1\u7ecf\u8fc7\u7684\u603b\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff0c<em class=\"replaceable\"><code>script_no</code></em> \u6807\u8bc6\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5728\u901a\u8fc7 <code class=\"option\">-f</code> \u6216 <code class=\"option\">-b</code> \u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09\uff0c\u800c <em class=\"replaceable\"><code>time_epoch</code></em>/<em class=\"replaceable\"><code>time_us</code></em> \u5206\u522b\u662f Unix \u7eaa\u5143\u65f6\u95f4\u6233\u548c\u4ee5\u5fae\u79d2\u8ba1\u7684\u504f\u79fb\u91cf\uff08\u9002\u5408\u7528\u6765\u751f\u6210\u5e26\u5c0f\u6570\u79d2\u7684 ISO 8601 \u65f6\u95f4\u6233\uff09\uff0c\u8868\u793a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002<em class=\"replaceable\"><code>schedule_lag</code></em> \u5b57\u6bb5\u662f\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\u3002\u5b83\u4ec5\u5728\u4f7f\u7528 <code class=\"option\">--rate</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5982\u679c\u540c\u65f6\u4f7f\u7528 <code class=\"option\">--rate</code> \u548c <code class=\"option\">--latency-limit</code>\uff0c\u5219\u88ab\u8df3\u8fc7\u4e8b\u52a1\u7684 <em class=\"replaceable\"><code>time</code></em> \u5c06\u62a5\u544a\u4e3a <code class=\"literal\">skipped</code>\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--aggregate-interval</code> \u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u91c7\u7528\u53e6\u4e00\u79cd\u683c\u5f0f\uff1a</p>\n<pre class=\"synopsis\"><em class=\"replaceable\"><code>interval_start</code></em> <em class=\"replaceable\"><code>num_transactions</code></em> <em class=\"replaceable\"><code>sum_latency</code></em> <em class=\"replaceable\"><code>sum_latency_2</code></em> <em class=\"replaceable\"><code>min_latency</code></em> <em class=\"replaceable\"><code>max_latency</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>sum_lag</code></em> <em class=\"replaceable\"><code>sum_lag_2</code></em> <em class=\"replaceable\"><code>min_lag</code></em> <em class=\"replaceable\"><code>max_lag</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>skipped</code></em> </span>] </span>]\n</pre>\n<p lang=\"zh\">\u5176\u4e2d\uff0c<em class=\"replaceable\"><code>interval_start</code></em> \u662f\u65f6\u95f4\u533a\u95f4\u7684\u5f00\u59cb\u65f6\u95f4\uff08\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a\uff09\uff0c<em class=\"replaceable\"><code>num_transactions</code></em> \u662f\u533a\u95f4\u5185\u7684\u4e8b\u52a1\u6570\uff0c<em class=\"replaceable\"><code>sum_latency</code></em> \u662f\u533a\u95f4\u5185\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c\uff0c<em class=\"replaceable\"><code>sum_latency_2</code></em> \u662f\u533a\u95f4\u5185\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff0c<em class=\"replaceable\"><code>min_latency</code></em> \u662f\u533a\u95f4\u5185\u7684\u6700\u5c0f\u5ef6\u8fdf\uff0c\u800c <em class=\"replaceable\"><code>max_latency</code></em> \u662f\u533a\u95f4\u5185\u7684\u6700\u5927\u5ef6\u8fdf\u3002\u63a5\u4e0b\u6765\u7684\u5b57\u6bb5 <em class=\"replaceable\"><code>sum_lag</code></em>\u3001<em class=\"replaceable\"><code>sum_lag_2</code></em>\u3001<em class=\"replaceable\"><code>min_lag</code></em> \u548c <em class=\"replaceable\"><code>max_lag</code></em> \u4ec5\u5728\u4f7f\u7528 <code class=\"option\">--rate</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5b83\u4eec\u63d0\u4f9b\u5404\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u7edf\u8ba1\uff0c\u5373\u5404\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\u3002\u6700\u540e\u4e00\u4e2a\u5b57\u6bb5 <em class=\"replaceable\"><code>skipped</code></em> \u4ec5\u5728\u8fd8\u4f7f\u7528 <code class=\"option\">--latency-limit</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5b83\u8bb0\u5f55\u56e0\u5f00\u59cb\u65f6\u95f4\u8fc7\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\u3002\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8ba1\u5165\u5176\u63d0\u4ea4\u65f6\u6240\u5728\u7684\u65f6\u95f4\u533a\u95f4\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e9b\u8f93\u51fa\u793a\u4f8b\uff1a</p>\n<pre class=\"screen\">1345828501 5601 1542744 483552416 61 2573\n1345828503 7884 1979812 565806736 60 1479\n1345828505 7208 1979422 567277552 59 1391\n1345828507 7685 1980268 569784714 60 1398\n1345828509 7073 1979779 573489941 236 1411\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u5ef6\u8fdf</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\u65f6\uff0c<span class=\"application\">pgbench</span>\u4f1a\u6536\u96c6\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u6240\u7ecf\u8fc7\u7684\u4e8b\u52a1\u65f6\u95f4\u3002\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u5b83\u4f1a\u62a5\u544a\u8fd9\u4e9b\u503c\u7684\u5e73\u5747\u503c\uff0c\u79f0\u4e3a\u6bcf\u6761\u8bed\u53e5\u7684\u5ef6\u8fdf\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u4e0e\u4e0b\u9762\u7c7b\u4f3c\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nlatency average = 15.844 ms\nlatency stddev = 2.715 ms\ntps = 618.764555 (including connections establishing)\ntps = 622.977698 (excluding connections establishing)\nstatement latencies in milliseconds:\n        0.002  \\set aid random(1, 100000 * :scale)\n        0.005  \\set bid random(1, 1 * :scale)\n        0.002  \\set tid random(1, 10 * :scale)\n        0.001  \\set delta random(-5000, 5000)\n        0.326  BEGIN;\n        0.603  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n        0.454  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n        5.528  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n        7.335  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n        0.371  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n        1.212  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u5e73\u5747\u503c\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.9\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.7.10\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/11/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.8.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/11/pgbench.html", "method": "same-major semantic node", "sha256": "7709f641d3a79a0ae92eac190b071c6f5350d88f5f184f2a0fbea053fadcf5b9", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/div[1]/h3[0]", "#PGBENCH/div[6]/div[1]/h3[0]/span[1]", "#PGBENCH/div[6]/div[1]/p[1]", "#PGBENCH/div[6]/div[1]/p[2]", "#PGBENCH/div[6]/div[1]/p[4]", "#PGBENCH/div[6]/div[1]/p[5]", "#PGBENCH/div[6]/div[2]/div[3]/h3[0]", "#PGBENCH/div[6]/div[2]/div[3]/p[1]", "#PGBENCH/div[6]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[6]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[6]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[6]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[6]/div[2]/div[5]/p[0]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[1]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[3]/p[0]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[3]/p[1]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[3]/p[2]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[3]/p[4]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[6]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[6]/div[2]/h3[0]", "#PGBENCH/div[6]/div[2]/p[1]", "#PGBENCH/div[6]/div[2]/p[2]", "#PGBENCH/div[6]/div[2]/p[4]", "#PGBENCH/div[6]/div[2]/p[7]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]/td[1]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[0]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[2]", "#PGBENCH/div[6]/div[3]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[3]", "#PGBENCH/div[6]/div[3]/div[2]/p[0]", "#PGBENCH/div[6]/div[3]/h3[0]", "#PGBENCH/div[6]/div[3]/p[1]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]/td[4]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]/td[1]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]/td[2]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[0]", "#PGBENCH/div[6]/div[4]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[1]", "#PGBENCH/div[6]/div[4]/div[2]/p[0]", "#PGBENCH/div[6]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[6]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[6]/div[4]/h3[0]", "#PGBENCH/div[6]/div[4]/p[10]", "#PGBENCH/div[6]/div[4]/p[12]", "#PGBENCH/div[6]/div[4]/p[1]", "#PGBENCH/div[6]/div[4]/p[4]", "#PGBENCH/div[6]/div[4]/p[6]", "#PGBENCH/div[6]/div[4]/p[8]", "#PGBENCH/div[6]/div[5]/h3[0]", "#PGBENCH/div[6]/div[5]/p[10]", "#PGBENCH/div[6]/div[5]/p[2]", "#PGBENCH/div[6]/div[5]/p[4]", "#PGBENCH/div[6]/div[5]/p[5]", "#PGBENCH/div[6]/div[5]/p[7]", "#PGBENCH/div[6]/div[5]/p[9]", "#PGBENCH/div[6]/div[6]/h3[0]", "#PGBENCH/div[6]/div[6]/p[1]", "#PGBENCH/div[6]/div[6]/p[3]", "#PGBENCH/div[6]/div[6]/p[4]", "#PGBENCH/div[6]/div[6]/p[6]", "#PGBENCH/div[6]/div[7]/h3[0]", "#PGBENCH/div[6]/div[7]/p[1]", "#PGBENCH/div[6]/div[7]/p[2]", "#PGBENCH/div[6]/div[7]/p[4]", "#PGBENCH/div[6]/div[7]/p[5]", "#PGBENCH/div[6]/div[8]/h3[0]", "#PGBENCH/div[6]/div[8]/p[1]", "#PGBENCH/div[6]/div[8]/p[2]", "#PGBENCH/div[6]/div[8]/p[4]", "#PGBENCH/div[6]/div[8]/p[5]", "#PGBENCH/div[6]/div[9]/h3[0]", "#PGBENCH/div[6]/div[9]/p[1]", "#PGBENCH/div[6]/h2[0]"]}], "language": "zh", "original_text": {"/versions/11/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/11/facts/0/label": "Documented executable", "/versions/11/facts/0/value": "pgbench", "/versions/11/facts/1/label": "Executable version", "/versions/11/facts/2/label": "Reference inventory", "/versions/11/facts/2/value": "Client applications", "/versions/11/facts/3/label": "Option definition groups", "/versions/11/tables/0/title": "Documented options", "/versions/11/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/11/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/11/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/11/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/11/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/11/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/11/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/11/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/11/tables/0/rows/8/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/11/tables/0/rows/9/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/11/tables/0/columns/0/label": "Option and arguments", "/versions/11/tables/0/columns/1/label": "Description", "/versions/11/tables/0/rows/10/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/11/tables/0/rows/11/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/11/tables/0/rows/12/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/11/tables/0/rows/13/summary": "Print debugging output.", "/versions/11/tables/0/rows/14/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/11/tables/0/rows/15/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/11/tables/0/rows/16/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/11/tables/0/rows/17/summary": "Write information about each transaction to a log file. See below for details.", "/versions/11/tables/0/rows/18/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/11/tables/0/rows/19/summary": "Protocol to use for submitting queries to the server:", "/versions/11/tables/0/rows/20/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/11/tables/0/rows/21/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/11/tables/0/rows/22/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time.", "/versions/11/tables/0/rows/23/summary": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details.", "/versions/11/tables/0/rows/24/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/11/tables/0/rows/25/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/11/tables/0/rows/26/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/11/tables/0/rows/27/summary": "Number of transactions each client runs. Default is 10.", "/versions/11/tables/0/rows/28/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/11/tables/0/rows/29/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/11/tables/0/rows/30/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/11/tables/0/rows/31/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/11/tables/0/rows/32/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/11/tables/0/rows/33/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for SEED may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for SEED may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/11/tables/0/rows/34/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/11/tables/0/rows/35/summary": "The database server's host name", "/versions/11/tables/0/rows/36/summary": "The database server's port number", "/versions/11/tables/0/rows/37/summary": "The user name to connect as", "/versions/11/tables/0/rows/38/summary": "Print the pgbench version and exit.", "/versions/11/tables/0/rows/39/summary": "Show help about pgbench command line arguments, and exit."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "eabee07ef5c5bd7984101df8fabdeb23c204279b320d26f394a33040d6a6e370"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g (Generate data) Generate data and load it into the standard tables, replacing any data already present. v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware)."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "signature": "-d --debug", "description": "Print debugging output."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped ."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. The default is simple query protocol. (See Chapter 53 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time."}, {"names": ["-r", "--report-latencies"], "signature": "-r --report-latencies", "description": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= SEED", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for SEED may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for SEED may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": []}, "comparison_hash": "1bc988f849c8763ac05fdf5fee46ba3619bb1deabaa65aaf92b4af532f10cdb6", "manual_language": "zh"}, "12": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "12.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "40"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u9009\u5b9a\u7684\u5e38\u89c4\u521d\u59cb\u5316\u6b65\u9aa4\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/12/pgbench.html", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/12/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u5b89\u9759\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf 100000 \u884c\u6253\u5370\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u6b64\u901a\u5e38\u6bcf\u79d2\u8f93\u51fa\u5f88\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u6027\u80fd\u826f\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/12/pgbench.html", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-C --connect"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-d --debug"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/12/pgbench.html", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\uff0c\u4ee5\u53ca\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-P sec --progress= sec"}}, {"summary": "\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u62a5\u544a\u6bcf\u6761\u547d\u4ee4\u7684\u5e73\u5747\u8bed\u53e5\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89c6\u89d2\u770b\u5230\u7684\u6267\u884c\u65f6\u95f4\uff09\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-r --report-latencies"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "--aggregate-interval= seconds"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "--log-prefix= prefix"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 SEED \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 SEED \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "--random-seed= SEED"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "--sampling-rate= rate"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/12/pgbench.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/12/pgbench.html", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/12/pgbench.html", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g (Generate data) Generate data and load it into the standard tables, replacing any data already present. v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/12/pgbench.html", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/12/pgbench.html", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/12/pgbench.html", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware)."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/12/pgbench.html", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/12/pgbench.html", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/12/pgbench.html", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/12/pgbench.html", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/12/pgbench.html", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/12/pgbench.html", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/12/pgbench.html", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/12/pgbench.html", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "summary": "Print debugging output.", "signature": "-d --debug", "source_url": "/docs/12/pgbench.html", "description": "Print debugging output."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/12/pgbench.html", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/12/pgbench.html", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/12/pgbench.html", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/12/pgbench.html", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/12/pgbench.html", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped ."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/12/pgbench.html", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 52 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/12/pgbench.html", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/12/pgbench.html", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time.", "signature": "-P sec --progress= sec", "source_url": "/docs/12/pgbench.html", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time."}, {"names": ["-r", "--report-latencies"], "summary": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details.", "signature": "-r --report-latencies", "source_url": "/docs/12/pgbench.html", "description": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/12/pgbench.html", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/12/pgbench.html", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/12/pgbench.html", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/12/pgbench.html", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/12/pgbench.html", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/12/pgbench.html", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/12/pgbench.html", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/12/pgbench.html", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/12/pgbench.html", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for SEED may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for SEED may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= SEED", "source_url": "/docs/12/pgbench.html", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for SEED may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for SEED may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/12/pgbench.html", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/12/pgbench.html", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/12/pgbench.html", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/12/pgbench.html", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/12/pgbench.html", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/12/pgbench.html", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "label": "12.22", "major": "12", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/12/postgresql-12-A4.pdf", "bytes": 13424351, "pages": 2803, "sha256": "7422cf53fd1939e7a3d2925231a88b0330e468afa5393627cac0ff86158a0621", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/12/postgresql-12-US.pdf", "bytes": 13322565, "pages": 2958, "sha256": "51f3b04e72907fc38512685946223452ea65f84419c60c66241dfa3396035e77", "built_at": "2026-09-26"}}, "tree": "12", "index": "index.html", "major": "12", "pages": 1131, "release": "12.22", "source_url": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "svg_assets": 2, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "revision": "7a827e97cbfacd7febff75f34443e2043e40723de5b6d8c9d81a9430b65a37e4", "evidence_kind": "English manual and source declarations", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "sources": [{"url": "https://pg.center/docs/12/pgbench.html", "file": "pgbench.html", "label": "12.22 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "f861131e943a738852ff9d3379f19210926ad630392b9281fa11dae8c9c666d5", "language": "en", "original_url": "/docs/12/pgbench.html"}, {"url": "https://pg.center/docs/12/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "089624dd131f52eea682b304f87a1acb03392ee7bcf78b000699c9b17c7ca22d", "language": "en", "original_url": "/docs/12/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f <span class=\"application\">pgbench</span> \u7684\u5178\u578b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\ntps = 85.184871 (including connections establishing)\ntps = 85.296346 (excluding connections establishing)\n</pre>\n<p lang=\"zh\">\u524d\u516d\u884c\u62a5\u544a\u4e86\u4e00\u4e9b\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u4e0b\u4e00\u884c\u62a5\u544a\u5df2\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u7684\u4e8b\u52a1\u6570\uff08\u540e\u8005\u5c31\u662f\u5ba2\u6237\u7aef\u6570\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u7684\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u5426\u5219\u8fd9\u4e24\u4e2a\u6570\u5e94\u8be5\u76f8\u7b49\u3002\uff08\u5728 <code class=\"option\">-T</code> \u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u7684\u4e8b\u52a1\u6570\u3002\uff09\u6700\u540e\u4e24\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\uff0c\u5206\u522b\u8ba1\u5165\u548c\u4e0d\u8ba1\u5165\u542f\u52a8\u6570\u636e\u5e93\u4f1a\u8bdd\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>dbname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u5219\u4f7f\u7528\u8fde\u63a5\u6307\u5b9a\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u9009\u5b9a\u7684\u5e38\u89c4\u521d\u59cb\u5316\u6b65\u9aa4\u3002<em class=\"replaceable\"><code>init_steps</code></em> \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\uff08\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u5b89\u9759\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf 100000 \u884c\u6253\u5370\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u6b64\u901a\u5e38\u6bcf\u79d2\u8f93\u51fa\u5f88\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u6027\u80fd\u826f\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--foreign-keys</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d</code><br/></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span></dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5728<code class=\"literal\">prepared</code>\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pgbench</span>\u4ece\u7b2c\u4e8c\u6b21\u67e5\u8be2\u8fed\u4ee3\u5f00\u59cb\u590d\u7528\u89e3\u6790\u5206\u6790\u7ed3\u679c\uff0c\u56e0\u6b64<span class=\"application\">pgbench</span>\u6bd4\u5176\u4ed6\u6a21\u5f0f\u8fd0\u884c\u5f97\u66f4\u5feb\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u503c\u662f\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/12/protocol.html\" title=\"\u7b2c\u00a052\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a052\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\uff0c\u4ee5\u53ca\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-latencies</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u62a5\u544a\u6bcf\u6761\u547d\u4ee4\u7684\u5e73\u5747\u8bed\u53e5\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89c6\u89d2\u770b\u5230\u7684\u6267\u884c\u65f6\u95f4\uff09\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>SEED</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>SEED</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>SEED</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u901a\u7528\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u6210\u529f\u8fd0\u884c\u65f6\u9000\u51fa\u72b6\u6001\u4e3a 0\u3002\u9000\u51fa\u72b6\u6001 1 \u8868\u793a\u9759\u6001\u95ee\u9898\uff0c\u4f8b\u5982\u65e0\u6548\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002\u8fd0\u884c\u671f\u95f4\u7684\u9519\u8bef\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u9519\u8bef\u6216\u811a\u672c\u95ee\u9898\uff0c\u4f1a\u5bfc\u81f4\u9000\u51fa\u72b6\u6001\u4e3a 2\u3002\u5728\u540e\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0cpgbench \u4f1a\u6253\u5370\u90e8\u5206\u7ed3\u679c\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.8\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/12/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.9\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.2\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u673a\u5236\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5e76\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u5982\u4e0a\u6240\u8ff0\uff0c\u53d8\u91cf\u53ef\u4ee5\u7528\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e0b\u6587\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u901a\u8fc7<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u5148\u8bbe\u7f6e\u7684\u53d8\u91cf\u4e4b\u5916\uff0c\u8fd8\u6709\u5c11\u91cf\u53d8\u91cf\u4f1a\u88ab\u81ea\u52a8\u9884\u8bbe\uff0c\u5217\u5728<a class=\"xref\" href=\"/docs/12/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0258.\u00a0\u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0258</a>\u4e2d\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u503c\uff0c\u5219\u4f1a\u8986\u76d6\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u4e00\u65e6\u8bbe\u7f6e\u597d\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u5728 SQL \u547d\u4ee4\u4e2d\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u6765\u63d2\u5165\u5176\u503c\u3002\u5f53\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u53d8\u91cf\u96c6\u5408\u3002<span class=\"application\">pgbench</span>\u5728\u5355\u6761\u8bed\u53e5\u4e2d\u6700\u591a\u652f\u6301 255 \u6b21\u53d8\u91cf\u4f7f\u7528\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0258.\u00a0\u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [<em class=\"replaceable\"><code>prefix</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u53ef\u7528\u6765\u7ed3\u675f SQL \u67e5\u8be2\uff0c\u4ee3\u66ff\u7ed3\u5c3e\u7684\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u547d\u4ee4\u65f6\uff0c\u524d\u9762\u7684 SQL \u67e5\u8be2\u5e94\u8fd4\u56de\u4e00\u884c\uff0c\u5176\u5404\u5217\u4f1a\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\u4e2d\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u8fd8\u4f1a\u4e3a\u53d8\u91cf\u540d\u52a0\u4e0a\u8be5\u524d\u7f00\u3002</p>\n<p lang=\"zh\">\u4ee5\u4e0b\u793a\u4f8b\u5c06\u7b2c\u4e00\u4e2a\u67e5\u8be2\u7684\u6700\u7ec8\u8d26\u6237\u4f59\u989d\u5b58\u5165\u53d8\u91cf <em class=\"replaceable\"><code>abalance</code></em>\uff0c\u5e76\u5c06\u53d8\u91cf <em class=\"replaceable\"><code>p_two</code></em> \u548c <em class=\"replaceable\"><code>p_three</code></em> \u8bbe\u4e3a\u7b2c\u4e09\u4e2a\u67e5\u8be2\u8fd4\u56de\u7684\u6574\u6570\u3002\u7b2c\u4e8c\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<pre class=\"programlisting\">UPDATE pgbench_accounts\n  SET abalance = abalance + :delta\n  WHERE aid = :aid\n  RETURNING abalance \\gset\n-- compound of two queries\nSELECT 1 \\;\nSELECT 2 AS two, 3 AS three \\gset p_\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/12/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/12/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/12/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/12/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.17.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u8fc7\u5927\u6216\u8fc7\u5c0f\u7684\u6574\u6570\u548c\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff0c\u4ee5\u53ca\u6574\u6570\u7b97\u672f\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u548c<code class=\"literal\">/</code>\uff09\u90fd\u4f1a\u5728\u6ea2\u51fa\u65f6\u5f15\u53d1\u9519\u8bef\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/12/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0259.\u00a0\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u6392\u5217\u7684 pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0259</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/12/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0259.\u00a0\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u6392\u5217\u7684 pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u64cd\u4f5c\u7b26</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n<th lang=\"zh\">\u793a\u4f8b</th>\n<th lang=\"zh\">\u7ed3\u679c</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">OR</code></td>\n<td lang=\"zh\">\u903b\u8f91\u6216</td>\n<td><code class=\"literal\">5 or 0</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">AND</code></td>\n<td lang=\"zh\">\u903b\u8f91\u4e0e</td>\n<td><code class=\"literal\">3 and 0</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">NOT</code></td>\n<td lang=\"zh\">\u903b\u8f91\u975e</td>\n<td><code class=\"literal\">not false</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code></td>\n<td lang=\"zh\">\u503c\u6d4b\u8bd5</td>\n<td><code class=\"literal\">1 is null</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">ISNULL|NOTNULL</code></td>\n<td lang=\"zh\">\u7a7a\u503c\u6d4b\u8bd5</td>\n<td><code class=\"literal\">1 notnull</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">=</code></td>\n<td lang=\"zh\">\u7b49\u4e8e</td>\n<td><code class=\"literal\">5 = 4</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&lt;&gt;</code></td>\n<td lang=\"zh\">\u4e0d\u7b49\u4e8e</td>\n<td><code class=\"literal\">5 &lt;&gt; 4</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">!=</code></td>\n<td lang=\"zh\">\u4e0d\u7b49\u4e8e</td>\n<td><code class=\"literal\">5 != 5</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&lt;</code></td>\n<td lang=\"zh\">\u5c0f\u4e8e</td>\n<td><code class=\"literal\">5 &lt; 4</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&lt;=</code></td>\n<td lang=\"zh\">\u5c0f\u4e8e\u6216\u7b49\u4e8e</td>\n<td><code class=\"literal\">5 &lt;= 4</code></td>\n<td><code class=\"literal\">FALSE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&gt;</code></td>\n<td lang=\"zh\">\u5927\u4e8e</td>\n<td><code class=\"literal\">5 &gt; 4</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&gt;=</code></td>\n<td lang=\"zh\">\u5927\u4e8e\u6216\u7b49\u4e8e</td>\n<td><code class=\"literal\">5 &gt;= 4</code></td>\n<td><code class=\"literal\">TRUE</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">|</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u6216</td>\n<td><code class=\"literal\">1 | 2</code></td>\n<td><code class=\"literal\">3</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">#</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u5f02\u6216</td>\n<td><code class=\"literal\">1 # 3</code></td>\n<td><code class=\"literal\">2</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&amp;</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u4e0e</td>\n<td><code class=\"literal\">1 &amp; 3</code></td>\n<td><code class=\"literal\">1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">~</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u975e</td>\n<td><code class=\"literal\">~ 1</code></td>\n<td><code class=\"literal\">-2</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&lt;&lt;</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u5de6\u79fb</td>\n<td><code class=\"literal\">1 &lt;&lt; 2</code></td>\n<td><code class=\"literal\">4</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">&gt;&gt;</code></td>\n<td lang=\"zh\">\u6574\u6570\u6309\u4f4d\u53f3\u79fb</td>\n<td><code class=\"literal\">8 &gt;&gt; 2</code></td>\n<td><code class=\"literal\">2</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">+</code></td>\n<td lang=\"zh\">\u52a0\u6cd5</td>\n<td><code class=\"literal\">5 + 4</code></td>\n<td><code class=\"literal\">9</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">-</code></td>\n<td lang=\"zh\">\u51cf\u6cd5</td>\n<td><code class=\"literal\">3 - 2.0</code></td>\n<td><code class=\"literal\">1.0</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">*</code></td>\n<td lang=\"zh\">\u4e58\u6cd5</td>\n<td><code class=\"literal\">5 * 4</code></td>\n<td><code class=\"literal\">20</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">/</code></td>\n<td lang=\"zh\">\u9664\u6cd5\uff08\u6574\u6570\u4f1a\u622a\u65ad\u7ed3\u679c\uff09</td>\n<td><code class=\"literal\">5 / 3</code></td>\n<td><code class=\"literal\">1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">%</code></td>\n<td lang=\"zh\">\u53d6\u6a21</td>\n<td><code class=\"literal\">3 % 2</code></td>\n<td><code class=\"literal\">1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\">-</code></td>\n<td lang=\"zh\">\u53d6\u76f8\u53cd\u6570</td>\n<td><code class=\"literal\">- 2.0</code></td>\n<td><code class=\"literal\">-2.0</code></td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/12/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0260.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0260</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/12/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0260.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u51fd\u6570</th>\n<th lang=\"zh\">\u8fd4\u56de\u7c7b\u578b</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n<th lang=\"zh\">\u793a\u4f8b</th>\n<th lang=\"zh\">\u7ed3\u679c</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">abs(<em class=\"replaceable\"><code>a</code></em>)</code></code></td>\n<td lang=\"zh\">\u4e0e<em class=\"replaceable\"><code>a</code></em>\u76f8\u540c</td>\n<td lang=\"zh\">\u7edd\u5bf9\u503c</td>\n<td><code class=\"literal\">abs(-17)</code></td>\n<td><code class=\"literal\">17</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">debug(<em class=\"replaceable\"><code>a</code></em>)</code></code></td>\n<td lang=\"zh\">\u4e0e<em class=\"replaceable\"><code>a</code></em>\u76f8\u540c</td>\n<td lang=\"zh\">\u5c06<em class=\"replaceable\"><code>a</code></em>\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de<em class=\"replaceable\"><code>a</code></em></td>\n<td><code class=\"literal\">debug(5432.1)</code></td>\n<td><code class=\"literal\">5432.1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">double(<em class=\"replaceable\"><code>i</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u8f6c\u6362\u4e3a double</td>\n<td><code class=\"literal\">double(5432)</code></td>\n<td><code class=\"literal\">5432.0</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">exp(<em class=\"replaceable\"><code>x</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u6307\u6570\u51fd\u6570</td>\n<td><code class=\"literal\">exp(1.0)</code></td>\n<td><code class=\"literal\">2.718281828459045</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">greatest(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>...</code></em> ] )</code></code></td>\n<td lang=\"zh\">\u82e5\u4efb\u4e00<em class=\"replaceable\"><code>a</code></em>\u4e3a double\uff0c\u5219\u4e3a double\uff0c\u5426\u5219\u4e3a integer</td>\n<td lang=\"zh\">\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c</td>\n<td><code class=\"literal\">greatest(5, 4, 3, 2)</code></td>\n<td><code class=\"literal\">5</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">hash(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>seed</code></em> ] )</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">hash_murmur2()</code>\u7684\u522b\u540d</td>\n<td><code class=\"literal\">hash(10, 5432)</code></td>\n<td><code class=\"literal\">-5817877081768721676</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">hash_fnv1a(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>seed</code></em> ] )</code></code></td>\n<td>integer</td>\n<td lang=\"zh\">FNV-1a \u54c8\u5e0c</td>\n<td><code class=\"literal\">hash_fnv1a(10, 5432)</code></td>\n<td><code class=\"literal\">-7793829335365542153</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">hash_murmur2(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>seed</code></em> ] )</code></code></td>\n<td>integer</td>\n<td lang=\"zh\">MurmurHash2 \u54c8\u5e0c</td>\n<td><code class=\"literal\">hash_murmur2(10, 5432)</code></td>\n<td><code class=\"literal\">-5817877081768721676</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">int(<em class=\"replaceable\"><code>x</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\">\u8f6c\u6362\u4e3a int</td>\n<td><code class=\"literal\">int(5.4 + 3.8)</code></td>\n<td><code class=\"literal\">9</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">least(<em class=\"replaceable\"><code>a</code></em> [, <em class=\"replaceable\"><code>...</code></em> ] )</code></code></td>\n<td lang=\"zh\">\u82e5\u4efb\u4e00<em class=\"replaceable\"><code>a</code></em>\u4e3a double\uff0c\u5219\u4e3a double\uff0c\u5426\u5219\u4e3a integer</td>\n<td lang=\"zh\">\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c</td>\n<td><code class=\"literal\">least(5, 4, 3, 2.1)</code></td>\n<td><code class=\"literal\">2.1</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">ln(<em class=\"replaceable\"><code>x</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u81ea\u7136\u5bf9\u6570</td>\n<td><code class=\"literal\">ln(2.718281828459045)</code></td>\n<td><code class=\"literal\">1.0</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">mod(<em class=\"replaceable\"><code>i</code></em>, <em class=\"replaceable\"><code>j</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\">\u53d6\u6a21</td>\n<td><code class=\"literal\">mod(54, 32)</code></td>\n<td><code class=\"literal\">22</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">pi()</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u5e38\u91cf PI \u7684\u503c</td>\n<td><code class=\"literal\">pi()</code></td>\n<td><code class=\"literal\">3.14159265358979323846</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">pow(<em class=\"replaceable\"><code>x</code></em>, <em class=\"replaceable\"><code>y</code></em>)</code>, <code class=\"function\">power(<em class=\"replaceable\"><code>x</code></em>, <em class=\"replaceable\"><code>y</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u4e58\u65b9</td>\n<td><code class=\"literal\">pow(2.0, 10)</code>, <code class=\"literal\">power(2.0, 10)</code></td>\n<td><code class=\"literal\">1024.0</code></td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u5747\u5300\u5206\u5e03\u7684\u968f\u673a\u6574\u6570</td>\n<td><code class=\"literal\">random(1, 10)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random_exponential(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>, <em class=\"replaceable\"><code>parameter</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u670d\u4ece\u6307\u6570\u5206\u5e03\u7684\u968f\u673a\u6574\u6570\uff0c\u89c1\u4e0b\u6587</td>\n<td><code class=\"literal\">random_exponential(1, 10, 3.0)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random_gaussian(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>, <em class=\"replaceable\"><code>parameter</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u670d\u4ece\u9ad8\u65af\u5206\u5e03\u7684\u968f\u673a\u6574\u6570\uff0c\u89c1\u4e0b\u6587</td>\n<td><code class=\"literal\">random_gaussian(1, 10, 2.5)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">random_zipfian(<em class=\"replaceable\"><code>lb</code></em>, <em class=\"replaceable\"><code>ub</code></em>, <em class=\"replaceable\"><code>parameter</code></em>)</code></code></td>\n<td>integer</td>\n<td lang=\"zh\"><code class=\"literal\">[lb, ub]</code>\u4e2d\u670d\u4ece Zipfian \u5206\u5e03\u7684\u968f\u673a\u6574\u6570\uff0c\u89c1\u4e0b\u6587</td>\n<td><code class=\"literal\">random_zipfian(1, 10, 1.5)</code></td>\n<td lang=\"zh\"><code class=\"literal\">1</code>\u4e0e<code class=\"literal\">10</code>\u4e4b\u95f4\u7684\u6574\u6570</td>\n</tr>\n<tr>\n<td><code class=\"literal\"><code class=\"function\">sqrt(<em class=\"replaceable\"><code>x</code></em>)</code></code></td>\n<td>double</td>\n<td lang=\"zh\">\u5e73\u65b9\u6839</td>\n<td><code class=\"literal\">sqrt(2.0)</code></td>\n<td><code class=\"literal\">1.414213562</code></td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002parameter \u5141\u8bb8\u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n<p lang=\"zh\">pgbench \u7684\u5b9e\u73b0\u57fa\u4e8e Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002\u7531\u4e8e\u8be5\u7b97\u6cd5\u7684\u9650\u5236\uff0cparameter \u7684\u53d6\u503c\u9650\u5236\u5728 [1.001, 1000] \u8303\u56f4\u5185\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570 <code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code> \u548c <code class=\"literal\">hash_fnv1a</code> \u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u672a\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f7f\u7528 <code class=\"literal\">:default_seed</code> \u7684\u503c\uff0c\u8be5\u503c\u968f\u673a\u521d\u59cb\u5316\uff0c\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c <code class=\"literal\">-D</code> \u9009\u9879\u8bbe\u7f6e\u3002Hash \u51fd\u6570\u53ef\u4ee5\u7528\u6765\u6253\u6563\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f8b\u5982 <code class=\"literal\">random_zipfian</code> \u6216 <code class=\"literal\">random_exponential</code>\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e2d\u53ef\u80fd\u51fa\u73b0\u7684\u5178\u578b\u771f\u5b9e\u5de5\u4f5c\u8d1f\u8f7d\uff0c\u5176\u4e2d\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u4e86\u8fc7\u591a\u7684\u8d1f\u8f7d\uff1a</p>\n<pre class=\"programlisting\">\\set r random_zipfian(0, 100000000, 1.07)\n\\set k abs(hash(:r)) % 1000000\n</pre>\n<p lang=\"zh\">\u67d0\u4e9b\u60c5\u51b5\u4e0b\u9700\u8981\u51e0\u4e2a\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u9690\u5f0f\u79cd\u5b50\u53c2\u6570\u5c31\u80fd\u6d3e\u4e0a\u7528\u573a\uff1a</p>\n<pre class=\"programlisting\">\\set k1 abs(hash(:r, :default_seed + 123)) % 1000000\n\\set k2 abs(hash(:r, :default_seed + 321)) % 1000000\n</pre>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u683c\u5f0f\u5982\u4e0b\uff1a</p>\n<pre class=\"synopsis\"><em class=\"replaceable\"><code>client_id</code></em> <em class=\"replaceable\"><code>transaction_no</code></em> <em class=\"replaceable\"><code>time</code></em> <em class=\"replaceable\"><code>script_no</code></em> <em class=\"replaceable\"><code>time_epoch</code></em> <em class=\"replaceable\"><code>time_us</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>schedule_lag</code></em> </span>]\n</pre>\n<p lang=\"zh\">\u5176\u4e2d\uff0c<em class=\"replaceable\"><code>client_id</code></em> \u8868\u793a\u8fd0\u884c\u8be5\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd\uff0c<em class=\"replaceable\"><code>transaction_no</code></em> \u8bb0\u5f55\u8be5\u4f1a\u8bdd\u5df2\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\uff0c<em class=\"replaceable\"><code>time</code></em> \u662f\u4e8b\u52a1\u7ecf\u8fc7\u7684\u603b\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff0c<em class=\"replaceable\"><code>script_no</code></em> \u6807\u8bc6\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5728\u901a\u8fc7 <code class=\"option\">-f</code> \u6216 <code class=\"option\">-b</code> \u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09\uff0c\u800c <em class=\"replaceable\"><code>time_epoch</code></em>/<em class=\"replaceable\"><code>time_us</code></em> \u5206\u522b\u662f Unix \u7eaa\u5143\u65f6\u95f4\u6233\u548c\u4ee5\u5fae\u79d2\u8ba1\u7684\u504f\u79fb\u91cf\uff08\u9002\u5408\u7528\u6765\u751f\u6210\u5e26\u5c0f\u6570\u79d2\u7684 ISO 8601 \u65f6\u95f4\u6233\uff09\uff0c\u8868\u793a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002<em class=\"replaceable\"><code>schedule_lag</code></em> \u5b57\u6bb5\u662f\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\u3002\u5b83\u4ec5\u5728\u4f7f\u7528 <code class=\"option\">--rate</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5982\u679c\u540c\u65f6\u4f7f\u7528 <code class=\"option\">--rate</code> \u548c <code class=\"option\">--latency-limit</code>\uff0c\u5219\u88ab\u8df3\u8fc7\u4e8b\u52a1\u7684 <em class=\"replaceable\"><code>time</code></em> \u5c06\u62a5\u544a\u4e3a <code class=\"literal\">skipped</code>\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--aggregate-interval</code> \u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u91c7\u7528\u53e6\u4e00\u79cd\u683c\u5f0f\uff1a</p>\n<pre class=\"synopsis\"><em class=\"replaceable\"><code>interval_start</code></em> <em class=\"replaceable\"><code>num_transactions</code></em> <em class=\"replaceable\"><code>sum_latency</code></em> <em class=\"replaceable\"><code>sum_latency_2</code></em> <em class=\"replaceable\"><code>min_latency</code></em> <em class=\"replaceable\"><code>max_latency</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>sum_lag</code></em> <em class=\"replaceable\"><code>sum_lag_2</code></em> <em class=\"replaceable\"><code>min_lag</code></em> <em class=\"replaceable\"><code>max_lag</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>skipped</code></em> </span>] </span>]\n</pre>\n<p lang=\"zh\">\u5176\u4e2d\uff0c<em class=\"replaceable\"><code>interval_start</code></em> \u662f\u65f6\u95f4\u533a\u95f4\u7684\u5f00\u59cb\u65f6\u95f4\uff08\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a\uff09\uff0c<em class=\"replaceable\"><code>num_transactions</code></em> \u662f\u533a\u95f4\u5185\u7684\u4e8b\u52a1\u6570\uff0c<em class=\"replaceable\"><code>sum_latency</code></em> \u662f\u533a\u95f4\u5185\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c\uff0c<em class=\"replaceable\"><code>sum_latency_2</code></em> \u662f\u533a\u95f4\u5185\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff0c<em class=\"replaceable\"><code>min_latency</code></em> \u662f\u533a\u95f4\u5185\u7684\u6700\u5c0f\u5ef6\u8fdf\uff0c\u800c <em class=\"replaceable\"><code>max_latency</code></em> \u662f\u533a\u95f4\u5185\u7684\u6700\u5927\u5ef6\u8fdf\u3002\u63a5\u4e0b\u6765\u7684\u5b57\u6bb5 <em class=\"replaceable\"><code>sum_lag</code></em>\u3001<em class=\"replaceable\"><code>sum_lag_2</code></em>\u3001<em class=\"replaceable\"><code>min_lag</code></em> \u548c <em class=\"replaceable\"><code>max_lag</code></em> \u4ec5\u5728\u4f7f\u7528 <code class=\"option\">--rate</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5b83\u4eec\u63d0\u4f9b\u5404\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u7edf\u8ba1\uff0c\u5373\u5404\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\u3002\u6700\u540e\u4e00\u4e2a\u5b57\u6bb5 <em class=\"replaceable\"><code>skipped</code></em> \u4ec5\u5728\u8fd8\u4f7f\u7528 <code class=\"option\">--latency-limit</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5b83\u8bb0\u5f55\u56e0\u5f00\u59cb\u65f6\u95f4\u8fc7\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\u3002\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8ba1\u5165\u5176\u63d0\u4ea4\u65f6\u6240\u5728\u7684\u65f6\u95f4\u533a\u95f4\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e9b\u8f93\u51fa\u793a\u4f8b\uff1a</p>\n<pre class=\"screen\">1345828501 5601 1542744 483552416 61 2573\n1345828503 7884 1979812 565806736 60 1479\n1345828505 7208 1979422 567277552 59 1391\n1345828507 7685 1980268 569784714 60 1398\n1345828509 7073 1979779 573489941 236 1411\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u5ef6\u8fdf</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\u65f6\uff0c<span class=\"application\">pgbench</span>\u4f1a\u6536\u96c6\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u6240\u7ecf\u8fc7\u7684\u4e8b\u52a1\u65f6\u95f4\u3002\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u5b83\u4f1a\u62a5\u544a\u8fd9\u4e9b\u503c\u7684\u5e73\u5747\u503c\uff0c\u79f0\u4e3a\u6bcf\u6761\u8bed\u53e5\u7684\u5ef6\u8fdf\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u4e0e\u4e0b\u9762\u7c7b\u4f3c\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nlatency average = 15.844 ms\nlatency stddev = 2.715 ms\ntps = 618.764555 (including connections establishing)\ntps = 622.977698 (excluding connections establishing)\nstatement latencies in milliseconds:\n        0.002  \\set aid random(1, 100000 * :scale)\n        0.005  \\set bid random(1, 1 * :scale)\n        0.002  \\set tid random(1, 10 * :scale)\n        0.001  \\set delta random(-5000, 5000)\n        0.326  BEGIN;\n        0.603  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n        0.454  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n        5.528  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n        7.335  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n        0.371  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n        1.212  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u5e73\u5747\u503c\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.9\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.10\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/12/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.9.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/12/pgbench.html", "method": "same-major semantic node", "sha256": "1dd34ec0ea332120600f63ebac2a58b8356a96d75c3039acc04d52bb8e2a57e6", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/h2[0]", "#PGBENCH/div[7]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[7]/h2[0]", "#PGBENCH/div[7]/p[2]", "#PGBENCH/div[8]/div[1]/h3[0]", "#PGBENCH/div[8]/div[1]/h3[0]/span[1]", "#PGBENCH/div[8]/div[1]/p[1]", "#PGBENCH/div[8]/div[1]/p[2]", "#PGBENCH/div[8]/div[1]/p[4]", "#PGBENCH/div[8]/div[1]/p[5]", "#PGBENCH/div[8]/div[2]/div[3]/h3[0]", "#PGBENCH/div[8]/div[2]/div[3]/p[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[5]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[1]", "#PGBENCH/div[8]/div[2]/h3[0]", "#PGBENCH/div[8]/div[2]/p[1]", "#PGBENCH/div[8]/div[2]/p[2]", "#PGBENCH/div[8]/div[2]/p[4]", "#PGBENCH/div[8]/div[2]/p[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]/td[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[0]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[2]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[3]", "#PGBENCH/div[8]/div[3]/div[2]/p[0]", "#PGBENCH/div[8]/div[3]/h3[0]", "#PGBENCH/div[8]/div[3]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]/td[4]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]/td[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]/td[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[0]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]/tr[0]/th[1]", "#PGBENCH/div[8]/div[4]/div[2]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[8]/div[4]/h3[0]", "#PGBENCH/div[8]/div[4]/p[10]", "#PGBENCH/div[8]/div[4]/p[12]", "#PGBENCH/div[8]/div[4]/p[1]", "#PGBENCH/div[8]/div[4]/p[4]", "#PGBENCH/div[8]/div[4]/p[6]", "#PGBENCH/div[8]/div[4]/p[8]", "#PGBENCH/div[8]/div[5]/h3[0]", "#PGBENCH/div[8]/div[5]/p[10]", "#PGBENCH/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[5]/p[4]", "#PGBENCH/div[8]/div[5]/p[5]", "#PGBENCH/div[8]/div[5]/p[7]", "#PGBENCH/div[8]/div[5]/p[9]", "#PGBENCH/div[8]/div[6]/h3[0]", "#PGBENCH/div[8]/div[6]/p[1]", "#PGBENCH/div[8]/div[6]/p[3]", "#PGBENCH/div[8]/div[6]/p[4]", "#PGBENCH/div[8]/div[6]/p[6]", "#PGBENCH/div[8]/div[7]/h3[0]", "#PGBENCH/div[8]/div[7]/p[1]", "#PGBENCH/div[8]/div[7]/p[2]", "#PGBENCH/div[8]/div[7]/p[4]", "#PGBENCH/div[8]/div[7]/p[5]", "#PGBENCH/div[8]/div[8]/h3[0]", "#PGBENCH/div[8]/div[8]/p[1]", "#PGBENCH/div[8]/div[8]/p[2]", "#PGBENCH/div[8]/div[8]/p[4]", "#PGBENCH/div[8]/div[8]/p[5]", "#PGBENCH/div[8]/div[9]/h3[0]", "#PGBENCH/div[8]/div[9]/p[1]", "#PGBENCH/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/12/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/12/facts/0/label": "Documented executable", "/versions/12/facts/0/value": "pgbench", "/versions/12/facts/1/label": "Executable version", "/versions/12/facts/2/label": "Reference inventory", "/versions/12/facts/2/value": "Client applications", "/versions/12/facts/3/label": "Option definition groups", "/versions/12/tables/0/title": "Documented options", "/versions/12/tables/1/title": "Environment variables", "/versions/12/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/12/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/12/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/12/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/12/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/12/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/12/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/12/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/12/tables/0/rows/8/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/12/tables/0/rows/9/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/12/tables/0/columns/0/label": "Option and arguments", "/versions/12/tables/0/columns/1/label": "Description", "/versions/12/tables/0/rows/10/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/12/tables/0/rows/11/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/12/tables/0/rows/12/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/12/tables/0/rows/13/summary": "Print debugging output.", "/versions/12/tables/0/rows/14/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/12/tables/0/rows/15/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/12/tables/0/rows/16/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/12/tables/0/rows/17/summary": "Write information about each transaction to a log file. See below for details.", "/versions/12/tables/0/rows/18/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/12/tables/0/rows/19/summary": "Protocol to use for submitting queries to the server:", "/versions/12/tables/0/rows/20/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/12/tables/0/rows/21/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/12/tables/0/rows/22/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time.", "/versions/12/tables/0/rows/23/summary": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details.", "/versions/12/tables/0/rows/24/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/12/tables/0/rows/25/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/12/tables/0/rows/26/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/12/tables/0/rows/27/summary": "Number of transactions each client runs. Default is 10.", "/versions/12/tables/0/rows/28/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/12/tables/0/rows/29/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/12/tables/0/rows/30/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/12/tables/0/rows/31/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/12/tables/0/rows/32/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/12/tables/0/rows/33/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for SEED may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for SEED may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/12/tables/0/rows/34/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/12/tables/0/rows/35/summary": "The database server's host name", "/versions/12/tables/0/rows/36/summary": "The database server's port number", "/versions/12/tables/0/rows/37/summary": "The user name to connect as", "/versions/12/tables/0/rows/38/summary": "Print the pgbench version and exit.", "/versions/12/tables/0/rows/39/summary": "Show help about pgbench command line arguments, and exit.", "/versions/12/tables/1/columns/0/label": "Variable", "/versions/12/tables/1/columns/1/label": "Meaning", "/versions/12/tables/1/rows/0/description": "Default connection parameters."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "a9db5bb0f662c18e8906f2ada00447ec706f9e01999d283b6004bc7816c42232"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g (Generate data) Generate data and load it into the standard tables, replacing any data already present. v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100000 rows, which often outputs many lines per second (especially on good hardware)."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "signature": "-d --debug", "description": "Print debugging output."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped ."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 52 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time."}, {"names": ["-r", "--report-latencies"], "signature": "-r --report-latencies", "description": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= SEED", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for SEED may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for SEED may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}]}, "comparison_hash": "7f3444a9525e8fbc1e220cd0f0d02a52438125b4a821c547ae66389d3f557b66", "manual_language": "zh"}, "13": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "13.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "43"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u9009\u5b9a\u7684\u5e38\u89c4\u521d\u59cb\u5316\u6b65\u9aa4\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/13/pgbench.html", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/13/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/13/pgbench.html", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--partition-method= NAME"}}, {"summary": "\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--partitions= NUM"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-C --connect"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-d --debug"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/13/pgbench.html", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\uff0c\u4ee5\u53ca\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-P sec --progress= sec"}}, {"summary": "\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u62a5\u544a\u6bcf\u6761\u547d\u4ee4\u7684\u5e73\u5747\u8bed\u53e5\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89c6\u89d2\u770b\u5230\u7684\u6267\u884c\u65f6\u95f4\uff09\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-r --report-latencies"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--aggregate-interval= seconds"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--log-prefix= prefix"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 seed \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 seed \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--random-seed= seed"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--sampling-rate= rate"}}, {"summary": "\u5c06\u5185\u7f6e\u811a\u672c scriptname \u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "--show-script= scriptname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/13/pgbench.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/13/pgbench.html", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/13/pgbench.html", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . Using g causes logging to print one message every 100,000 rows while generating data for the pgbench_accounts table. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/13/pgbench.html", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/13/pgbench.html", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/13/pgbench.html", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/13/pgbench.html", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/13/pgbench.html", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/13/pgbench.html", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "signature": "--partition-method= NAME", "source_url": "/docs/13/pgbench.html", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "signature": "--partitions= NUM", "source_url": "/docs/13/pgbench.html", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/13/pgbench.html", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/13/pgbench.html", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/13/pgbench.html", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/13/pgbench.html", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/13/pgbench.html", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "summary": "Print debugging output.", "signature": "-d --debug", "source_url": "/docs/13/pgbench.html", "description": "Print debugging output."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/13/pgbench.html", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/13/pgbench.html", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/13/pgbench.html", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/13/pgbench.html", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/13/pgbench.html", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped ."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/13/pgbench.html", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 52 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/13/pgbench.html", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/13/pgbench.html", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time.", "signature": "-P sec --progress= sec", "source_url": "/docs/13/pgbench.html", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time."}, {"names": ["-r", "--report-latencies"], "summary": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details.", "signature": "-r --report-latencies", "source_url": "/docs/13/pgbench.html", "description": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/13/pgbench.html", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/13/pgbench.html", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/13/pgbench.html", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/13/pgbench.html", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/13/pgbench.html", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/13/pgbench.html", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/13/pgbench.html", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/13/pgbench.html", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/13/pgbench.html", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= seed", "source_url": "/docs/13/pgbench.html", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/13/pgbench.html", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "signature": "--show-script= scriptname", "source_url": "/docs/13/pgbench.html", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/13/pgbench.html", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/13/pgbench.html", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/13/pgbench.html", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/13/pgbench.html", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/13/pgbench.html", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "label": "13.23", "major": "13", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/13/postgresql-13-A4.pdf", "bytes": 13843239, "pages": 2826, "sha256": "171cc09f90936dbc1cbd503a98ff07ae72ea58ab9771ff051313f1217737799c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/13/postgresql-13-US.pdf", "bytes": 13739572, "pages": 2984, "sha256": "48d09c6e197d9db4220f41afe83efe848a8661b1b168d3b89419751ecaf6c24d", "built_at": "2026-09-26"}}, "tree": "13", "index": "index.html", "major": "13", "pages": 1139, "release": "13.23", "source_url": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "revision": "614ee3133270254e476c118cdf6f72af78d4e4b8bbd9b28ed9ab1e14e4e9c0f6", "evidence_kind": "English manual and source declarations", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "sources": [{"url": "https://pg.center/docs/13/pgbench.html", "file": "pgbench.html", "label": "13.23 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "22da6182f8ec5ae9ea6d3214d47d003daa83b9e83074694121a64714e0d74b2e", "language": "en", "original_url": "/docs/13/pgbench.html"}, {"url": "https://pg.center/docs/13/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "2a16c2982d9803edd4bd6920f76b66083e7f2959182d6a3bcec7ccfbac0a9ad8", "language": "en", "original_url": "/docs/13/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.10.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f <span class=\"application\">pgbench</span> \u7684\u5178\u578b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\ntps = 85.184871 (including connections establishing)\ntps = 85.296346 (excluding connections establishing)\n</pre>\n<p lang=\"zh\">\u524d\u516d\u884c\u62a5\u544a\u4e86\u4e00\u4e9b\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u4e0b\u4e00\u884c\u62a5\u544a\u5df2\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u7684\u4e8b\u52a1\u6570\uff08\u540e\u8005\u5c31\u662f\u5ba2\u6237\u7aef\u6570\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u7684\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u5426\u5219\u8fd9\u4e24\u4e2a\u6570\u5e94\u8be5\u76f8\u7b49\u3002\uff08\u5728 <code class=\"option\">-T</code> \u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u7684\u4e8b\u52a1\u6570\u3002\uff09\u6700\u540e\u4e24\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\uff0c\u5206\u522b\u8ba1\u5165\u548c\u4e0d\u8ba1\u5165\u542f\u52a8\u6570\u636e\u5e93\u4f1a\u8bdd\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>dbname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u5219\u4f7f\u7528\u8fde\u63a5\u6307\u5b9a\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u9009\u5b9a\u7684\u5e38\u89c4\u521d\u59cb\u5316\u6b65\u9aa4\u3002<em class=\"replaceable\"><code>init_steps</code></em> \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\u6216<code class=\"literal\">G</code>\uff08\u5728\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">g</code>\uff08\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c\u6570\u636e\u7531<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u751f\u6210\uff0c\u518d\u901a\u8fc7<code class=\"command\">COPY</code>\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4f1a\u5927\u91cf\u5360\u7528\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u5e26\u5bbd\u3002\u4f7f\u7528<code class=\"literal\">g</code>\u65f6\uff0c\u5728\u4e3a<code class=\"structname\">pgbench_accounts</code>\u8868\u751f\u6210\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6bcf\u751f\u6210 100,000 \u884c\u4f1a\u8f93\u51fa\u4e00\u6761\u65e5\u5fd7\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">G</code>\uff08\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u53ea\u53d1\u9001\u8f83\u5c0f\u7684\u67e5\u8be2\uff0c\u968f\u540e\u5b9e\u9645\u6570\u636e\u5728\u670d\u52a1\u5668\u7aef\u751f\u6210\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u9700\u8981\u5927\u91cf\u5e26\u5bbd\uff0c\u4f46\u670d\u52a1\u5668\u4f1a\u627f\u62c5\u66f4\u591a\u5de5\u4f5c\u3002\u4f7f\u7528<code class=\"literal\">G</code>\u65f6\uff0c\u751f\u6210\u6570\u636e\u671f\u95f4\u4e0d\u4f1a\u6253\u5370\u4efb\u4f55\u8fdb\u5ea6\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u521d\u59cb\u5316\u884c\u4e3a\u4f7f\u7528\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff08\u7b49\u540c\u4e8e<code class=\"literal\">g</code>\uff09\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n<p lang=\"zh\">\u5982\u679c -I \u4e2d\u6307\u5b9a\u4e86 G\uff0c\u6b64\u8bbe\u7f6e\u4e0d\u751f\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--foreign-keys</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--partition-method=<em class=\"replaceable\"><code>NAME</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--partitions=<em class=\"replaceable\"><code>NUM</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d</code><br/></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span></dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5728<code class=\"literal\">prepared</code>\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pgbench</span>\u4ece\u7b2c\u4e8c\u6b21\u67e5\u8be2\u8fed\u4ee3\u5f00\u59cb\u590d\u7528\u89e3\u6790\u5206\u6790\u7ed3\u679c\uff0c\u56e0\u6b64<span class=\"application\">pgbench</span>\u6bd4\u5176\u4ed6\u6a21\u5f0f\u8fd0\u884c\u5f97\u66f4\u5feb\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u503c\u662f\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/13/protocol.html\" title=\"\u7b2c\u00a052\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a052\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\uff0c\u4ee5\u53ca\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-latencies</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u62a5\u544a\u6bcf\u6761\u547d\u4ee4\u7684\u5e73\u5747\u8bed\u53e5\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89c6\u89d2\u770b\u5230\u7684\u6267\u884c\u65f6\u95f4\uff09\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>seed</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>seed</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>seed</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--show-script=</code><em class=\"replaceable\"><code>scriptname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5185\u7f6e\u811a\u672c<em class=\"replaceable\"><code>scriptname</code></em>\u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u8fd8\u63a5\u53d7\u4ee5\u4e0b\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u901a\u7528\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u6210\u529f\u8fd0\u884c\u65f6\u9000\u51fa\u72b6\u6001\u4e3a 0\u3002\u9000\u51fa\u72b6\u6001 1 \u8868\u793a\u9759\u6001\u95ee\u9898\uff0c\u4f8b\u5982\u65e0\u6548\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002\u8fd0\u884c\u671f\u95f4\u7684\u9519\u8bef\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u9519\u8bef\u6216\u811a\u672c\u95ee\u9898\uff0c\u4f1a\u5bfc\u81f4\u9000\u51fa\u72b6\u6001\u4e3a 2\u3002\u5728\u540e\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0cpgbench \u4f1a\u6253\u5370\u90e8\u5206\u7ed3\u679c\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.8\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/13/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.10.9\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.2\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u673a\u5236\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5e76\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u5982\u4e0a\u6240\u8ff0\uff0c\u53d8\u91cf\u53ef\u4ee5\u7528\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e0b\u6587\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u901a\u8fc7<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u5148\u8bbe\u7f6e\u7684\u53d8\u91cf\u4e4b\u5916\uff0c\u8fd8\u6709\u5c11\u91cf\u53d8\u91cf\u4f1a\u88ab\u81ea\u52a8\u9884\u8bbe\uff0c\u5217\u5728<a class=\"xref\" href=\"/docs/13/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0273.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0273</a>\u4e2d\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u503c\uff0c\u5219\u4f1a\u8986\u76d6\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u4e00\u65e6\u8bbe\u7f6e\u597d\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u5728 SQL \u547d\u4ee4\u4e2d\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u6765\u63d2\u5165\u5176\u503c\u3002\u5f53\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u53d8\u91cf\u96c6\u5408\u3002<span class=\"application\">pgbench</span>\u5728\u5355\u6761\u8bed\u53e5\u4e2d\u6700\u591a\u652f\u6301 255 \u6b21\u53d8\u91cf\u4f7f\u7528\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0273.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [<em class=\"replaceable\"><code>prefix</code></em>]</code> <code class=\"literal\">\\aset [<em class=\"replaceable\"><code>prefix</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e9b\u547d\u4ee4\u53ef\u7528\u4e8e\u7ed3\u675f SQL \u67e5\u8be2\uff0c\u4ee5\u4ee3\u66ff\u7ed3\u5c3e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\gset</code>\u547d\u4ee4\u65f6\uff0c\u524d\u9762\u7684 SQL \u67e5\u8be2\u9884\u671f\u8fd4\u56de\u4e00\u884c\uff0c\u5176\u5404\u5217\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\aset</code>\u547d\u4ee4\u65f6\uff0c\u6240\u6709\u7ec4\u5408 SQL \u67e5\u8be2\uff08\u7531<code class=\"literal\">\\;</code>\u5206\u9694\uff09\u7684\u5217\u90fd\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\u4e2d\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u4e0d\u8fd4\u56de\u4efb\u4f55\u884c\uff0c\u5219\u4e0d\u4f1a\u8fdb\u884c\u8d4b\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u6765\u68c0\u6d4b\u8fd9\u79cd\u60c5\u51b5\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u591a\u884c\uff0c\u5219\u4fdd\u7559\u6700\u540e\u4e00\u4e2a\u503c\u3002</p>\n<p lang=\"zh\">\u4ee5\u4e0b\u793a\u4f8b\u5c06\u7b2c\u4e00\u4e2a\u67e5\u8be2\u7684\u6700\u7ec8\u8d26\u6237\u4f59\u989d\u5b58\u5165\u53d8\u91cf <em class=\"replaceable\"><code>abalance</code></em>\uff0c\u5e76\u5c06\u53d8\u91cf <em class=\"replaceable\"><code>p_two</code></em> \u548c <em class=\"replaceable\"><code>p_three</code></em>\u4e2d\u586b\u5165\u7b2c\u4e09\u4e2a\u67e5\u8be2\u4e2d\u7684\u6574\u6570\u3002\u7b2c\u4e8c\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002\u6700\u540e\u4e24\u4e2a\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u5b58\u5165\u53d8\u91cf<em class=\"replaceable\"><code>four</code></em> \u548c <em class=\"replaceable\"><code>five</code></em>\u3002</p>\n<pre class=\"programlisting\">UPDATE pgbench_accounts\n  SET abalance = abalance + :delta\n  WHERE aid = :aid\n  RETURNING abalance \\gset\n-- compound of two queries\nSELECT 1 \\;\nSELECT 2 AS two, 3 AS three \\gset p_\nSELECT 4 AS four \\; SELECT 5 AS five \\aset\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/13/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/13/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/13/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.18.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u8fc7\u5927\u6216\u8fc7\u5c0f\u7684\u6574\u6570\u548c\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff0c\u4ee5\u53ca\u6574\u6570\u7b97\u672f\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u548c<code class=\"literal\">/</code>\uff09\u90fd\u4f1a\u5728\u6ea2\u51fa\u65f6\u5f15\u53d1\u9519\u8bef\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/13/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0274.\u00a0pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0274</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/13/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002\u8fd9\u4e9b\u64cd\u4f5c\u7b26\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u5217\u51fa\u3002\u9664\u975e\u53e6\u6709\u8bf4\u660e\uff0c\u63a5\u53d7\u4e24\u4e2a\u6570\u5b57\u8f93\u5165\u7684\u64cd\u4f5c\u7b26\u53ea\u8981\u4efb\u4e00\u8f93\u5165\u4e3a\u53cc\u7cbe\u5ea6\uff0c\u5c31\u4f1a\u4ea7\u751f\u53cc\u7cbe\u5ea6\u7ed3\u679c\uff1b\u5426\u5219\u4ea7\u751f\u6574\u6570\u7ed3\u679c\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0274.\u00a0pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u64cd\u4f5c\u7b26</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">OR</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u6216</p>\n<p><code class=\"literal\">5 or 0</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">AND</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u4e0e</p>\n<p><code class=\"literal\">3 and 0</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">NOT</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u975e</p>\n<p><code class=\"literal\">not false</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5e03\u5c14\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 is null</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>value</code></em> <code class=\"literal\">ISNULL|NOTNULL</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7a7a\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 notnull</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 = 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;&gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">!=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 != 5</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e</p>\n<p><code class=\"literal\">5 &lt; 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;= 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e</p>\n<p><code class=\"literal\">5 &gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &gt;= 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">|</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u6216</p>\n<p><code class=\"literal\">1 | 2</code> \u2192 <code class=\"returnvalue\">3</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">#</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5f02\u6216</p>\n<p><code class=\"literal\">1 # 3</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&amp;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u4e0e</p>\n<p><code class=\"literal\">1 &amp; 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">~</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u975e</p>\n<p><code class=\"literal\">~ 1</code> \u2192 <code class=\"returnvalue\">-2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&lt;&lt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5de6\u79fb</p>\n<p><code class=\"literal\">1 &lt;&lt; 2</code> \u2192 <code class=\"returnvalue\">4</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&gt;&gt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u53f3\u79fb</p>\n<p><code class=\"literal\">8 &gt;&gt; 2</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">+</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u52a0\u6cd5</p>\n<p><code class=\"literal\">5 + 4</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u51cf\u6cd5</p>\n<p><code class=\"literal\">3 - 2.0</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">*</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u4e58\u6cd5</p>\n<p><code class=\"literal\">5 * 4</code> \u2192 <code class=\"returnvalue\">20</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">/</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u9664\u6cd5\uff08\u5982\u679c\u4e24\u4e2a\u8f93\u5165\u90fd\u662f\u6574\u6570\uff0c\u5219\u5c06\u7ed3\u679c\u5411\u96f6\u622a\u65ad\uff09</p>\n<p><code class=\"literal\">5 / 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">%</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">3 % 2</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u53d6\u76f8\u53cd\u6570</p>\n<p><code class=\"literal\">- 2.0</code> \u2192 <code class=\"returnvalue\">-2.0</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/13/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0275.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0275</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/13/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0275.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u51fd\u6570</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">abs</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u7edd\u5bf9\u503c</p>\n<p><code class=\"literal\">abs(-17)</code> \u2192 <code class=\"returnvalue\">17</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">debug</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u5c06\u53c2\u6570\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de\u53c2\u6570\u3002</p>\n<p><code class=\"literal\">debug(5432.1)</code> \u2192 <code class=\"returnvalue\">5432.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">double</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u8f6c\u6362\u4e3a double\u3002</p>\n<p><code class=\"literal\">double(5432)</code> \u2192 <code class=\"returnvalue\">5432.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">exp</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u6307\u6570\u51fd\u6570\uff08<code class=\"literal\">e</code> \u7684\u7ed9\u5b9a\u6b21\u5e42\uff09</p>\n<p><code class=\"literal\">exp(1.0)</code> \u2192 <code class=\"returnvalue\">2.718281828459045</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">greatest</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c\u3002</p>\n<p><code class=\"literal\">greatest(5, 4, 3, 2)</code> \u2192 <code class=\"returnvalue\">5</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8fd9\u662f <code class=\"function\">hash_murmur2</code> \u7684\u522b\u540d\u3002</p>\n<p><code class=\"literal\">hash(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_fnv1a</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\" target=\"_top\">FNV-1a hash</a>\u3002</p>\n<p><code class=\"literal\">hash_fnv1a(10, 5432)</code> \u2192 <code class=\"returnvalue\">-7793829335365542153</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_murmur2</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/MurmurHash\" target=\"_top\">MurmurHash2 hash</a>\u3002</p>\n<p><code class=\"literal\">hash_murmur2(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">int</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8f6c\u6362\u4e3a integer\u3002</p>\n<p><code class=\"literal\">int(5.4 + 3.8)</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">least</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c\u3002</p>\n<p><code class=\"literal\">least(5, 4, 3, 2.1)</code> \u2192 <code class=\"returnvalue\">2.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">ln</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u81ea\u7136\u5bf9\u6570</p>\n<p><code class=\"literal\">ln(2.718281828459045)</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">mod</code> ( <em class=\"replaceable\"><code>integer</code></em>, <em class=\"replaceable\"><code>integer</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">mod(54, 32)</code> \u2192 <code class=\"returnvalue\">22</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pi</code> () \u2192 <code class=\"returnvalue\">double</code></p>\n<p><span class=\"symbol_font\">\u03c0</span>\u7684\u8fd1\u4f3c\u503c</p>\n<p><code class=\"literal\">pi()</code> \u2192 <code class=\"returnvalue\">3.14159265358979323846</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pow</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p class=\"func_signature\"><code class=\"function\">power</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p><em class=\"parameter\"><code>x</code></em> \u7684 <em class=\"parameter\"><code>y</code></em> \u6b21\u5e42</p>\n<p><code class=\"literal\">pow(2.0, 10)</code> \u2192 <code class=\"returnvalue\">1024.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u5747\u5300\u5206\u5e03\u968f\u673a\u6574\u6570\u3002</p>\n<p><code class=\"literal\">random(1, 10)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_exponential</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u6307\u6570\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_exponential(1, 10, 3.0)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_gaussian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u9ad8\u65af\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_gaussian(1, 10, 2.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_zipfian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684 Zipfian \u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_zipfian(1, 10, 1.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">sqrt</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u5e73\u65b9\u6839</p>\n<p><code class=\"literal\">sqrt(2.0)</code> \u2192 <code class=\"returnvalue\">1.414213562</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002parameter \u5141\u8bb8\u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n<p lang=\"zh\">pgbench \u7684\u5b9e\u73b0\u57fa\u4e8e Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002\u7531\u4e8e\u8be5\u7b97\u6cd5\u7684\u9650\u5236\uff0cparameter \u7684\u53d6\u503c\u9650\u5236\u5728 [1.001, 1000] \u8303\u56f4\u5185\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570 <code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code> \u548c <code class=\"literal\">hash_fnv1a</code> \u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u672a\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f7f\u7528 <code class=\"literal\">:default_seed</code> \u7684\u503c\uff0c\u8be5\u503c\u968f\u673a\u521d\u59cb\u5316\uff0c\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c <code class=\"literal\">-D</code> \u9009\u9879\u8bbe\u7f6e\u3002Hash \u51fd\u6570\u53ef\u4ee5\u7528\u6765\u6253\u6563\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f8b\u5982 <code class=\"literal\">random_zipfian</code> \u6216 <code class=\"literal\">random_exponential</code>\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e2d\u53ef\u80fd\u51fa\u73b0\u7684\u5178\u578b\u771f\u5b9e\u5de5\u4f5c\u8d1f\u8f7d\uff0c\u5176\u4e2d\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u4e86\u8fc7\u591a\u7684\u8d1f\u8f7d\uff1a</p>\n<pre class=\"programlisting\">\\set r random_zipfian(0, 100000000, 1.07)\n\\set k abs(hash(:r)) % 1000000\n</pre>\n<p lang=\"zh\">\u67d0\u4e9b\u60c5\u51b5\u4e0b\u9700\u8981\u51e0\u4e2a\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u9690\u5f0f\u79cd\u5b50\u53c2\u6570\u5c31\u80fd\u6d3e\u4e0a\u7528\u573a\uff1a</p>\n<pre class=\"programlisting\">\\set k1 abs(hash(:r, :default_seed + 123)) % 1000000\n\\set k2 abs(hash(:r, :default_seed + 321)) % 1000000\n</pre>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u683c\u5f0f\u5982\u4e0b\uff1a</p>\n<pre class=\"synopsis\"><em class=\"replaceable\"><code>client_id</code></em> <em class=\"replaceable\"><code>transaction_no</code></em> <em class=\"replaceable\"><code>time</code></em> <em class=\"replaceable\"><code>script_no</code></em> <em class=\"replaceable\"><code>time_epoch</code></em> <em class=\"replaceable\"><code>time_us</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>schedule_lag</code></em> </span>]\n</pre>\n<p lang=\"zh\">\u5176\u4e2d\uff0c<em class=\"replaceable\"><code>client_id</code></em> \u8868\u793a\u8fd0\u884c\u8be5\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd\uff0c<em class=\"replaceable\"><code>transaction_no</code></em> \u8bb0\u5f55\u8be5\u4f1a\u8bdd\u5df2\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\uff0c<em class=\"replaceable\"><code>time</code></em> \u662f\u4e8b\u52a1\u7ecf\u8fc7\u7684\u603b\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff0c<em class=\"replaceable\"><code>script_no</code></em> \u6807\u8bc6\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5728\u901a\u8fc7 <code class=\"option\">-f</code> \u6216 <code class=\"option\">-b</code> \u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09\uff0c\u800c <em class=\"replaceable\"><code>time_epoch</code></em>/<em class=\"replaceable\"><code>time_us</code></em> \u5206\u522b\u662f Unix \u7eaa\u5143\u65f6\u95f4\u6233\u548c\u4ee5\u5fae\u79d2\u8ba1\u7684\u504f\u79fb\u91cf\uff08\u9002\u5408\u7528\u6765\u751f\u6210\u5e26\u5c0f\u6570\u79d2\u7684 ISO 8601 \u65f6\u95f4\u6233\uff09\uff0c\u8868\u793a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002<em class=\"replaceable\"><code>schedule_lag</code></em> \u5b57\u6bb5\u662f\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\u3002\u5b83\u4ec5\u5728\u4f7f\u7528 <code class=\"option\">--rate</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5982\u679c\u540c\u65f6\u4f7f\u7528 <code class=\"option\">--rate</code> \u548c <code class=\"option\">--latency-limit</code>\uff0c\u5219\u88ab\u8df3\u8fc7\u4e8b\u52a1\u7684 <em class=\"replaceable\"><code>time</code></em> \u5c06\u62a5\u544a\u4e3a <code class=\"literal\">skipped</code>\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--aggregate-interval</code> \u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u91c7\u7528\u53e6\u4e00\u79cd\u683c\u5f0f\uff1a</p>\n<pre class=\"synopsis\"><em class=\"replaceable\"><code>interval_start</code></em> <em class=\"replaceable\"><code>num_transactions</code></em>\u200b <em class=\"replaceable\"><code>sum_latency</code></em> <em class=\"replaceable\"><code>sum_latency_2</code></em> <em class=\"replaceable\"><code>min_latency</code></em> <em class=\"replaceable\"><code>max_latency</code></em>\u200b [<span class=\"optional\"> <em class=\"replaceable\"><code>sum_lag</code></em> <em class=\"replaceable\"><code>sum_lag_2</code></em> <em class=\"replaceable\"><code>min_lag</code></em> <em class=\"replaceable\"><code>max_lag</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>skipped</code></em> </span>] </span>]\n</pre>\n<p lang=\"zh\">\u5176\u4e2d\uff0c<em class=\"replaceable\"><code>interval_start</code></em> \u662f\u65f6\u95f4\u533a\u95f4\u7684\u5f00\u59cb\u65f6\u95f4\uff08\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a\uff09\uff0c<em class=\"replaceable\"><code>num_transactions</code></em> \u662f\u533a\u95f4\u5185\u7684\u4e8b\u52a1\u6570\uff0c<em class=\"replaceable\"><code>sum_latency</code></em> \u662f\u533a\u95f4\u5185\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c\uff0c<em class=\"replaceable\"><code>sum_latency_2</code></em> \u662f\u533a\u95f4\u5185\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff0c<em class=\"replaceable\"><code>min_latency</code></em> \u662f\u533a\u95f4\u5185\u7684\u6700\u5c0f\u5ef6\u8fdf\uff0c\u800c <em class=\"replaceable\"><code>max_latency</code></em> \u662f\u533a\u95f4\u5185\u7684\u6700\u5927\u5ef6\u8fdf\u3002\u63a5\u4e0b\u6765\u7684\u5b57\u6bb5 <em class=\"replaceable\"><code>sum_lag</code></em>\u3001<em class=\"replaceable\"><code>sum_lag_2</code></em>\u3001<em class=\"replaceable\"><code>min_lag</code></em> \u548c <em class=\"replaceable\"><code>max_lag</code></em> \u4ec5\u5728\u4f7f\u7528 <code class=\"option\">--rate</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5b83\u4eec\u63d0\u4f9b\u5404\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u7edf\u8ba1\uff0c\u5373\u5404\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\u3002\u6700\u540e\u4e00\u4e2a\u5b57\u6bb5 <em class=\"replaceable\"><code>skipped</code></em> \u4ec5\u5728\u8fd8\u4f7f\u7528 <code class=\"option\">--latency-limit</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5b83\u8bb0\u5f55\u56e0\u5f00\u59cb\u65f6\u95f4\u8fc7\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\u3002\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8ba1\u5165\u5176\u63d0\u4ea4\u65f6\u6240\u5728\u7684\u65f6\u95f4\u533a\u95f4\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e9b\u8f93\u51fa\u793a\u4f8b\uff1a</p>\n<pre class=\"screen\">1345828501 5601 1542744 483552416 61 2573\n1345828503 7884 1979812 565806736 60 1479\n1345828505 7208 1979422 567277552 59 1391\n1345828507 7685 1980268 569784714 60 1398\n1345828509 7073 1979779 573489941 236 1411\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u5ef6\u8fdf</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\u65f6\uff0c<span class=\"application\">pgbench</span>\u4f1a\u6536\u96c6\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u6240\u7ecf\u8fc7\u7684\u4e8b\u52a1\u65f6\u95f4\u3002\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u5b83\u4f1a\u62a5\u544a\u8fd9\u4e9b\u503c\u7684\u5e73\u5747\u503c\uff0c\u79f0\u4e3a\u6bcf\u6761\u8bed\u53e5\u7684\u5ef6\u8fdf\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u4e0e\u4e0b\u9762\u7c7b\u4f3c\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nlatency average = 15.844 ms\nlatency stddev = 2.715 ms\ntps = 618.764555 (including connections establishing)\ntps = 622.977698 (excluding connections establishing)\nstatement latencies in milliseconds:\n        0.002  \\set aid random(1, 100000 * :scale)\n        0.005  \\set bid random(1, 1 * :scale)\n        0.002  \\set tid random(1, 10 * :scale)\n        0.001  \\set delta random(-5000, 5000)\n        0.326  BEGIN;\n        0.603  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n        0.454  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n        5.528  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n        7.335  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n        0.371  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n        1.212  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u5e73\u5747\u503c\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.9\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.10.9.10\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/13/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.9.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/13/pgbench.html", "method": "same-major semantic node", "sha256": "554c2d50004b7add254e2408a93014ba3ab249f26759f32aadb7815038a1ddbc", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/h2[0]", "#PGBENCH/div[7]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[7]/h2[0]", "#PGBENCH/div[7]/p[2]", "#PGBENCH/div[7]/p[3]", "#PGBENCH/div[8]/div[1]/h3[0]", "#PGBENCH/div[8]/div[1]/h3[0]/span[1]", "#PGBENCH/div[8]/div[1]/p[1]", "#PGBENCH/div[8]/div[1]/p[2]", "#PGBENCH/div[8]/div[1]/p[4]", "#PGBENCH/div[8]/div[1]/p[5]", "#PGBENCH/div[8]/div[2]/div[3]/h3[0]", "#PGBENCH/div[8]/div[2]/div[3]/p[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[5]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[1]", "#PGBENCH/div[8]/div[2]/h3[0]", "#PGBENCH/div[8]/div[2]/p[1]", "#PGBENCH/div[8]/div[2]/p[2]", "#PGBENCH/div[8]/div[2]/p[4]", "#PGBENCH/div[8]/div[2]/p[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[3]/div[2]/p[0]", "#PGBENCH/div[8]/div[3]/h3[0]", "#PGBENCH/div[8]/div[3]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[18]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[4]/div[2]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[8]/div[4]/h3[0]", "#PGBENCH/div[8]/div[4]/p[10]", "#PGBENCH/div[8]/div[4]/p[12]", "#PGBENCH/div[8]/div[4]/p[1]", "#PGBENCH/div[8]/div[4]/p[4]", "#PGBENCH/div[8]/div[4]/p[6]", "#PGBENCH/div[8]/div[4]/p[8]", "#PGBENCH/div[8]/div[5]/h3[0]", "#PGBENCH/div[8]/div[5]/p[10]", "#PGBENCH/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[5]/p[4]", "#PGBENCH/div[8]/div[5]/p[5]", "#PGBENCH/div[8]/div[5]/p[7]", "#PGBENCH/div[8]/div[5]/p[9]", "#PGBENCH/div[8]/div[6]/h3[0]", "#PGBENCH/div[8]/div[6]/p[1]", "#PGBENCH/div[8]/div[6]/p[3]", "#PGBENCH/div[8]/div[6]/p[4]", "#PGBENCH/div[8]/div[6]/p[6]", "#PGBENCH/div[8]/div[7]/h3[0]", "#PGBENCH/div[8]/div[7]/p[1]", "#PGBENCH/div[8]/div[7]/p[2]", "#PGBENCH/div[8]/div[7]/p[4]", "#PGBENCH/div[8]/div[7]/p[5]", "#PGBENCH/div[8]/div[8]/h3[0]", "#PGBENCH/div[8]/div[8]/p[1]", "#PGBENCH/div[8]/div[8]/p[2]", "#PGBENCH/div[8]/div[8]/p[4]", "#PGBENCH/div[8]/div[8]/p[5]", "#PGBENCH/div[8]/div[9]/h3[0]", "#PGBENCH/div[8]/div[9]/p[1]", "#PGBENCH/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/13/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/13/facts/0/label": "Documented executable", "/versions/13/facts/0/value": "pgbench", "/versions/13/facts/1/label": "Executable version", "/versions/13/facts/2/label": "Reference inventory", "/versions/13/facts/2/value": "Client applications", "/versions/13/facts/3/label": "Option definition groups", "/versions/13/tables/0/title": "Documented options", "/versions/13/tables/1/title": "Environment variables", "/versions/13/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/13/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/13/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/13/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/13/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/13/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/13/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/13/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/13/tables/0/rows/8/summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "/versions/13/tables/0/rows/9/summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "/versions/13/tables/0/columns/0/label": "Option and arguments", "/versions/13/tables/0/columns/1/label": "Description", "/versions/13/tables/0/rows/10/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/13/tables/0/rows/11/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/13/tables/0/rows/12/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/13/tables/0/rows/13/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/13/tables/0/rows/14/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/13/tables/0/rows/15/summary": "Print debugging output.", "/versions/13/tables/0/rows/16/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/13/tables/0/rows/17/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/13/tables/0/rows/18/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/13/tables/0/rows/19/summary": "Write information about each transaction to a log file. See below for details.", "/versions/13/tables/0/rows/20/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/13/tables/0/rows/21/summary": "Protocol to use for submitting queries to the server:", "/versions/13/tables/0/rows/22/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/13/tables/0/rows/23/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/13/tables/0/rows/24/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time.", "/versions/13/tables/0/rows/25/summary": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details.", "/versions/13/tables/0/rows/26/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/13/tables/0/rows/27/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/13/tables/0/rows/28/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/13/tables/0/rows/29/summary": "Number of transactions each client runs. Default is 10.", "/versions/13/tables/0/rows/30/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/13/tables/0/rows/31/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/13/tables/0/rows/32/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/13/tables/0/rows/33/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/13/tables/0/rows/34/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/13/tables/0/rows/35/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/13/tables/0/rows/36/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/13/tables/0/rows/37/summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "/versions/13/tables/0/rows/38/summary": "The database server's host name", "/versions/13/tables/0/rows/39/summary": "The database server's port number", "/versions/13/tables/0/rows/40/summary": "The user name to connect as", "/versions/13/tables/0/rows/41/summary": "Print the pgbench version and exit.", "/versions/13/tables/0/rows/42/summary": "Show help about pgbench command line arguments, and exit.", "/versions/13/tables/1/columns/0/label": "Variable", "/versions/13/tables/1/columns/1/label": "Meaning", "/versions/13/tables/1/rows/0/description": "Default connection parameters."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "c81df764115051812f5ed5d62c10eadbde9e081bf209032ec626c9ff2d5a7f18"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . Using g causes logging to print one message every 100,000 rows while generating data for the pgbench_accounts table. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "signature": "--partition-method= NAME", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "signature": "--partitions= NUM", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "signature": "-d --debug", "description": "Print debugging output."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped ."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 52 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time."}, {"names": ["-r", "--report-latencies"], "signature": "-r --report-latencies", "description": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= seed", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "signature": "--show-script= scriptname", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}]}, "comparison_hash": "b178cb99434a3cb2ea359a024ad42da677b3d61dcef4d201e20543b721360535", "manual_language": "zh"}, "14": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "14.24"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "43"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u9009\u5b9a\u7684\u5e38\u89c4\u521d\u59cb\u5316\u6b65\u9aa4\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/14/pgbench.html", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/14/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/14/pgbench.html", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--partition-method= NAME"}}, {"summary": "\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--partitions= NUM"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-C --connect"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-d --debug"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/14/pgbench.html", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\uff0c\u4ee5\u53ca\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-P sec --progress= sec"}}, {"summary": "\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u62a5\u544a\u6bcf\u6761\u547d\u4ee4\u7684\u5e73\u5747\u8bed\u53e5\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89c6\u89d2\u770b\u5230\u7684\u6267\u884c\u65f6\u95f4\uff09\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-r --report-latencies"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--aggregate-interval= seconds"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--log-prefix= prefix"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 seed \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 seed \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--random-seed= seed"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--sampling-rate= rate"}}, {"summary": "\u5c06\u5185\u7f6e\u811a\u672c scriptname \u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "--show-script= scriptname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/14/pgbench.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/14/pgbench.html", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/14/pgbench.html", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . Using g causes logging to print one message every 100,000 rows while generating data for the pgbench_accounts table. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/14/pgbench.html", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/14/pgbench.html", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/14/pgbench.html", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/14/pgbench.html", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/14/pgbench.html", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/14/pgbench.html", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "signature": "--partition-method= NAME", "source_url": "/docs/14/pgbench.html", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "signature": "--partitions= NUM", "source_url": "/docs/14/pgbench.html", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/14/pgbench.html", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/14/pgbench.html", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/14/pgbench.html", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/14/pgbench.html", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/14/pgbench.html", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "summary": "Print debugging output.", "signature": "-d --debug", "source_url": "/docs/14/pgbench.html", "description": "Print debugging output."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/14/pgbench.html", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/14/pgbench.html", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/14/pgbench.html", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/14/pgbench.html", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/14/pgbench.html", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped ."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/14/pgbench.html", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 53 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/14/pgbench.html", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/14/pgbench.html", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time.", "signature": "-P sec --progress= sec", "source_url": "/docs/14/pgbench.html", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time."}, {"names": ["-r", "--report-latencies"], "summary": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details.", "signature": "-r --report-latencies", "source_url": "/docs/14/pgbench.html", "description": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/14/pgbench.html", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/14/pgbench.html", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/14/pgbench.html", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/14/pgbench.html", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/14/pgbench.html", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/14/pgbench.html", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/14/pgbench.html", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/14/pgbench.html", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/14/pgbench.html", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= seed", "source_url": "/docs/14/pgbench.html", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/14/pgbench.html", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "signature": "--show-script= scriptname", "source_url": "/docs/14/pgbench.html", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/14/pgbench.html", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/14/pgbench.html", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/14/pgbench.html", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/14/pgbench.html", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/14/pgbench.html", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "label": "14.24", "major": "14", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/14/postgresql-14-A4.pdf", "bytes": 14354704, "pages": 2944, "sha256": "8bc6b9dd7b246888bb77f0a5e8c39a2eae52e9926569832669c7d1600becb27c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/14/postgresql-14-US.pdf", "bytes": 14242178, "pages": 3102, "sha256": "b7ecb5a5f62d8b9f73a69e25a7d26ba285373bc53168a553bff7b77955506db4", "built_at": "2026-09-26"}}, "tree": "14", "index": "index.html", "major": "14", "pages": 1158, "release": "14.24", "source_url": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "revision": "588700d46356d8837c77c7c0a4e71e645fe6535983b8f1830aa8f2e4e41c40ae", "evidence_kind": "English manual and source declarations", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "sources": [{"url": "https://pg.center/docs/14/pgbench.html", "file": "pgbench.html", "label": "14.24 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "4640cc0ce24f410674e8062f0962d2cd0f7b0954d1746f77cd6605e506722721", "language": "en", "original_url": "/docs/14/pgbench.html"}, {"url": "https://pg.center/docs/14/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "5a13567a052954dfe494dfaab9f50919faa1ae56023930fdbb78d45e53feccde", "language": "en", "original_url": "/docs/14/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u5178\u578b\u7684<span class=\"application\">pgbench</span>\u8f93\u51fa\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nlatency average = 11.013 ms\nlatency stddev = 7.351 ms\ninitial connection time = 45.758 ms\ntps = 896.967014 (without initial connection time)\n</pre>\n<p lang=\"zh\">\u524d\u516d\u884c\u7ed9\u51fa\u4e86\u82e5\u5e72\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u4e0b\u4e00\u884c\u62a5\u544a\u5b9e\u9645\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u4e8b\u52a1\u6570\uff08\u540e\u8005\u4ec5\u4e3a\u5ba2\u6237\u7aef\u6570\u91cf\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u5426\u5219\u4e24\u8005\u5e94\u5f53\u76f8\u7b49\u3002\uff08\u5728<code class=\"option\">-T</code>\u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u4e8b\u52a1\u6570\u3002\uff09\u6700\u540e\u4e00\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>dbname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u5219\u4f7f\u7528\u8fde\u63a5\u6307\u5b9a\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u9009\u5b9a\u7684\u5e38\u89c4\u521d\u59cb\u5316\u6b65\u9aa4\u3002<em class=\"replaceable\"><code>init_steps</code></em> \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\u6216<code class=\"literal\">G</code>\uff08\u5728\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">g</code>\uff08\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c\u6570\u636e\u7531<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u751f\u6210\uff0c\u518d\u901a\u8fc7<code class=\"command\">COPY</code>\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4f1a\u5927\u91cf\u5360\u7528\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u5e26\u5bbd\u3002\u4f7f\u7528<code class=\"literal\">g</code>\u65f6\uff0c\u5728\u4e3a<code class=\"structname\">pgbench_accounts</code>\u8868\u751f\u6210\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6bcf\u751f\u6210 100,000 \u884c\u4f1a\u8f93\u51fa\u4e00\u6761\u65e5\u5fd7\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">G</code>\uff08\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u53ea\u53d1\u9001\u8f83\u5c0f\u7684\u67e5\u8be2\uff0c\u968f\u540e\u5b9e\u9645\u6570\u636e\u5728\u670d\u52a1\u5668\u7aef\u751f\u6210\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u9700\u8981\u5927\u91cf\u5e26\u5bbd\uff0c\u4f46\u670d\u52a1\u5668\u4f1a\u627f\u62c5\u66f4\u591a\u5de5\u4f5c\u3002\u4f7f\u7528<code class=\"literal\">G</code>\u65f6\uff0c\u751f\u6210\u6570\u636e\u671f\u95f4\u4e0d\u4f1a\u6253\u5370\u4efb\u4f55\u8fdb\u5ea6\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u521d\u59cb\u5316\u884c\u4e3a\u4f7f\u7528\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff08\u7b49\u540c\u4e8e<code class=\"literal\">g</code>\uff09\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n<p lang=\"zh\">\u5982\u679c -I \u4e2d\u6307\u5b9a\u4e86 G\uff0c\u6b64\u8bbe\u7f6e\u4e0d\u751f\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--foreign-keys</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--partition-method=<em class=\"replaceable\"><code>NAME</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--partitions=<em class=\"replaceable\"><code>NUM</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d</code><br/></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span></dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5728<code class=\"literal\">prepared</code>\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pgbench</span> \u4ece\u7b2c\u4e8c\u6b21\u67e5\u8be2\u8fed\u4ee3\u5f00\u59cb\u590d\u7528\u89e3\u6790\u5206\u6790\u7ed3\u679c\uff0c\u56e0\u6b64<span class=\"application\">pgbench</span> \u6bd4\u5176\u4ed6\u6a21\u5f0f\u8fd0\u884c\u5f97\u66f4\u5feb\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u503c\u662f\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/14/protocol.html\" title=\"\u7b2c\u00a053\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a053\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\uff0c\u4ee5\u53ca\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-latencies</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u62a5\u544a\u6bcf\u6761\u547d\u4ee4\u7684\u5e73\u5747\u8bed\u53e5\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89c6\u89d2\u770b\u5230\u7684\u6267\u884c\u65f6\u95f4\uff09\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>seed</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>seed</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>seed</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--show-script=</code><em class=\"replaceable\"><code>scriptname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5185\u7f6e\u811a\u672c<em class=\"replaceable\"><code>scriptname</code></em>\u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u8fd8\u63a5\u53d7\u4ee5\u4e0b\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u901a\u7528\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u6210\u529f\u8fd0\u884c\u65f6\u9000\u51fa\u72b6\u6001\u4e3a 0\u3002\u9000\u51fa\u72b6\u6001 1 \u8868\u793a\u9759\u6001\u95ee\u9898\uff0c\u4f8b\u5982\u65e0\u6548\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002\u8fd0\u884c\u671f\u95f4\u7684\u9519\u8bef\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u9519\u8bef\u6216\u811a\u672c\u95ee\u9898\uff0c\u4f1a\u5bfc\u81f4\u9000\u51fa\u72b6\u6001\u4e3a 2\u3002\u5728\u540e\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0cpgbench \u4f1a\u6253\u5370\u90e8\u5206\u7ed3\u679c\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.8\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/14/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.9\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.2\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u673a\u5236\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5e76\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u5982\u4e0a\u6240\u8ff0\uff0c\u53d8\u91cf\u53ef\u4ee5\u7528\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e0b\u6587\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u901a\u8fc7<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u5148\u8bbe\u7f6e\u7684\u53d8\u91cf\u4e4b\u5916\uff0c\u8fd8\u6709\u5c11\u91cf\u53d8\u91cf\u4f1a\u88ab\u81ea\u52a8\u9884\u8bbe\uff0c\u5217\u5728<a class=\"xref\" href=\"/docs/14/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0282.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0282</a>\u4e2d\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u503c\uff0c\u5219\u4f1a\u8986\u76d6\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u4e00\u65e6\u8bbe\u7f6e\u597d\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u5728 SQL \u547d\u4ee4\u4e2d\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u6765\u63d2\u5165\u5176\u503c\u3002\u5f53\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u53d8\u91cf\u96c6\u5408\u3002<span class=\"application\">pgbench</span>\u5728\u5355\u6761\u8bed\u53e5\u4e2d\u6700\u591a\u652f\u6301 255 \u6b21\u53d8\u91cf\u4f7f\u7528\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0282.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u548c\u4f2a\u968f\u673a\u7f6e\u6362\u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [<em class=\"replaceable\"><code>prefix</code></em>]</code> <code class=\"literal\">\\aset [<em class=\"replaceable\"><code>prefix</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e9b\u547d\u4ee4\u53ef\u7528\u4e8e\u7ed3\u675f SQL \u67e5\u8be2\uff0c\u4ee5\u4ee3\u66ff\u7ed3\u5c3e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\gset</code>\u547d\u4ee4\u65f6\uff0c\u524d\u9762\u7684 SQL \u67e5\u8be2\u9884\u671f\u8fd4\u56de\u4e00\u884c\uff0c\u5176\u5404\u5217\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\aset</code>\u547d\u4ee4\u65f6\uff0c\u6240\u6709\u7ec4\u5408 SQL \u67e5\u8be2\uff08\u7531<code class=\"literal\">\\;</code>\u5206\u9694\uff09\u7684\u5217\u90fd\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\u4e2d\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u4e0d\u8fd4\u56de\u4efb\u4f55\u884c\uff0c\u5219\u4e0d\u4f1a\u8fdb\u884c\u8d4b\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u6765\u68c0\u6d4b\u8fd9\u79cd\u60c5\u51b5\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u591a\u884c\uff0c\u5219\u4fdd\u7559\u6700\u540e\u4e00\u4e2a\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\gset</code> \u548c <code class=\"literal\">\\aset</code> \u4e0d\u80fd\u7528\u5728\u7ba1\u9053\u6a21\u5f0f\uff0c\u56e0\u4e3a\u5728\u547d\u4ee4\u9700\u8981\u5b83\u4eec\u7684\u65f6\u5019\uff0c\u67e5\u8be2\u7ed3\u679c\u8fd8\u4e0d\u53ef\u7528\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u7684\u793a\u4f8b\u5c06\u7b2c\u4e00\u4e2a\u67e5\u8be2\u4e2d\u7684\u6700\u7ec8\u8d26\u6237\u4f59\u989d\u653e\u5165\u53d8\u91cf<em class=\"replaceable\"><code>abalance</code></em>\uff0c\u5e76\u7528\u7b2c\u4e09\u4e2a\u67e5\u8be2\u4e2d\u7684\u6574\u6570\u586b\u5145\u53d8\u91cf<em class=\"replaceable\"><code>p_two</code></em>\u548c<em class=\"replaceable\"><code>p_three</code></em>\u3002\u7b2c\u4e8c\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002\u6700\u540e\u4e24\u4e2a\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u5b58\u5165\u53d8\u91cf<em class=\"replaceable\"><code>four</code></em>\u548c<em class=\"replaceable\"><code>five</code></em>\u3002</p>\n<pre class=\"programlisting\">UPDATE pgbench_accounts\n  SET abalance = abalance + :delta\n  WHERE aid = :aid\n  RETURNING abalance \\gset\n-- compound of two queries\nSELECT 1 \\;\nSELECT 2 AS two, 3 AS three \\gset p_\nSELECT 4 AS four \\; SELECT 5 AS five \\aset\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/14/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/14/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/14/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.18.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u8fc7\u5927\u6216\u8fc7\u5c0f\u7684\u6574\u6570\u548c\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff0c\u4ee5\u53ca\u6574\u6570\u7b97\u672f\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u548c<code class=\"literal\">/</code>\uff09\u90fd\u4f1a\u5728\u6ea2\u51fa\u65f6\u5f15\u53d1\u9519\u8bef\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u547d\u4ee4\u754c\u5b9a SQL \u8bed\u53e5\u7ba1\u9053\u7684\u5f00\u59cb\u548c\u7ed3\u675f\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u4e00\u6761\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/14/libpq-pipeline-mode.html\" title=\"34.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a034.5\u00a0\u8282</a>\u3002\u7ba1\u9053\u6a21\u5f0f\u8981\u6c42\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/14/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0283.\u00a0pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0283</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/14/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002\u8fd9\u4e9b\u64cd\u4f5c\u7b26\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u5217\u51fa\u3002\u9664\u975e\u53e6\u6709\u8bf4\u660e\uff0c\u63a5\u53d7\u4e24\u4e2a\u6570\u5b57\u8f93\u5165\u7684\u64cd\u4f5c\u7b26\u53ea\u8981\u4efb\u4e00\u8f93\u5165\u4e3a\u53cc\u7cbe\u5ea6\uff0c\u5c31\u4f1a\u4ea7\u751f\u53cc\u7cbe\u5ea6\u7ed3\u679c\uff1b\u5426\u5219\u4ea7\u751f\u6574\u6570\u7ed3\u679c\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0283.\u00a0pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u64cd\u4f5c\u7b26</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">OR</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u6216</p>\n<p><code class=\"literal\">5 or 0</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">AND</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u4e0e</p>\n<p><code class=\"literal\">3 and 0</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">NOT</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u975e</p>\n<p><code class=\"literal\">not false</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5e03\u5c14\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 is null</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>value</code></em> <code class=\"literal\">ISNULL|NOTNULL</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7a7a\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 notnull</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 = 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;&gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">!=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 != 5</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e</p>\n<p><code class=\"literal\">5 &lt; 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;= 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e</p>\n<p><code class=\"literal\">5 &gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &gt;= 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">|</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u6216</p>\n<p><code class=\"literal\">1 | 2</code> \u2192 <code class=\"returnvalue\">3</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">#</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5f02\u6216</p>\n<p><code class=\"literal\">1 # 3</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&amp;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u4e0e</p>\n<p><code class=\"literal\">1 &amp; 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">~</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u975e</p>\n<p><code class=\"literal\">~ 1</code> \u2192 <code class=\"returnvalue\">-2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&lt;&lt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5de6\u79fb</p>\n<p><code class=\"literal\">1 &lt;&lt; 2</code> \u2192 <code class=\"returnvalue\">4</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&gt;&gt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u53f3\u79fb</p>\n<p><code class=\"literal\">8 &gt;&gt; 2</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">+</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u52a0\u6cd5</p>\n<p><code class=\"literal\">5 + 4</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u51cf\u6cd5</p>\n<p><code class=\"literal\">3 - 2.0</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">*</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u4e58\u6cd5</p>\n<p><code class=\"literal\">5 * 4</code> \u2192 <code class=\"returnvalue\">20</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">/</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u9664\u6cd5\uff08\u5982\u679c\u4e24\u4e2a\u8f93\u5165\u90fd\u662f\u6574\u6570\uff0c\u5219\u5c06\u7ed3\u679c\u5411\u96f6\u622a\u65ad\uff09</p>\n<p><code class=\"literal\">5 / 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">%</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">3 % 2</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u53d6\u76f8\u53cd\u6570</p>\n<p><code class=\"literal\">- 2.0</code> \u2192 <code class=\"returnvalue\">-2.0</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/14/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0284.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0284</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/14/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0284.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u51fd\u6570</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">abs</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u7edd\u5bf9\u503c</p>\n<p><code class=\"literal\">abs(-17)</code> \u2192 <code class=\"returnvalue\">17</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">debug</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u5c06\u53c2\u6570\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de\u53c2\u6570\u3002</p>\n<p><code class=\"literal\">debug(5432.1)</code> \u2192 <code class=\"returnvalue\">5432.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">double</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u8f6c\u6362\u4e3a double\u3002</p>\n<p><code class=\"literal\">double(5432)</code> \u2192 <code class=\"returnvalue\">5432.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">exp</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u6307\u6570\u51fd\u6570\uff08<code class=\"literal\">e</code> \u7684\u7ed9\u5b9a\u6b21\u5e42\uff09</p>\n<p><code class=\"literal\">exp(1.0)</code> \u2192 <code class=\"returnvalue\">2.718281828459045</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">greatest</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c\u3002</p>\n<p><code class=\"literal\">greatest(5, 4, 3, 2)</code> \u2192 <code class=\"returnvalue\">5</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8fd9\u662f <code class=\"function\">hash_murmur2</code> \u7684\u522b\u540d\u3002</p>\n<p><code class=\"literal\">hash(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_fnv1a</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\" target=\"_top\">FNV-1a hash</a>\u3002</p>\n<p><code class=\"literal\">hash_fnv1a(10, 5432)</code> \u2192 <code class=\"returnvalue\">-7793829335365542153</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_murmur2</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/MurmurHash\" target=\"_top\">MurmurHash2 hash</a>\u3002</p>\n<p><code class=\"literal\">hash_murmur2(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">int</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8f6c\u6362\u4e3a integer\u3002</p>\n<p><code class=\"literal\">int(5.4 + 3.8)</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">least</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c\u3002</p>\n<p><code class=\"literal\">least(5, 4, 3, 2.1)</code> \u2192 <code class=\"returnvalue\">2.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">ln</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u81ea\u7136\u5bf9\u6570</p>\n<p><code class=\"literal\">ln(2.718281828459045)</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">mod</code> ( <em class=\"replaceable\"><code>integer</code></em>, <em class=\"replaceable\"><code>integer</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">mod(54, 32)</code> \u2192 <code class=\"returnvalue\">22</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">permute</code> ( <em class=\"parameter\"><code>i</code></em>, <em class=\"parameter\"><code>size</code></em> [, <em class=\"parameter\"><code>seed</code></em> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\"><em class=\"parameter\"><code>i</code></em>\u7684\u7f6e\u6362\u503c\uff0c\u8303\u56f4\u5728<code class=\"literal\">[0, size)</code>\u5185\u3002\u5b83\u8868\u793a<em class=\"parameter\"><code>i</code></em>\uff08\u6a21<em class=\"parameter\"><code>size</code></em>\uff09\u5728\u6574\u6570<code class=\"literal\">0...size-1</code>\u7684\u4f2a\u968f\u673a\u7f6e\u6362\u4e2d\u7684\u65b0\u4f4d\u7f6e\uff1b\u8be5\u7f6e\u6362\u7531<em class=\"parameter\"><code>seed</code></em>\u53c2\u6570\u5316\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">permute(0, 4)</code> \u2192 <code class=\"returnvalue\">an integer between 0 and 3</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pi</code> () \u2192 <code class=\"returnvalue\">double</code></p>\n<p><span class=\"symbol_font\">\u03c0</span>\u7684\u8fd1\u4f3c\u503c</p>\n<p><code class=\"literal\">pi()</code> \u2192 <code class=\"returnvalue\">3.14159265358979323846</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pow</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p class=\"func_signature\"><code class=\"function\">power</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p><em class=\"parameter\"><code>x</code></em> \u7684 <em class=\"parameter\"><code>y</code></em> \u6b21\u5e42</p>\n<p><code class=\"literal\">pow(2.0, 10)</code> \u2192 <code class=\"returnvalue\">1024.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u5747\u5300\u5206\u5e03\u968f\u673a\u6574\u6570\u3002</p>\n<p><code class=\"literal\">random(1, 10)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_exponential</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u6307\u6570\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_exponential(1, 10, 3.0)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_gaussian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u9ad8\u65af\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_gaussian(1, 10, 2.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_zipfian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684 Zipfian \u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_zipfian(1, 10, 1.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">sqrt</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u5e73\u65b9\u6839</p>\n<p><code class=\"literal\">sqrt(2.0)</code> \u2192 <code class=\"returnvalue\">1.414213562</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002parameter \u5141\u8bb8\u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n<p lang=\"zh\">pgbench \u7684\u5b9e\u73b0\u57fa\u4e8e Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002\u7531\u4e8e\u8be5\u7b97\u6cd5\u7684\u9650\u5236\uff0cparameter \u7684\u53d6\u503c\u9650\u5236\u5728 [1.001, 1000] \u8303\u56f4\u5185\u3002</p>\n</li>\n</ul>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u8bbe\u8ba1\u4ee5\u975e\u5747\u5300\u65b9\u5f0f\u9009\u62e9\u884c\u7684\u57fa\u51c6\u6d4b\u8bd5\u65f6\uff0c\u8981\u6ce8\u610f\u88ab\u9009\u4e2d\u7684\u884c\u53ef\u80fd\u4e0e\u5176\u4ed6\u6570\u636e\u76f8\u5173\uff0c\u4f8b\u5982\u4e0e\u5e8f\u5217\u751f\u6210\u7684 ID \u6216\u7269\u7406\u884c\u987a\u5e8f\u76f8\u5173\uff0c\u8fd9\u53ef\u80fd\u4f1a\u626d\u66f2\u6027\u80fd\u6d4b\u91cf\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u4e3a\u907f\u514d\u8fd9\u4e00\u70b9\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"function\">permute</code>\u51fd\u6570\uff0c\u6216\u91c7\u7528\u5176\u4ed6\u5177\u6709\u7c7b\u4f3c\u6548\u679c\u7684\u989d\u5916\u6b65\u9aa4\uff0c\u5bf9\u9009\u4e2d\u7684\u884c\u8fdb\u884c\u6253\u4e71\u5e76\u79fb\u9664\u6b64\u7c7b\u76f8\u5173\u6027\u3002</p>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570<code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code>\u548c<code class=\"literal\">hash_fnv1a</code>\u90fd\u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f1a\u4f7f\u7528<code class=\"literal\">:default_seed</code>\u7684\u503c\uff1b\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c<code class=\"literal\">-D</code>\u9009\u9879\u8986\u76d6\uff0c\u5426\u5219\u8be5\u503c\u4f1a\u88ab\u968f\u673a\u521d\u59cb\u5316\u3002</p>\n<p lang=\"zh\">permute \u63a5\u53d7\u8f93\u5165\u503c\u3001\u5927\u5c0f\u548c\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5b83\u5728 [0, size) \u8303\u56f4\u5185\u751f\u6210\u6574\u6570\u7684\u4f2a\u968f\u673a\u6392\u5217\uff0c\u5e76\u8fd4\u56de\u8f93\u5165\u503c\u5728\u6392\u5217\u4e2d\u7684\u7d22\u5f15\u3002\u6240\u9009\u6392\u5217\u7531\u79cd\u5b50\u51b3\u5b9a\uff0c\u672a\u6307\u5b9a\u79cd\u5b50\u65f6\u9ed8\u8ba4\u4f7f\u7528 :default_seed\u3002\u4e0e\u54c8\u5e0c\u51fd\u6570\u4e0d\u540c\uff0cpermute \u4fdd\u8bc1\u8f93\u51fa\u503c\u65e2\u65e0\u51b2\u7a81\u4e5f\u65e0\u7a7a\u7f3a\u3002\u533a\u95f4\u5916\u7684\u8f93\u5165\u503c\u4f1a\u5bf9 size \u53d6\u6a21\u3002\u5982\u679c size \u4e0d\u662f\u6b63\u6570\uff0c\u51fd\u6570\u4f1a\u62a5\u9519\u3002permute \u53ef\u7528\u4e8e\u6253\u6563 random_zipfian \u6216 random_exponential \u7b49\u975e\u5747\u5300\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f7f\u66f4\u9891\u7e41\u62bd\u53d6\u7684\u503c\u4e0d\u4f1a\u5b58\u5728\u7b80\u5355\u7684\u5173\u8054\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e0a\u53ef\u80fd\u51fa\u73b0\u7684\u4e00\u7c7b\u5178\u578b\u5b9e\u9645\u8d1f\u8f7d\uff1a\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u8fc7\u91cf\u8d1f\u8f7d\u3002</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, :size, 1.07)\n\\set k 1 + permute(:r, :size)\n</pre>\n<p lang=\"zh\">\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u82e5\u5e72\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u53ef\u9009\u79cd\u5b50\u53c2\u6570\u5c31\u5f88\u6709\u7528\uff1a</p>\n<pre class=\"programlisting\">\\set k1 1 + permute(:r, :size, :default_seed + 123)\n\\set k2 1 + permute(:r, :size, :default_seed + 321)\n</pre>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u7528<code class=\"function\">hash</code>\u8fd1\u4f3c\u5b9e\u73b0\u7c7b\u4f3c\u7684\u884c\u4e3a\uff1a</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, 100 * :size, 1.07)\n\\set k 1 + abs(hash(:r)) % :size\n</pre>\n<p lang=\"zh\">\u4f46\u662f\uff0c\u7531\u4e8e<code class=\"function\">hash</code>\u4f1a\u4ea7\u751f\u51b2\u7a81\uff0c\u6709\u4e9b\u503c\u5c06\u6c38\u8fdc\u4e0d\u53ef\u8fbe\uff0c\u800c\u53e6\u4e00\u4e9b\u503c\u5219\u4f1a\u6bd4\u539f\u59cb\u5206\u5e03\u6240\u9884\u671f\u7684\u66f4\u5e38\u51fa\u73b0\u3002</p>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u683c\u5f0f\u5982\u4e0b\uff1a</p>\n<pre class=\"synopsis\"><em class=\"replaceable\"><code>client_id</code></em> <em class=\"replaceable\"><code>transaction_no</code></em> <em class=\"replaceable\"><code>time</code></em> <em class=\"replaceable\"><code>script_no</code></em> <em class=\"replaceable\"><code>time_epoch</code></em> <em class=\"replaceable\"><code>time_us</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>schedule_lag</code></em> </span>]\n</pre>\n<p lang=\"zh\">\u5176\u4e2d\uff0c<em class=\"replaceable\"><code>client_id</code></em> \u8868\u793a\u8fd0\u884c\u8be5\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd\uff0c<em class=\"replaceable\"><code>transaction_no</code></em> \u8bb0\u5f55\u8be5\u4f1a\u8bdd\u5df2\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\uff0c<em class=\"replaceable\"><code>time</code></em> \u662f\u4e8b\u52a1\u7ecf\u8fc7\u7684\u603b\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff0c<em class=\"replaceable\"><code>script_no</code></em> \u6807\u8bc6\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5728\u901a\u8fc7 <code class=\"option\">-f</code> \u6216 <code class=\"option\">-b</code> \u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09\uff0c\u800c <em class=\"replaceable\"><code>time_epoch</code></em>/<em class=\"replaceable\"><code>time_us</code></em> \u5206\u522b\u662f Unix \u7eaa\u5143\u65f6\u95f4\u6233\u548c\u4ee5\u5fae\u79d2\u8ba1\u7684\u504f\u79fb\u91cf\uff08\u9002\u5408\u7528\u6765\u751f\u6210\u5e26\u5c0f\u6570\u79d2\u7684 ISO 8601 \u65f6\u95f4\u6233\uff09\uff0c\u8868\u793a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002<em class=\"replaceable\"><code>schedule_lag</code></em> \u5b57\u6bb5\u662f\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\u3002\u5b83\u4ec5\u5728\u4f7f\u7528 <code class=\"option\">--rate</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5982\u679c\u540c\u65f6\u4f7f\u7528 <code class=\"option\">--rate</code> \u548c <code class=\"option\">--latency-limit</code>\uff0c\u5219\u88ab\u8df3\u8fc7\u4e8b\u52a1\u7684 <em class=\"replaceable\"><code>time</code></em> \u5c06\u62a5\u544a\u4e3a <code class=\"literal\">skipped</code>\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--aggregate-interval</code> \u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u91c7\u7528\u53e6\u4e00\u79cd\u683c\u5f0f\uff1a</p>\n<pre class=\"synopsis\"><em class=\"replaceable\"><code>interval_start</code></em> <em class=\"replaceable\"><code>num_transactions</code></em>\u200b <em class=\"replaceable\"><code>sum_latency</code></em> <em class=\"replaceable\"><code>sum_latency_2</code></em> <em class=\"replaceable\"><code>min_latency</code></em> <em class=\"replaceable\"><code>max_latency</code></em>\u200b [<span class=\"optional\"> <em class=\"replaceable\"><code>sum_lag</code></em> <em class=\"replaceable\"><code>sum_lag_2</code></em> <em class=\"replaceable\"><code>min_lag</code></em> <em class=\"replaceable\"><code>max_lag</code></em> [<span class=\"optional\"> <em class=\"replaceable\"><code>skipped</code></em> </span>] </span>]\n</pre>\n<p lang=\"zh\">\u5176\u4e2d\uff0c<em class=\"replaceable\"><code>interval_start</code></em> \u662f\u65f6\u95f4\u533a\u95f4\u7684\u5f00\u59cb\u65f6\u95f4\uff08\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a\uff09\uff0c<em class=\"replaceable\"><code>num_transactions</code></em> \u662f\u533a\u95f4\u5185\u7684\u4e8b\u52a1\u6570\uff0c<em class=\"replaceable\"><code>sum_latency</code></em> \u662f\u533a\u95f4\u5185\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c\uff0c<em class=\"replaceable\"><code>sum_latency_2</code></em> \u662f\u533a\u95f4\u5185\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff0c<em class=\"replaceable\"><code>min_latency</code></em> \u662f\u533a\u95f4\u5185\u7684\u6700\u5c0f\u5ef6\u8fdf\uff0c\u800c <em class=\"replaceable\"><code>max_latency</code></em> \u662f\u533a\u95f4\u5185\u7684\u6700\u5927\u5ef6\u8fdf\u3002\u63a5\u4e0b\u6765\u7684\u5b57\u6bb5 <em class=\"replaceable\"><code>sum_lag</code></em>\u3001<em class=\"replaceable\"><code>sum_lag_2</code></em>\u3001<em class=\"replaceable\"><code>min_lag</code></em> \u548c <em class=\"replaceable\"><code>max_lag</code></em> \u4ec5\u5728\u4f7f\u7528 <code class=\"option\">--rate</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5b83\u4eec\u63d0\u4f9b\u5404\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u7edf\u8ba1\uff0c\u5373\u5404\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\u3002\u6700\u540e\u4e00\u4e2a\u5b57\u6bb5 <em class=\"replaceable\"><code>skipped</code></em> \u4ec5\u5728\u8fd8\u4f7f\u7528 <code class=\"option\">--latency-limit</code> \u9009\u9879\u65f6\u51fa\u73b0\u3002\u5b83\u8bb0\u5f55\u56e0\u5f00\u59cb\u65f6\u95f4\u8fc7\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\u3002\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8ba1\u5165\u5176\u63d0\u4ea4\u65f6\u6240\u5728\u7684\u65f6\u95f4\u533a\u95f4\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e9b\u8f93\u51fa\u793a\u4f8b\uff1a</p>\n<pre class=\"screen\">1345828501 5601 1542744 483552416 61 2573\n1345828503 7884 1979812 565806736 60 1479\n1345828505 7208 1979422 567277552 59 1391\n1345828507 7685 1980268 569784714 60 1398\n1345828509 7073 1979779 573489941 236 1411\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u5ef6\u8fdf</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\u65f6\uff0c<span class=\"application\">pgbench</span>\u4f1a\u6536\u96c6\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u6240\u7ecf\u8fc7\u7684\u4e8b\u52a1\u65f6\u95f4\u3002\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\uff0c\u5b83\u4f1a\u62a5\u544a\u8fd9\u4e9b\u503c\u7684\u5e73\u5747\u503c\uff0c\u79f0\u4e3a\u6bcf\u6761\u8bed\u53e5\u7684\u5ef6\u8fdf\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u5c06\u7c7b\u4f3c\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nlatency average = 10.870 ms\nlatency stddev = 7.341 ms\ninitial connection time = 30.954 ms\ntps = 907.949122 (without initial connection time)\nstatement latencies in milliseconds:\n    0.001  \\set aid random(1, 100000 * :scale)\n    0.001  \\set bid random(1, 1 * :scale)\n    0.001  \\set tid random(1, 10 * :scale)\n    0.000  \\set delta random(-5000, 5000)\n    0.046  BEGIN;\n    0.151  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n    0.107  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n    4.241  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n    5.245  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n    0.102  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n    0.974  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u5e73\u5747\u503c\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.9\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.10\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/14/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.9.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/14/pgbench.html", "method": "same-major semantic node", "sha256": "46060a1f5f71705516bc6f02936c54ac9170d7d405cd415eb93c044cb0bc0415", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/h2[0]", "#PGBENCH/div[7]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[7]/h2[0]", "#PGBENCH/div[7]/p[2]", "#PGBENCH/div[7]/p[3]", "#PGBENCH/div[8]/div[1]/h3[0]", "#PGBENCH/div[8]/div[1]/h3[0]/span[1]", "#PGBENCH/div[8]/div[1]/p[1]", "#PGBENCH/div[8]/div[1]/p[2]", "#PGBENCH/div[8]/div[1]/p[4]", "#PGBENCH/div[8]/div[1]/p[5]", "#PGBENCH/div[8]/div[2]/div[3]/h3[0]", "#PGBENCH/div[8]/div[2]/div[3]/p[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[4]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[5]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[1]", "#PGBENCH/div[8]/div[2]/h3[0]", "#PGBENCH/div[8]/div[2]/p[1]", "#PGBENCH/div[8]/div[2]/p[2]", "#PGBENCH/div[8]/div[2]/p[4]", "#PGBENCH/div[8]/div[2]/p[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[3]/div[2]/p[0]", "#PGBENCH/div[8]/div[3]/h3[0]", "#PGBENCH/div[8]/div[3]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[18]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[4]/div[2]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[8]/div[4]/div[6]/p[1]", "#PGBENCH/div[8]/div[4]/div[6]/p[2]", "#PGBENCH/div[8]/div[4]/h3[0]", "#PGBENCH/div[8]/div[4]/p[10]", "#PGBENCH/div[8]/div[4]/p[12]", "#PGBENCH/div[8]/div[4]/p[14]", "#PGBENCH/div[8]/div[4]/p[15]", "#PGBENCH/div[8]/div[4]/p[17]", "#PGBENCH/div[8]/div[4]/p[1]", "#PGBENCH/div[8]/div[4]/p[4]", "#PGBENCH/div[8]/div[4]/p[7]", "#PGBENCH/div[8]/div[5]/h3[0]", "#PGBENCH/div[8]/div[5]/p[10]", "#PGBENCH/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[5]/p[4]", "#PGBENCH/div[8]/div[5]/p[5]", "#PGBENCH/div[8]/div[5]/p[7]", "#PGBENCH/div[8]/div[5]/p[9]", "#PGBENCH/div[8]/div[6]/h3[0]", "#PGBENCH/div[8]/div[6]/p[1]", "#PGBENCH/div[8]/div[6]/p[3]", "#PGBENCH/div[8]/div[6]/p[4]", "#PGBENCH/div[8]/div[6]/p[6]", "#PGBENCH/div[8]/div[7]/h3[0]", "#PGBENCH/div[8]/div[7]/p[1]", "#PGBENCH/div[8]/div[7]/p[2]", "#PGBENCH/div[8]/div[7]/p[4]", "#PGBENCH/div[8]/div[7]/p[5]", "#PGBENCH/div[8]/div[8]/h3[0]", "#PGBENCH/div[8]/div[8]/p[1]", "#PGBENCH/div[8]/div[8]/p[2]", "#PGBENCH/div[8]/div[8]/p[4]", "#PGBENCH/div[8]/div[8]/p[5]", "#PGBENCH/div[8]/div[9]/h3[0]", "#PGBENCH/div[8]/div[9]/p[1]", "#PGBENCH/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/14/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/14/facts/0/label": "Documented executable", "/versions/14/facts/0/value": "pgbench", "/versions/14/facts/1/label": "Executable version", "/versions/14/facts/2/label": "Reference inventory", "/versions/14/facts/2/value": "Client applications", "/versions/14/facts/3/label": "Option definition groups", "/versions/14/tables/0/title": "Documented options", "/versions/14/tables/1/title": "Environment variables", "/versions/14/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/14/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/14/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/14/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/14/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/14/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/14/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/14/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/14/tables/0/rows/8/summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "/versions/14/tables/0/rows/9/summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "/versions/14/tables/0/columns/0/label": "Option and arguments", "/versions/14/tables/0/columns/1/label": "Description", "/versions/14/tables/0/rows/10/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/14/tables/0/rows/11/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/14/tables/0/rows/12/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/14/tables/0/rows/13/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/14/tables/0/rows/14/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/14/tables/0/rows/15/summary": "Print debugging output.", "/versions/14/tables/0/rows/16/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/14/tables/0/rows/17/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/14/tables/0/rows/18/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/14/tables/0/rows/19/summary": "Write information about each transaction to a log file. See below for details.", "/versions/14/tables/0/rows/20/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/14/tables/0/rows/21/summary": "Protocol to use for submitting queries to the server:", "/versions/14/tables/0/rows/22/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/14/tables/0/rows/23/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/14/tables/0/rows/24/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time.", "/versions/14/tables/0/rows/25/summary": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details.", "/versions/14/tables/0/rows/26/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/14/tables/0/rows/27/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/14/tables/0/rows/28/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/14/tables/0/rows/29/summary": "Number of transactions each client runs. Default is 10.", "/versions/14/tables/0/rows/30/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/14/tables/0/rows/31/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/14/tables/0/rows/32/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/14/tables/0/rows/33/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/14/tables/0/rows/34/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/14/tables/0/rows/35/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/14/tables/0/rows/36/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/14/tables/0/rows/37/summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "/versions/14/tables/0/rows/38/summary": "The database server's host name", "/versions/14/tables/0/rows/39/summary": "The database server's port number", "/versions/14/tables/0/rows/40/summary": "The user name to connect as", "/versions/14/tables/0/rows/41/summary": "Print the pgbench version and exit.", "/versions/14/tables/0/rows/42/summary": "Show help about pgbench command line arguments, and exit.", "/versions/14/tables/1/columns/0/label": "Variable", "/versions/14/tables/1/columns/1/label": "Meaning", "/versions/14/tables/1/rows/0/description": "Default connection parameters."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "9c603211c37e63839fa755edd8b8da27d408696bd1df23aed8469933dd775911"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . Using g causes logging to print one message every 100,000 rows while generating data for the pgbench_accounts table. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "signature": "--partition-method= NAME", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "signature": "--partitions= NUM", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "signature": "-d --debug", "description": "Print debugging output."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped ."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 53 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average and standard deviation since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time."}, {"names": ["-r", "--report-latencies"], "signature": "-r --report-latencies", "description": "Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= seed", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "signature": "--show-script= scriptname", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}]}, "comparison_hash": "c4b31f83616dbc2738e953fed750531d8587b706c430760984d214463622de8e", "manual_language": "zh"}, "15": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "15.19"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "46"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/15/pgbench.html", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/15/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/15/pgbench.html", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--partition-method= NAME"}}, {"summary": "\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--partitions= NUM"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-C --connect"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-d --debug"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/15/pgbench.html", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528 --max-tries \u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-P sec --progress= sec"}}, {"summary": "\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-r --report-per-command"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--aggregate-interval= seconds"}}, {"summary": "\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a", "signature": {"url": "/docs/15/pgbench.html", "text": "--failures-detailed"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--log-prefix= prefix"}}, {"summary": "\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--max-tries= number_of_tries"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 seed \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 seed \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--random-seed= seed"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--sampling-rate= rate"}}, {"summary": "\u5c06\u5185\u7f6e\u811a\u672c scriptname \u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--show-script= scriptname"}}, {"summary": "\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1 \u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5 \u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "--verbose-errors"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/15/pgbench.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/15/pgbench.html", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/15/pgbench.html", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option with version 14 or later of PostgreSQL to speed up subsequent VACUUM , unless partitions are enabled. Using g causes logging to print one message every 100,000 rows while generating data for the pgbench_accounts table. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/15/pgbench.html", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/15/pgbench.html", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/15/pgbench.html", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/15/pgbench.html", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/15/pgbench.html", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/15/pgbench.html", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "signature": "--partition-method= NAME", "source_url": "/docs/15/pgbench.html", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "signature": "--partitions= NUM", "source_url": "/docs/15/pgbench.html", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/15/pgbench.html", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/15/pgbench.html", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/15/pgbench.html", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/15/pgbench.html", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/15/pgbench.html", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "summary": "Print debugging output.", "signature": "-d --debug", "source_url": "/docs/15/pgbench.html", "description": "Print debugging output."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/15/pgbench.html", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/15/pgbench.html", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/15/pgbench.html", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/15/pgbench.html", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/15/pgbench.html", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/15/pgbench.html", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 55 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/15/pgbench.html", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/15/pgbench.html", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "signature": "-P sec --progress= sec", "source_url": "/docs/15/pgbench.html", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "signature": "-r --report-per-command", "source_url": "/docs/15/pgbench.html", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/15/pgbench.html", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/15/pgbench.html", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/15/pgbench.html", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/15/pgbench.html", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/15/pgbench.html", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/15/pgbench.html", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/15/pgbench.html", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--failures-detailed"], "summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "signature": "--failures-detailed", "source_url": "/docs/15/pgbench.html", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/15/pgbench.html", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "signature": "--max-tries= number_of_tries", "source_url": "/docs/15/pgbench.html", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/15/pgbench.html", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= seed", "source_url": "/docs/15/pgbench.html", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/15/pgbench.html", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "signature": "--show-script= scriptname", "source_url": "/docs/15/pgbench.html", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "signature": "--verbose-errors", "source_url": "/docs/15/pgbench.html", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/15/pgbench.html", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/15/pgbench.html", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/15/pgbench.html", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/15/pgbench.html", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/15/pgbench.html", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "label": "15.19", "major": "15", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/15/postgresql-15-A4.pdf", "bytes": 14609140, "pages": 2987, "sha256": "66228564a4d16efb47d6a914085716ecfe22ca1566db56bc7c3d82f790646d72", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/15/postgresql-15-US.pdf", "bytes": 14495690, "pages": 3153, "sha256": "645a498c2390d47a6223ec74770631185807a19c484edb0fc5a295d9f460bc02", "built_at": "2026-09-26"}}, "tree": "15", "index": "index.html", "major": "15", "pages": 1168, "release": "15.19", "source_url": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "revision": "6af958c6520151fc7697d56e0616b03fb00522c4568158674d452ae0644ba545", "evidence_kind": "English manual and source declarations", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "sources": [{"url": "https://pg.center/docs/15/pgbench.html", "file": "pgbench.html", "label": "15.19 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "71429c48b7a842647b47f28a6f4d26561f8a31000610fec1e3a04990789acb55", "language": "en", "original_url": "/docs/15/pgbench.html"}, {"url": "https://pg.center/docs/15/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "015b2ea2bd205946a55a1b837e735570631bac831c92074a6bf58444f9a3cb98", "language": "en", "original_url": "/docs/15/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u5178\u578b\u7684<span class=\"application\">pgbench</span>\u8f93\u51fa\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nlatency average = 11.013 ms\nlatency stddev = 7.351 ms\ninitial connection time = 45.758 ms\ntps = 896.967014 (without initial connection time)\n</pre>\n<p lang=\"zh\">\u524d\u4e03\u884c\u7ed9\u51fa\u4e86\u82e5\u5e72\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u7b2c\u516d\u884c\u62a5\u544a\u4e86\u51fa\u73b0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u65f6\u4e8b\u52a1\u5141\u8bb8\u7684\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/15/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u7b2c\u516b\u884c\u62a5\u544a\u5b9e\u9645\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u4e8b\u52a1\u6570\uff08\u540e\u8005\u4ec5\u4e3a\u5ba2\u6237\u7aef\u6570\u91cf\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u6216\u8005\u67d0\u4e9b SQL \u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u5426\u5219\u4e24\u8005\u5e94\u5f53\u76f8\u7b49\u3002\uff08\u5728<code class=\"option\">-T</code>\u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u4e8b\u52a1\u6570\u3002\uff09\u4e0b\u4e00\u884c\u62a5\u544a\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\u7684\u4e8b\u52a1\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/15/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u6700\u540e\u4e00\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>dbname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u5219\u4f7f\u7528\u8fde\u63a5\u6307\u5b9a\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002<em class=\"replaceable\"><code>init_steps</code></em>\u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\u6216<code class=\"literal\">G</code>\uff08\u5728\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">g</code>\uff08\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c\u6570\u636e\u7531<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u751f\u6210\uff0c\u518d\u901a\u8fc7<code class=\"command\">COPY</code>\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4f1a\u5927\u91cf\u5360\u7528\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u5e26\u5bbd\u3002\u5bf9\u4e8e 14 \u53ca\u4ee5\u4e0a\u7248\u672c\u7684<span class=\"productname\">PostgreSQL</span>\uff0c\u9664\u975e\u542f\u7528\u4e86\u5206\u533a\uff0c<code class=\"command\">pgbench</code>\u4f1a\u4f7f\u7528 FREEZE \u9009\u9879\uff0c\u4ee5\u52a0\u5feb\u540e\u7eed\u7684<code class=\"command\">VACUUM</code>\u3002\u4f7f\u7528<code class=\"literal\">g</code>\u65f6\uff0c\u5728\u4e3a<code class=\"structname\">pgbench_accounts</code>\u8868\u751f\u6210\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6bcf\u751f\u6210 100,000 \u884c\u4f1a\u8f93\u51fa\u4e00\u6761\u65e5\u5fd7\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">G</code>\uff08\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u53ea\u53d1\u9001\u8f83\u5c0f\u7684\u67e5\u8be2\uff0c\u968f\u540e\u5b9e\u9645\u6570\u636e\u5728\u670d\u52a1\u5668\u7aef\u751f\u6210\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u9700\u8981\u5927\u91cf\u5e26\u5bbd\uff0c\u4f46\u670d\u52a1\u5668\u4f1a\u627f\u62c5\u66f4\u591a\u5de5\u4f5c\u3002\u4f7f\u7528<code class=\"literal\">G</code>\u65f6\uff0c\u751f\u6210\u6570\u636e\u671f\u95f4\u4e0d\u4f1a\u6253\u5370\u4efb\u4f55\u8fdb\u5ea6\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u521d\u59cb\u5316\u884c\u4e3a\u4f7f\u7528\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff08\u7b49\u540c\u4e8e<code class=\"literal\">g</code>\uff09\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n<p lang=\"zh\">\u5982\u679c -I \u4e2d\u6307\u5b9a\u4e86 G\uff0c\u6b64\u8bbe\u7f6e\u4e0d\u751f\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--foreign-keys</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--partition-method=<em class=\"replaceable\"><code>NAME</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--partitions=<em class=\"replaceable\"><code>NUM</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d</code><br/></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span></dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--max-tries</code>\u9009\u9879\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u56e0\u4e32\u884c\u5316\u5f02\u5e38\u6216\u6b7b\u9501\u800c\u5931\u8d25\uff0c\u4e14\u5176\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\u5927\u4e8e<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u5219\u4e0d\u4f1a\u518d\u91cd\u8bd5\u3002\u82e5\u53ea\u60f3\u9650\u5236\u5c1d\u8bd5\u603b\u65f6\u95f4\u800c\u4e0d\u9650\u5236\u5c1d\u8bd5\u6b21\u6570\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">--max-tries=0</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"option\">--max-tries</code>\u4e3a 1\uff0c\u51fa\u73b0\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/15/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5728<code class=\"literal\">prepared</code>\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pgbench</span> \u4ece\u7b2c\u4e8c\u6b21\u67e5\u8be2\u8fed\u4ee3\u5f00\u59cb\u590d\u7528\u89e3\u6790\u5206\u6790\u7ed3\u679c\uff0c\u56e0\u6b64<span class=\"application\">pgbench</span> \u6bd4\u5176\u4ed6\u6a21\u5f0f\u8fd0\u884c\u5f97\u66f4\u5feb\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u503c\u662f\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/15/protocol.html\" title=\"\u7b2c\u00a055\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a055\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528<code class=\"option\">--max-tries</code>\u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-per-command</code></span></dt>\n<dd>\n<p lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--failures-detailed</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e32\u884c\u5316\u5931\u8d25\uff1b</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u6b7b\u9501\u5931\u8d25\uff1b</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/15/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--max-tries=<em class=\"replaceable\"><code>number_of_tries</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>seed</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>seed</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>seed</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--show-script=</code><em class=\"replaceable\"><code>scriptname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5185\u7f6e\u811a\u672c<em class=\"replaceable\"><code>scriptname</code></em>\u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--verbose-errors</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/15/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u8fd8\u63a5\u53d7\u4ee5\u4e0b\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u901a\u7528\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u6210\u529f\u8fd0\u884c\u65f6\u9000\u51fa\u72b6\u6001\u4e3a 0\u3002\u9000\u51fa\u72b6\u6001 1 \u8868\u793a\u9759\u6001\u95ee\u9898\uff0c\u4f8b\u5982\u65e0\u6548\u7684\u547d\u4ee4\u884c\u9009\u9879\uff0c\u6216\u8005\u672c\u4e0d\u5e94\u53d1\u751f\u7684\u5185\u90e8\u9519\u8bef\u3002\u57fa\u51c6\u6d4b\u8bd5\u542f\u52a8\u9636\u6bb5\u7684\u65e9\u671f\u9519\u8bef\uff0c\u4f8b\u5982\u521d\u59cb\u8fde\u63a5\u5931\u8d25\uff0c\u4e5f\u4f1a\u4ee5\u72b6\u6001 1 \u9000\u51fa\u3002\u8fd0\u884c\u671f\u95f4\u7684\u9519\u8bef\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u9519\u8bef\u6216\u811a\u672c\u95ee\u9898\uff0c\u4f1a\u5bfc\u81f4\u9000\u51fa\u72b6\u6001\u4e3a 2\u3002\u5728\u540e\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0cpgbench \u4f1a\u6253\u5370\u90e8\u5206\u7ed3\u679c\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.8\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/15/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.9\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"TRANSACTIONS-AND-SCRIPTS\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n<p lang=\"zh\">\u5047\u5b9a<span class=\"application\">pgbench</span>\u811a\u672c\u4e0d\u5305\u542b\u4e0d\u5b8c\u6574\u7684 SQL \u4e8b\u52a1\u5757\u3002\u5982\u679c\u5728\u8fd0\u884c\u65f6\u5ba2\u6237\u7aef\u5728\u5c1a\u672a\u5b8c\u6210\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5757\u65f6\u5c31\u5230\u8fbe\u811a\u672c\u672b\u5c3e\uff0c\u8be5\u5ba2\u6237\u7aef\u5c06\u88ab\u4e2d\u6b62\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u673a\u5236\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5e76\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u5982\u4e0a\u6240\u8ff0\uff0c\u53d8\u91cf\u53ef\u4ee5\u7528\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e0b\u6587\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u901a\u8fc7<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u5148\u8bbe\u7f6e\u7684\u53d8\u91cf\u4e4b\u5916\uff0c\u8fd8\u6709\u5c11\u91cf\u53d8\u91cf\u4f1a\u88ab\u81ea\u52a8\u9884\u8bbe\uff0c\u5217\u5728<a class=\"xref\" href=\"/docs/15/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0288.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0288</a>\u4e2d\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u503c\uff0c\u5219\u4f1a\u8986\u76d6\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u4e00\u65e6\u8bbe\u7f6e\u597d\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u5728 SQL \u547d\u4ee4\u4e2d\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u6765\u63d2\u5165\u5176\u503c\u3002\u5f53\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u53d8\u91cf\u96c6\u5408\u3002<span class=\"application\">pgbench</span>\u5728\u5355\u6761\u8bed\u53e5\u4e2d\u6700\u591a\u652f\u6301 255 \u6b21\u53d8\u91cf\u4f7f\u7528\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0288.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u548c\u4f2a\u968f\u673a\u7f6e\u6362\u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [<em class=\"replaceable\"><code>prefix</code></em>]</code> <code class=\"literal\">\\aset [<em class=\"replaceable\"><code>prefix</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e9b\u547d\u4ee4\u53ef\u7528\u4e8e\u7ed3\u675f SQL \u67e5\u8be2\uff0c\u4ee5\u4ee3\u66ff\u7ed3\u5c3e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\gset</code>\u547d\u4ee4\u65f6\uff0c\u524d\u9762\u7684 SQL \u67e5\u8be2\u9884\u671f\u8fd4\u56de\u4e00\u884c\uff0c\u5176\u5404\u5217\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\aset</code>\u547d\u4ee4\u65f6\uff0c\u6240\u6709\u7ec4\u5408 SQL \u67e5\u8be2\uff08\u7531<code class=\"literal\">\\;</code>\u5206\u9694\uff09\u7684\u5217\u90fd\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\u4e2d\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u4e0d\u8fd4\u56de\u4efb\u4f55\u884c\uff0c\u5219\u4e0d\u4f1a\u8fdb\u884c\u8d4b\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u6765\u68c0\u6d4b\u8fd9\u79cd\u60c5\u51b5\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u591a\u884c\uff0c\u5219\u4fdd\u7559\u6700\u540e\u4e00\u4e2a\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\gset</code> \u548c <code class=\"literal\">\\aset</code> \u4e0d\u80fd\u7528\u5728\u7ba1\u9053\u6a21\u5f0f\uff0c\u56e0\u4e3a\u5728\u547d\u4ee4\u9700\u8981\u5b83\u4eec\u7684\u65f6\u5019\uff0c\u67e5\u8be2\u7ed3\u679c\u8fd8\u4e0d\u53ef\u7528\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u7684\u793a\u4f8b\u5c06\u7b2c\u4e00\u4e2a\u67e5\u8be2\u4e2d\u7684\u6700\u7ec8\u8d26\u6237\u4f59\u989d\u653e\u5165\u53d8\u91cf<em class=\"replaceable\"><code>abalance</code></em>\uff0c\u5e76\u7528\u7b2c\u4e09\u4e2a\u67e5\u8be2\u4e2d\u7684\u6574\u6570\u586b\u5145\u53d8\u91cf<em class=\"replaceable\"><code>p_two</code></em>\u548c<em class=\"replaceable\"><code>p_three</code></em>\u3002\u7b2c\u4e8c\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002\u6700\u540e\u4e24\u4e2a\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u5b58\u5165\u53d8\u91cf<em class=\"replaceable\"><code>four</code></em>\u548c<em class=\"replaceable\"><code>five</code></em>\u3002</p>\n<pre class=\"programlisting\">UPDATE pgbench_accounts\n  SET abalance = abalance + :delta\n  WHERE aid = :aid\n  RETURNING abalance \\gset\n-- compound of two queries\nSELECT 1 \\;\nSELECT 2 AS two, 3 AS three \\gset p_\nSELECT 4 AS four \\; SELECT 5 AS five \\aset\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/15/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/15/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/15/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.18.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u8fc7\u5927\u6216\u8fc7\u5c0f\u7684\u6574\u6570\u548c\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff0c\u4ee5\u53ca\u6574\u6570\u7b97\u672f\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u548c<code class=\"literal\">/</code>\uff09\u90fd\u4f1a\u5728\u6ea2\u51fa\u65f6\u5f15\u53d1\u9519\u8bef\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u547d\u4ee4\u754c\u5b9a SQL \u8bed\u53e5\u7ba1\u9053\u7684\u5f00\u59cb\u548c\u7ed3\u675f\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u4e00\u6761\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/15/libpq-pipeline-mode.html\" title=\"34.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a034.5\u00a0\u8282</a>\u3002\u7ba1\u9053\u6a21\u5f0f\u8981\u6c42\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/15/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0289.\u00a0pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0289</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/15/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002\u8fd9\u4e9b\u64cd\u4f5c\u7b26\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u5217\u51fa\u3002\u9664\u975e\u53e6\u6709\u8bf4\u660e\uff0c\u63a5\u53d7\u4e24\u4e2a\u6570\u5b57\u8f93\u5165\u7684\u64cd\u4f5c\u7b26\u53ea\u8981\u4efb\u4e00\u8f93\u5165\u4e3a\u53cc\u7cbe\u5ea6\uff0c\u5c31\u4f1a\u4ea7\u751f\u53cc\u7cbe\u5ea6\u7ed3\u679c\uff1b\u5426\u5219\u4ea7\u751f\u6574\u6570\u7ed3\u679c\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0289.\u00a0pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u64cd\u4f5c\u7b26</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">OR</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u6216</p>\n<p><code class=\"literal\">5 or 0</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">AND</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u4e0e</p>\n<p><code class=\"literal\">3 and 0</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">NOT</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u975e</p>\n<p><code class=\"literal\">not false</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5e03\u5c14\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 is null</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>value</code></em> <code class=\"literal\">ISNULL|NOTNULL</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7a7a\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 notnull</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 = 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;&gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">!=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 != 5</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e</p>\n<p><code class=\"literal\">5 &lt; 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;= 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e</p>\n<p><code class=\"literal\">5 &gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &gt;= 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">|</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u6216</p>\n<p><code class=\"literal\">1 | 2</code> \u2192 <code class=\"returnvalue\">3</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">#</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5f02\u6216</p>\n<p><code class=\"literal\">1 # 3</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&amp;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u4e0e</p>\n<p><code class=\"literal\">1 &amp; 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">~</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u975e</p>\n<p><code class=\"literal\">~ 1</code> \u2192 <code class=\"returnvalue\">-2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&lt;&lt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5de6\u79fb</p>\n<p><code class=\"literal\">1 &lt;&lt; 2</code> \u2192 <code class=\"returnvalue\">4</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&gt;&gt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u53f3\u79fb</p>\n<p><code class=\"literal\">8 &gt;&gt; 2</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">+</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u52a0\u6cd5</p>\n<p><code class=\"literal\">5 + 4</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u51cf\u6cd5</p>\n<p><code class=\"literal\">3 - 2.0</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">*</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u4e58\u6cd5</p>\n<p><code class=\"literal\">5 * 4</code> \u2192 <code class=\"returnvalue\">20</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">/</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u9664\u6cd5\uff08\u5982\u679c\u4e24\u4e2a\u8f93\u5165\u90fd\u662f\u6574\u6570\uff0c\u5219\u5c06\u7ed3\u679c\u5411\u96f6\u622a\u65ad\uff09</p>\n<p><code class=\"literal\">5 / 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">%</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">3 % 2</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u53d6\u76f8\u53cd\u6570</p>\n<p><code class=\"literal\">- 2.0</code> \u2192 <code class=\"returnvalue\">-2.0</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/15/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0290.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0290</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/15/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0290.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u51fd\u6570</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">abs</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u7edd\u5bf9\u503c</p>\n<p><code class=\"literal\">abs(-17)</code> \u2192 <code class=\"returnvalue\">17</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">debug</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u5c06\u53c2\u6570\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de\u53c2\u6570\u3002</p>\n<p><code class=\"literal\">debug(5432.1)</code> \u2192 <code class=\"returnvalue\">5432.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">double</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u8f6c\u6362\u4e3a double\u3002</p>\n<p><code class=\"literal\">double(5432)</code> \u2192 <code class=\"returnvalue\">5432.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">exp</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u6307\u6570\u51fd\u6570\uff08<code class=\"literal\">e</code> \u7684\u7ed9\u5b9a\u6b21\u5e42\uff09</p>\n<p><code class=\"literal\">exp(1.0)</code> \u2192 <code class=\"returnvalue\">2.718281828459045</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">greatest</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c\u3002</p>\n<p><code class=\"literal\">greatest(5, 4, 3, 2)</code> \u2192 <code class=\"returnvalue\">5</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8fd9\u662f <code class=\"function\">hash_murmur2</code> \u7684\u522b\u540d\u3002</p>\n<p><code class=\"literal\">hash(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_fnv1a</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\" target=\"_top\">FNV-1a hash</a>\u3002</p>\n<p><code class=\"literal\">hash_fnv1a(10, 5432)</code> \u2192 <code class=\"returnvalue\">-7793829335365542153</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_murmur2</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/MurmurHash\" target=\"_top\">MurmurHash2 hash</a>\u3002</p>\n<p><code class=\"literal\">hash_murmur2(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">int</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8f6c\u6362\u4e3a integer\u3002</p>\n<p><code class=\"literal\">int(5.4 + 3.8)</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">least</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c\u3002</p>\n<p><code class=\"literal\">least(5, 4, 3, 2.1)</code> \u2192 <code class=\"returnvalue\">2.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">ln</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u81ea\u7136\u5bf9\u6570</p>\n<p><code class=\"literal\">ln(2.718281828459045)</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">mod</code> ( <em class=\"replaceable\"><code>integer</code></em>, <em class=\"replaceable\"><code>integer</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">mod(54, 32)</code> \u2192 <code class=\"returnvalue\">22</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">permute</code> ( <em class=\"parameter\"><code>i</code></em>, <em class=\"parameter\"><code>size</code></em> [, <em class=\"parameter\"><code>seed</code></em> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\"><em class=\"parameter\"><code>i</code></em>\u7684\u7f6e\u6362\u503c\uff0c\u8303\u56f4\u5728<code class=\"literal\">[0, size)</code>\u5185\u3002\u5b83\u8868\u793a<em class=\"parameter\"><code>i</code></em>\uff08\u6a21<em class=\"parameter\"><code>size</code></em>\uff09\u5728\u6574\u6570<code class=\"literal\">0...size-1</code>\u7684\u4f2a\u968f\u673a\u7f6e\u6362\u4e2d\u7684\u65b0\u4f4d\u7f6e\uff1b\u8be5\u7f6e\u6362\u7531<em class=\"parameter\"><code>seed</code></em>\u53c2\u6570\u5316\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">permute(0, 4)</code> \u2192 <code class=\"returnvalue\">an integer between 0 and 3</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pi</code> () \u2192 <code class=\"returnvalue\">double</code></p>\n<p><span class=\"symbol_font\">\u03c0</span>\u7684\u8fd1\u4f3c\u503c</p>\n<p><code class=\"literal\">pi()</code> \u2192 <code class=\"returnvalue\">3.14159265358979323846</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pow</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p class=\"func_signature\"><code class=\"function\">power</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p><em class=\"parameter\"><code>x</code></em> \u7684 <em class=\"parameter\"><code>y</code></em> \u6b21\u5e42</p>\n<p><code class=\"literal\">pow(2.0, 10)</code> \u2192 <code class=\"returnvalue\">1024.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u5747\u5300\u5206\u5e03\u968f\u673a\u6574\u6570\u3002</p>\n<p><code class=\"literal\">random(1, 10)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_exponential</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u6307\u6570\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_exponential(1, 10, 3.0)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_gaussian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u9ad8\u65af\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_gaussian(1, 10, 2.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_zipfian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684 Zipfian \u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_zipfian(1, 10, 1.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">sqrt</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u5e73\u65b9\u6839</p>\n<p><code class=\"literal\">sqrt(2.0)</code> \u2192 <code class=\"returnvalue\">1.414213562</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002parameter \u5141\u8bb8\u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n<p lang=\"zh\">pgbench \u7684\u5b9e\u73b0\u57fa\u4e8e Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002\u7531\u4e8e\u8be5\u7b97\u6cd5\u7684\u9650\u5236\uff0cparameter \u7684\u53d6\u503c\u9650\u5236\u5728 [1.001, 1000] \u8303\u56f4\u5185\u3002</p>\n</li>\n</ul>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u8bbe\u8ba1\u4ee5\u975e\u5747\u5300\u65b9\u5f0f\u9009\u62e9\u884c\u7684\u57fa\u51c6\u6d4b\u8bd5\u65f6\uff0c\u8981\u6ce8\u610f\u88ab\u9009\u4e2d\u7684\u884c\u53ef\u80fd\u4e0e\u5176\u4ed6\u6570\u636e\u76f8\u5173\uff0c\u4f8b\u5982\u4e0e\u5e8f\u5217\u751f\u6210\u7684 ID \u6216\u7269\u7406\u884c\u987a\u5e8f\u76f8\u5173\uff0c\u8fd9\u53ef\u80fd\u4f1a\u626d\u66f2\u6027\u80fd\u6d4b\u91cf\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u4e3a\u907f\u514d\u8fd9\u4e00\u70b9\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"function\">permute</code>\u51fd\u6570\uff0c\u6216\u91c7\u7528\u5176\u4ed6\u5177\u6709\u7c7b\u4f3c\u6548\u679c\u7684\u989d\u5916\u6b65\u9aa4\uff0c\u5bf9\u9009\u4e2d\u7684\u884c\u8fdb\u884c\u6253\u4e71\u5e76\u79fb\u9664\u6b64\u7c7b\u76f8\u5173\u6027\u3002</p>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570<code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code>\u548c<code class=\"literal\">hash_fnv1a</code>\u90fd\u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f1a\u4f7f\u7528<code class=\"literal\">:default_seed</code>\u7684\u503c\uff1b\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c<code class=\"literal\">-D</code>\u9009\u9879\u8986\u76d6\uff0c\u5426\u5219\u8be5\u503c\u4f1a\u88ab\u968f\u673a\u521d\u59cb\u5316\u3002</p>\n<p lang=\"zh\">permute \u63a5\u53d7\u8f93\u5165\u503c\u3001\u5927\u5c0f\u548c\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5b83\u5728 [0, size) \u8303\u56f4\u5185\u751f\u6210\u6574\u6570\u7684\u4f2a\u968f\u673a\u6392\u5217\uff0c\u5e76\u8fd4\u56de\u8f93\u5165\u503c\u5728\u6392\u5217\u4e2d\u7684\u7d22\u5f15\u3002\u6240\u9009\u6392\u5217\u7531\u79cd\u5b50\u51b3\u5b9a\uff0c\u672a\u6307\u5b9a\u79cd\u5b50\u65f6\u9ed8\u8ba4\u4f7f\u7528 :default_seed\u3002\u4e0e\u54c8\u5e0c\u51fd\u6570\u4e0d\u540c\uff0cpermute \u4fdd\u8bc1\u8f93\u51fa\u503c\u65e2\u65e0\u51b2\u7a81\u4e5f\u65e0\u7a7a\u7f3a\u3002\u533a\u95f4\u5916\u7684\u8f93\u5165\u503c\u4f1a\u5bf9 size \u53d6\u6a21\u3002\u5982\u679c size \u4e0d\u662f\u6b63\u6570\uff0c\u51fd\u6570\u4f1a\u62a5\u9519\u3002permute \u53ef\u7528\u4e8e\u6253\u6563 random_zipfian \u6216 random_exponential \u7b49\u975e\u5747\u5300\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f7f\u66f4\u9891\u7e41\u62bd\u53d6\u7684\u503c\u4e0d\u4f1a\u5b58\u5728\u7b80\u5355\u7684\u5173\u8054\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e0a\u53ef\u80fd\u51fa\u73b0\u7684\u4e00\u7c7b\u5178\u578b\u5b9e\u9645\u8d1f\u8f7d\uff1a\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u8fc7\u91cf\u8d1f\u8f7d\u3002</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, :size, 1.07)\n\\set k 1 + permute(:r, :size)\n</pre>\n<p lang=\"zh\">\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u82e5\u5e72\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u53ef\u9009\u79cd\u5b50\u53c2\u6570\u5c31\u5f88\u6709\u7528\uff1a</p>\n<pre class=\"programlisting\">\\set k1 1 + permute(:r, :size, :default_seed + 123)\n\\set k2 1 + permute(:r, :size, :default_seed + 321)\n</pre>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u7528<code class=\"function\">hash</code>\u8fd1\u4f3c\u5b9e\u73b0\u7c7b\u4f3c\u7684\u884c\u4e3a\uff1a</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, 100 * :size, 1.07)\n\\set k 1 + abs(hash(:r)) % :size\n</pre>\n<p lang=\"zh\">\u4f46\u662f\uff0c\u7531\u4e8e<code class=\"function\">hash</code>\u4f1a\u4ea7\u751f\u51b2\u7a81\uff0c\u6709\u4e9b\u503c\u5c06\u6c38\u8fdc\u4e0d\u53ef\u8fbe\uff0c\u800c\u53e6\u4e00\u4e9b\u503c\u5219\u4f1a\u6bd4\u539f\u59cb\u5206\u5e03\u6240\u9884\u671f\u7684\u66f4\u5e38\u51fa\u73b0\u3002</p>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u6587\u4ef6\u7684\u6bcf\u4e00\u884c\u63cf\u8ff0\u4e00\u4e2a\u4e8b\u52a1\u3002\u5b83\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>client_id</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8fd0\u884c\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>transaction_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edf\u8ba1\u8be5\u4f1a\u8bdd\u5df2\u6267\u884c\u7684\u4e8b\u52a1\u6570\u91cf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u8017\u65f6\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>script_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8be5\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5f53\u901a\u8fc7<code class=\"option\">-f</code>\u6216<code class=\"option\">-b</code>\u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_epoch</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_us</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\u7684\u5c0f\u6570\u79d2\u90e8\u5206\uff0c\u4ee5\u5fae\u79d2\u4e3a\u5355\u4f4d</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>schedule_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff0c\u5373\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff08\u4ec5\u5728\u6307\u5b9a<code class=\"option\">--rate</code>\u65f6\u51fa\u73b0\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4e8b\u52a1\u6267\u884c\u671f\u95f4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08\u4ec5\u5f53 --max-tries \u4e0d\u7b49\u4e8e\u4e00\u65f6\u51fa\u73b0\uff09</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5f53\u540c\u65f6\u4f7f\u7528<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\u65f6\uff0c\u8df3\u8fc7\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">skipped</code>\u3002\u5982\u679c\u4e8b\u52a1\u4ee5\u5931\u8d25\u7ed3\u675f\uff0c\u5176<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">failed</code>\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u4f1a\u6839\u636e\u5931\u8d25\u7c7b\u578b\u62a5\u544a\u4e3a<code class=\"literal\">serialization</code>\u6216<code class=\"literal\">deadlock</code>\uff08\u8be6\u89c1<a class=\"xref\" href=\"/docs/15/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5305\u542b\u5931\u8d25\u4e0e\u91cd\u8bd5\u7684\u65e5\u5fd7\u7247\u6bb5\uff0c\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u8bbe\u4e3a 10\uff08\u6ce8\u610f\u989d\u5916\u7684 retries \u5217\uff09\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 failed 0 1499414498 84905 9\n2 0 failed 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u7684\u7c7b\u578b\u5c06\u5728<em class=\"replaceable\"><code>time</code></em>\u4e2d\u62a5\u544a\uff0c\u5982\u4e0b\u6240\u793a\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 serialization 0 1499414498 84905 9\n2 0 serialization 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--aggregate-interval</code>\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u4f1a\u91c7\u7528\u4e0d\u540c\u7684\u683c\u5f0f\u3002\u6bcf\u4e00\u884c\u65e5\u5fd7\u63cf\u8ff0\u4e00\u4e2a\u805a\u5408\u65f6\u95f4\u95f4\u9694\uff0c\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>interval_start</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u7684\u8d77\u59cb\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>num_transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u5185\u7684\u4e8b\u52a1\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u603b\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>skipped</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56e0\u4e3a\u542f\u52a8\u65f6\u95f4\u4f1a\u592a\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retried</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>serialization_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u4e32\u884c\u5316\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>deadlock_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u6b7b\u9501\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4f7f\u7528\u8fd9\u4e9b\u9009\u9879\u751f\u6210\u7684\u793a\u4f8b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\"><strong class=\"userinput\"><code>pgbench --aggregate-interval=10 --time=20 --client=10 --log --rate=1000 --latency-limit=10 --failures-detailed --max-tries=10 test</code></strong>\n\n1650260552 5178 26171317 177284491527 1136 44462 2647617 7321113867 0 9866 64 7564 28340 4148 0\n1650260562 4808 25573984 220121792172 1171 62083 3037380 9666800914 0 9998 598 7392 26621 4527 0\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u62a5\u544a</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\uff0c<span class=\"application\">pgbench</span>\u4e3a\u6bcf\u4e2a\u8bed\u53e5\u6536\u96c6\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">latency</code> \u2014 \u6bcf\u6761\u8bed\u53e5\u7684\u8017\u65f6\u3002<span class=\"application\">pgbench</span>\u62a5\u544a\u8be5\u8bed\u53e5\u6240\u6709\u6210\u529f\u6267\u884c\u7684\u5e73\u5747\u503c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u7684\u5931\u8d25\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/15/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u53d1\u751f\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/15/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u62a5\u544a\u4ec5\u5728<code class=\"option\">--max-tries</code>\u9009\u9879\u4e0d\u7b49\u4e8e1\u65f6\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6240\u6709\u6570\u503c\u90fd\u662f\u9488\u5bf9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u8ba1\u7b97\u7684\uff0c\u5e76\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u5c06\u7c7b\u4f3c\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nnumber of transactions above the 50.0 ms latency limit: 1311/10000 (13.110 %)\nlatency average = 28.488 ms\nlatency stddev = 21.009 ms\ninitial connection time = 69.068 ms\ntps = 346.224794 (without initial connection time)\nstatement latencies in milliseconds and failures:\n   0.012  0  \\set aid random(1, 100000 * :scale)\n   0.002  0  \\set bid random(1, 1 * :scale)\n   0.002  0  \\set tid random(1, 10 * :scale)\n   0.002  0  \\set delta random(-5000, 5000)\n   0.319  0  BEGIN;\n   0.834  0  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n   0.641  0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  11.126  0  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  12.961  0  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n   0.634  0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n   1.957  0  END;\n</pre>\n<p lang=\"zh\">\u4f7f\u7528\u53ef\u4e32\u884c\u5316\u9ed8\u8ba4\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\u7684\u9ed8\u8ba4\u811a\u672c\u7684\u53e6\u4e00\u4e2a\u8f93\u51fa\u793a\u4f8b\uff08<code class=\"command\">PGOPTIONS='-c default_transaction_isolation=serializable' pgbench ...</code>\uff09\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 10\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 6317/10000\nnumber of failed transactions: 3683 (36.830%)\nnumber of transactions retried: 7667 (76.670%)\ntotal number of retries: 45339\nnumber of transactions above the 50.0 ms latency limit: 106/6317 (1.678 %)\nlatency average = 17.016 ms\nlatency stddev = 13.283 ms\ninitial connection time = 45.017 ms\ntps = 186.792667 (without initial connection time)\nstatement latencies in milliseconds, failures and retries:\n  0.006     0      0  \\set aid random(1, 100000 * :scale)\n  0.001     0      0  \\set bid random(1, 1 * :scale)\n  0.001     0      0  \\set tid random(1, 10 * :scale)\n  0.001     0      0  \\set delta random(-5000, 5000)\n  0.385     0      0  BEGIN;\n  0.773     0      1  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n  0.624     0      0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  1.098   320   3762  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  0.582  3363  41576  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n  0.465     0      0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n  1.933     0      0  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"FAILURES-AND-RETRIES\">\n<h3 lang=\"zh\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</h3>\n<p lang=\"zh\">\u5728\u6267\u884c<span class=\"application\">pgbench</span>\u65f6\uff0c\u6709\u4e09\u79cd\u4e3b\u8981\u7c7b\u578b\u7684\u9519\u8bef\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e3b\u7a0b\u5e8f\u9519\u8bef\u3002\u5b83\u4eec\u6700\u4e3a\u4e25\u91cd\uff0c\u603b\u662f\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\uff0c\u5e76\u663e\u793a\u76f8\u5e94\u7684\u9519\u8bef\u6d88\u606f\u3002\u5b83\u4eec\u5305\u62ec\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\" style=\"list-style-type: circle;\">\n<li class=\"listitem\">\n<p><span class=\"application\">pgbench</span>\u5f00\u59cb\u6267\u884c\u65f6\u7684\u9519\u8bef\uff08\u4f8b\u5982\u9009\u9879\u503c\u65e0\u6548\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u521d\u59cb\u5316\u6a21\u5f0f\u4e2d\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u7528\u4e8e\u521b\u5efa\u5185\u7f6e\u811a\u672c\u6240\u9700\u8868\u7684\u67e5\u8be2\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5728\u7ebf\u7a0b\u542f\u52a8\u4e4b\u524d\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\u65e0\u6cd5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3001\u5143\u547d\u4ee4\u4e2d\u6709\u8bed\u6cd5\u9519\u8bef\u3001\u7ebf\u7a0b\u521b\u5efa\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u6c38\u8fdc\u4e0d\u8be5\u53d1\u751f\u2026\u2026\uff09\u3002</p>\n</li>\n</ul>\n</div>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u7ebf\u7a0b\u5728\u7ba1\u7406\u5176\u5ba2\u6237\u7aef\u65f6\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u5ba2\u6237\u7aef\u65e0\u6cd5\u5f00\u59cb\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u6216\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\u6240\u7528\u7684\u5957\u63a5\u5b57\u5df2\u7ecf\u5931\u6548\uff09\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8be5\u7ebf\u7a0b\u7684\u6240\u6709\u5ba2\u6237\u7aef\u90fd\u4f1a\u505c\u6b62\uff0c\u800c\u5176\u4ed6\u7ebf\u7a0b\u7ee7\u7eed\u5de5\u4f5c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\u3002\u53ea\u6709\u5728\u53d1\u751f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u4e0d\u5e94\u53d1\u751f\uff09\u65f6\uff0c\u5b83\u4eec\u624d\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\u5e76\u663e\u793a\u76f8\u5e94\u9519\u8bef\u6d88\u606f\u3002\u5426\u5219\uff0c\u6700\u574f\u60c5\u51b5\u4e0b\u53ea\u4f1a\u4e2d\u6b62\u5931\u8d25\u7684\u5ba2\u6237\u7aef\uff0c\u800c\u5176\u4ed6\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\uff08\u4f46\u67d0\u4e9b\u5ba2\u6237\u7aef\u9519\u8bef\u4f1a\u5728\u4e0d\u4e2d\u6b62\u5ba2\u6237\u7aef\u7684\u60c5\u51b5\u4e0b\u5904\u7406\u5e76\u5355\u72ec\u62a5\u544a\uff0c\u89c1\u4e0b\u6587\uff09\u3002\u672c\u8282\u540e\u7eed\u9ed8\u8ba4\u8ba8\u8bba\u7684\u90fd\u662f\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\uff0c\u800c\u4e0d\u662f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5ba2\u6237\u7aef\u5728\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u65f6\u4f1a\u4e2d\u6b62\u8fd0\u884c\uff1b\u4f8b\u5982\uff0c\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e22\u5931\uff0c\u6216\u8005\u811a\u672c\u5728\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5c1a\u672a\u5b8c\u6210\u65f6\u5c31\u7ed3\u675f\u4e86\u3002\u53e6\u5916\uff0c\u5982\u679c SQL \u6216\u5143\u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u4e14\u539f\u56e0\u4e0d\u662f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\uff0c\u5ba2\u6237\u7aef\u4e5f\u4f1a\u4e2d\u6b62\u3002\u5426\u5219\uff0c\u5982\u679c SQL \u547d\u4ee4\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5f53\u524d\u4e8b\u52a1\u4f1a\u56de\u6eda\uff0c\u4e5f\u5305\u62ec\u5c06\u5ba2\u6237\u7aef\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u6b64\u4e8b\u52a1\u8fd0\u884c\u4e4b\u524d\u7684\u72b6\u6001\uff08\u5047\u8bbe\u4e00\u4e2a\u4e8b\u52a1\u811a\u672c\u53ea\u5305\u542b\u4e00\u4e2a\u4e8b\u52a1\uff1b\u8be6\u89c1<a class=\"xref\" href=\"/docs/15/pgbench.html#TRANSACTIONS-AND-SCRIPTS\" title=\"\u5728pgbench\u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f\">\u5728 pgbench \u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f</a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff09\u3002\u53d1\u751f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4f1a\u5728\u56de\u6eda\u540e\u91cd\u65b0\u6267\u884c\uff0c\u76f4\u5230\u6210\u529f\u5b8c\u6210\uff0c\u6216\u8005\u8fbe\u5230\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u7531<code class=\"option\">--max-tries</code>\u6307\u5b9a\uff09\u3001\u8fbe\u5230\u6700\u5927\u91cd\u8bd5\u65f6\u95f4\uff08\u7531<code class=\"option\">--latency-limit</code>\u6307\u5b9a\uff09\uff0c\u6216\u8005\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\uff08\u7531<code class=\"option\">--time</code>\u6307\u5b9a\uff09\u3002\u5982\u679c\u6700\u540e\u4e00\u6b21\u5c1d\u8bd5\u4ecd\u7136\u5931\u8d25\uff0c\u8be5\u4e8b\u52a1\u4f1a\u88ab\u62a5\u544a\u4e3a\u5931\u8d25\uff0c\u4f46\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\uff0c\u800c\u662f\u7ee7\u7eed\u5de5\u4f5c\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a --max-tries \u9009\u9879\uff0c\u4e8b\u52a1\u5728\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u4e0d\u4f1a\u91cd\u8bd5\uff0c\u56e0\u4e3a\u5176\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u53ef\u4ee5\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u5e76\u914d\u5408 --latency-limit\uff0c\u4ec5\u9650\u5236\u5c1d\u8bd5\u7684\u6700\u957f\u603b\u8017\u65f6\u3002\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\u65f6\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 --time \u9650\u5236\u57fa\u51c6\u6d4b\u8bd5\u65f6\u957f\u3002</p>\n<p lang=\"zh\">\u5728\u91cd\u590d\u5305\u542b\u591a\u4e2a\u4e8b\u52a1\u7684\u811a\u672c\u65f6\u8981\u5c0f\u5fc3\uff1a\u811a\u672c\u603b\u662f\u5b8c\u5168\u91cd\u8bd5\uff0c\u56e0\u6b64\u6210\u529f\u7684\u4e8b\u52a1\u53ef\u80fd\u4f1a\u6267\u884c\u591a\u6b21\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 shell \u547d\u4ee4\u91cd\u8bd5\u4e8b\u52a1\u65f6\u8981\u5c0f\u5fc3\u3002\u4e0e SQL \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u540c\uff0cshell \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u4f1a\u56de\u6eda\uff0c\u552f\u4e00\u7684\u4f8b\u5916\u662f<code class=\"command\">\\setshell</code>\u547d\u4ee4\u8bbe\u7f6e\u7684\u53d8\u91cf\u503c\u3002</p>\n</div>\n<p lang=\"zh\">\u6210\u529f\u4e8b\u52a1\u7684\u5ef6\u8fdf\u5305\u62ec\u4e8b\u52a1\u6267\u884c\u7684\u6574\u4e2a\u65f6\u95f4\uff0c\u5305\u62ec\u56de\u6eda\u548c\u91cd\u8bd5\u3002\u5ef6\u8fdf\u4ec5\u9488\u5bf9\u6210\u529f\u7684\u4e8b\u52a1\u548c\u547d\u4ee4\u8fdb\u884c\u6d4b\u91cf\uff0c\u800c\u4e0d\u9488\u5bf9\u5931\u8d25\u7684\u4e8b\u52a1\u6216\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u4e3b\u62a5\u544a\u5305\u542b\u5931\u8d25\u4e8b\u52a1\u7684\u6570\u91cf\u3002\u5982\u679c --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1\uff0c\u4e3b\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u91cd\u8bd5\u76f8\u5173\u7edf\u8ba1\uff1a\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u603b\u6570\u548c\u91cd\u8bd5\u603b\u6b21\u6570\u3002\u6bcf\u811a\u672c\u62a5\u544a\u7ee7\u627f\u4e3b\u62a5\u544a\u7684\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u6bcf\u8bed\u53e5\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5e0c\u671b\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\u6309\u57fa\u672c\u7c7b\u578b\u5bf9\u5931\u8d25\u8fdb\u884c\u5206\u7ec4\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\u3002\u5982\u679c\u8fd8\u5e0c\u671b\u6309\u7c7b\u578b\u533a\u5206\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u4e86\u591a\u5c11\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--verbose-errors</code>\u9009\u9879\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.10\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.11\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/15/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.9.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/15/pgbench.html", "method": "same-major semantic node", "sha256": "5d5cab80c1b15c9a8be74c78ac70c1d6c9b61ec7c03ecefbdf3ba27627be7f09", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[4]/a[0]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[55]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[57]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/h2[0]", "#PGBENCH/div[7]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[7]/h2[0]", "#PGBENCH/div[7]/p[2]", "#PGBENCH/div[7]/p[3]", "#PGBENCH/div[8]/div[10]/h3[0]", "#PGBENCH/div[8]/div[10]/p[1]", "#PGBENCH/div[8]/div[1]/h3[0]", "#PGBENCH/div[8]/div[1]/h3[0]/span[1]", "#PGBENCH/div[8]/div[1]/p[1]", "#PGBENCH/div[8]/div[1]/p[2]", "#PGBENCH/div[8]/div[1]/p[4]", "#PGBENCH/div[8]/div[1]/p[5]", "#PGBENCH/div[8]/div[2]/div[3]/h3[0]", "#PGBENCH/div[8]/div[2]/div[3]/p[1]", "#PGBENCH/div[8]/div[2]/div[3]/p[2]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[4]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[5]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[1]", "#PGBENCH/div[8]/div[2]/h3[0]", "#PGBENCH/div[8]/div[2]/p[1]", "#PGBENCH/div[8]/div[2]/p[2]", "#PGBENCH/div[8]/div[2]/p[4]", "#PGBENCH/div[8]/div[2]/p[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[3]/div[2]/p[0]", "#PGBENCH/div[8]/div[3]/h3[0]", "#PGBENCH/div[8]/div[3]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[18]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[4]/div[2]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[8]/div[4]/div[6]/p[1]", "#PGBENCH/div[8]/div[4]/div[6]/p[2]", "#PGBENCH/div[8]/div[4]/h3[0]", "#PGBENCH/div[8]/div[4]/p[10]", "#PGBENCH/div[8]/div[4]/p[12]", "#PGBENCH/div[8]/div[4]/p[14]", "#PGBENCH/div[8]/div[4]/p[15]", "#PGBENCH/div[8]/div[4]/p[17]", "#PGBENCH/div[8]/div[4]/p[1]", "#PGBENCH/div[8]/div[4]/p[4]", "#PGBENCH/div[8]/div[4]/p[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[5]/h3[0]", "#PGBENCH/div[8]/div[5]/p[12]", "#PGBENCH/div[8]/div[5]/p[14]", "#PGBENCH/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[5]/p[4]", "#PGBENCH/div[8]/div[5]/p[5]", "#PGBENCH/div[8]/div[5]/p[7]", "#PGBENCH/div[8]/div[5]/p[9]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[6]/h3[0]", "#PGBENCH/div[8]/div[6]/p[1]", "#PGBENCH/div[8]/div[6]/p[3]", "#PGBENCH/div[8]/div[6]/p[5]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[7]/h3[0]", "#PGBENCH/div[8]/div[7]/p[10]", "#PGBENCH/div[8]/div[7]/p[1]", "#PGBENCH/div[8]/div[7]/p[3]", "#PGBENCH/div[8]/div[7]/p[4]", "#PGBENCH/div[8]/div[7]/p[5]", "#PGBENCH/div[8]/div[7]/p[7]", "#PGBENCH/div[8]/div[7]/p[9]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[8]/div[4]/p[2]", "#PGBENCH/div[8]/div[8]/div[4]/p[3]", "#PGBENCH/div[8]/div[8]/p[1]", "#PGBENCH/div[8]/div[8]/p[3]", "#PGBENCH/div[8]/div[8]/p[5]", "#PGBENCH/div[8]/div[8]/p[7]", "#PGBENCH/div[8]/div[9]/h3[0]", "#PGBENCH/div[8]/div[9]/p[1]", "#PGBENCH/div[8]/div[9]/p[2]", "#PGBENCH/div[8]/div[9]/p[4]", "#PGBENCH/div[8]/div[9]/p[5]", "#PGBENCH/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/15/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/15/facts/0/label": "Documented executable", "/versions/15/facts/0/value": "pgbench", "/versions/15/facts/1/label": "Executable version", "/versions/15/facts/2/label": "Reference inventory", "/versions/15/facts/2/value": "Client applications", "/versions/15/facts/3/label": "Option definition groups", "/versions/15/tables/0/title": "Documented options", "/versions/15/tables/1/title": "Environment variables", "/versions/15/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/15/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/15/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/15/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/15/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/15/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/15/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/15/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/15/tables/0/rows/8/summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "/versions/15/tables/0/rows/9/summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "/versions/15/tables/0/columns/0/label": "Option and arguments", "/versions/15/tables/0/columns/1/label": "Description", "/versions/15/tables/0/rows/10/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/15/tables/0/rows/11/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/15/tables/0/rows/12/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/15/tables/0/rows/13/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/15/tables/0/rows/14/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/15/tables/0/rows/15/summary": "Print debugging output.", "/versions/15/tables/0/rows/16/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/15/tables/0/rows/17/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/15/tables/0/rows/18/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/15/tables/0/rows/19/summary": "Write information about each transaction to a log file. See below for details.", "/versions/15/tables/0/rows/20/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/15/tables/0/rows/21/summary": "Protocol to use for submitting queries to the server:", "/versions/15/tables/0/rows/22/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/15/tables/0/rows/23/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/15/tables/0/rows/24/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "/versions/15/tables/0/rows/25/summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "/versions/15/tables/0/rows/26/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/15/tables/0/rows/27/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/15/tables/0/rows/28/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/15/tables/0/rows/29/summary": "Number of transactions each client runs. Default is 10.", "/versions/15/tables/0/rows/30/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/15/tables/0/rows/31/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/15/tables/0/rows/32/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/15/tables/0/rows/33/summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "/versions/15/tables/0/rows/34/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/15/tables/0/rows/35/summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "/versions/15/tables/0/rows/36/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/15/tables/0/rows/37/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/15/tables/0/rows/38/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/15/tables/0/rows/39/summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "/versions/15/tables/0/rows/40/summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "/versions/15/tables/0/rows/41/summary": "The database server's host name", "/versions/15/tables/0/rows/42/summary": "The database server's port number", "/versions/15/tables/0/rows/43/summary": "The user name to connect as", "/versions/15/tables/0/rows/44/summary": "Print the pgbench version and exit.", "/versions/15/tables/0/rows/45/summary": "Show help about pgbench command line arguments, and exit.", "/versions/15/tables/1/columns/0/label": "Variable", "/versions/15/tables/1/columns/1/label": "Meaning", "/versions/15/tables/1/rows/0/description": "Default connection parameters."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "4e915e10995987b183c3cb5dcae208ab38eac82d6a662dc7c43dd962cddcfd1e"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option with version 14 or later of PostgreSQL to speed up subsequent VACUUM , unless partitions are enabled. Using g causes logging to print one message every 100,000 rows while generating data for the pgbench_accounts table. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "signature": "--partition-method= NAME", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "signature": "--partitions= NUM", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "signature": "-d --debug", "description": "Print debugging output."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 55 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "signature": "-r --report-per-command", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--failures-detailed"], "signature": "--failures-detailed", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "signature": "--max-tries= number_of_tries", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= seed", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "signature": "--show-script= scriptname", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "signature": "--verbose-errors", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}]}, "comparison_hash": "9979b73486f6c5fd952acd238b6556ecf38cec84b1c2a856539e0542e8c72d1a", "manual_language": "zh"}, "16": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "16.15"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "46"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-INITIALIZE", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "text": "--partition-method= NAME"}}, {"summary": "\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-PARTITIONS", "text": "--partitions= NUM"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-TABLESPACE", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-BUILTIN", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-CLIENT", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-CONNECT", "text": "-C --connect"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-DEBUG", "text": "-d --debug"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-DEFINE", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-FILE", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-JOBS", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-LOG", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-PROTOCOL", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528 --max-tries \u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-PROGRESS", "text": "-P sec --progress= sec"}}, {"summary": "\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "text": "-r --report-per-command"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-RATE", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-TIME", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "text": "--aggregate-interval= seconds"}}, {"summary": "\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "text": "--failures-detailed"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "text": "--log-prefix= prefix"}}, {"summary": "\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "text": "--max-tries= number_of_tries"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 seed \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 seed \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "text": "--random-seed= seed"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "text": "--sampling-rate= rate"}}, {"summary": "\u5c06\u5185\u7f6e\u811a\u672c scriptname \u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "text": "--show-script= scriptname"}}, {"summary": "\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1 \u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5 \u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "text": "--verbose-errors"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-USERNAME", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/16/pgbench.html#PGBENCH-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-INITIALIZE", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option with version 14 or later of PostgreSQL to speed up subsequent VACUUM , unless partitions are enabled. Using g causes logging to print one message every 100,000 rows while generating data for the pgbench_accounts table. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-QUIET", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "signature": "--partition-method= NAME", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "signature": "--partitions= NUM", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-PARTITIONS", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-TABLESPACE", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-BUILTIN", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-CLIENT", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-CONNECT", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "summary": "Print debugging output.", "signature": "-d --debug", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-DEBUG", "description": "Print debugging output."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-DEFINE", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-FILE", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-JOBS", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-LOG", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-PROTOCOL", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 55 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "signature": "-P sec --progress= sec", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-PROGRESS", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "signature": "-r --report-per-command", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-RATE", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-TIME", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--failures-detailed"], "summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "signature": "--failures-detailed", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "signature": "--max-tries= number_of_tries", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= seed", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "signature": "--show-script= scriptname", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "signature": "--verbose-errors", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-HOST", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-PORT", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-USERNAME", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-VERSION", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/16/pgbench.html#PGBENCH-OPTION-HELP", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "label": "16.15", "major": "16", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/16/postgresql-16-A4.pdf", "bytes": 15282337, "pages": 3055, "sha256": "4bb6c1f63deedac98736d8c4c7bc0fad0ac24e85b07e21ee10411872f06afd06", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/16/postgresql-16-US.pdf", "bytes": 15164148, "pages": 3220, "sha256": "5b6b6166c89991199e144bb0ae34c17a5f29826251dbf19db1abc0df3a3e771b", "built_at": "2026-09-26"}}, "tree": "16", "index": "index.html", "major": "16", "pages": 1169, "release": "16.15", "source_url": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "revision": "3c21e58b35318021716440e67bb8bafd392b6a2b965a244d90e9e33c99e0bdef", "evidence_kind": "English manual and source declarations", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "sources": [{"url": "https://pg.center/docs/16/pgbench.html", "file": "pgbench.html", "label": "16.15 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "7de3388b64e06e274e987dd2cc255d7c811eed908016a3068bfe824be7cd803b", "language": "en", "original_url": "/docs/16/pgbench.html"}, {"url": "https://pg.center/docs/16/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "a28c30c3c0f8783e16d56413a0b6fd39487e336da1683b29b60abf1c229cef26", "language": "en", "original_url": "/docs/16/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u5178\u578b\u7684<span class=\"application\">pgbench</span>\u8f93\u51fa\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nlatency average = 11.013 ms\nlatency stddev = 7.351 ms\ninitial connection time = 45.758 ms\ntps = 896.967014 (without initial connection time)\n</pre>\n<p lang=\"zh\">\u524d\u4e03\u884c\u7ed9\u51fa\u4e86\u82e5\u5e72\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u7b2c\u516d\u884c\u62a5\u544a\u4e86\u51fa\u73b0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u65f6\u4e8b\u52a1\u5141\u8bb8\u7684\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/16/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u7b2c\u516b\u884c\u62a5\u544a\u5b9e\u9645\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u4e8b\u52a1\u6570\uff08\u540e\u8005\u4ec5\u4e3a\u5ba2\u6237\u7aef\u6570\u91cf\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u6216\u8005\u67d0\u4e9b SQL \u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u5426\u5219\u4e24\u8005\u5e94\u5f53\u76f8\u7b49\u3002\uff08\u5728<code class=\"option\">-T</code>\u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u4e8b\u52a1\u6570\u3002\uff09\u4e0b\u4e00\u884c\u62a5\u544a\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\u7684\u4e8b\u52a1\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/16/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u6700\u540e\u4e00\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DBNAME\"><span class=\"term\"><em class=\"replaceable\"><code>dbname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u5219\u4f7f\u7528\u8fde\u63a5\u6307\u5b9a\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INITIALIZE\"><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS\"><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002<em class=\"replaceable\"><code>init_steps</code></em>\u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-D\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-T\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-G\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\u6216<code class=\"literal\">G</code>\uff08\u5728\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">g</code>\uff08\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c\u6570\u636e\u7531<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u751f\u6210\uff0c\u518d\u901a\u8fc7<code class=\"command\">COPY</code>\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4f1a\u5927\u91cf\u5360\u7528\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u5e26\u5bbd\u3002\u5bf9\u4e8e 14 \u53ca\u4ee5\u4e0a\u7248\u672c\u7684<span class=\"productname\">PostgreSQL</span>\uff0c\u9664\u975e\u542f\u7528\u4e86\u5206\u533a\uff0c<code class=\"command\">pgbench</code>\u4f1a\u4f7f\u7528 FREEZE \u9009\u9879\uff0c\u4ee5\u52a0\u5feb\u540e\u7eed\u7684<code class=\"command\">VACUUM</code>\u3002\u4f7f\u7528<code class=\"literal\">g</code>\u65f6\uff0c\u5728\u4e3a<code class=\"structname\">pgbench_accounts</code>\u8868\u751f\u6210\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6bcf\u751f\u6210 100,000 \u884c\u4f1a\u8f93\u51fa\u4e00\u6761\u65e5\u5fd7\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">G</code>\uff08\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u53ea\u53d1\u9001\u8f83\u5c0f\u7684\u67e5\u8be2\uff0c\u968f\u540e\u5b9e\u9645\u6570\u636e\u5728\u670d\u52a1\u5668\u7aef\u751f\u6210\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u9700\u8981\u5927\u91cf\u5e26\u5bbd\uff0c\u4f46\u670d\u52a1\u5668\u4f1a\u627f\u62c5\u66f4\u591a\u5de5\u4f5c\u3002\u4f7f\u7528<code class=\"literal\">G</code>\u65f6\uff0c\u751f\u6210\u6570\u636e\u671f\u95f4\u4e0d\u4f1a\u6253\u5370\u4efb\u4f55\u8fdb\u5ea6\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u521d\u59cb\u5316\u884c\u4e3a\u4f7f\u7528\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff08\u7b49\u540c\u4e8e<code class=\"literal\">g</code>\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-V\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-P\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-F\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILLFACTOR\"><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-INIT\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n<p lang=\"zh\">\u5982\u679c -I \u4e2d\u6307\u5b9a\u4e86 G\uff0c\u6b64\u8bbe\u7f6e\u4e0d\u751f\u6548\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-INIT\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FOREIGN-KEYS\"><span class=\"term\"><code class=\"option\">--foreign-keys</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INDEX-TABLESPACE\"><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITION-METHOD\"><span class=\"term\"><code class=\"option\">--partition-method=<em class=\"replaceable\"><code>NAME</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITIONS\"><span class=\"term\"><code class=\"option\">--partitions=<em class=\"replaceable\"><code>NUM</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TABLESPACE\"><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-UNLOGGED-TABLES\"><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-BUILTIN\"><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CLIENT\"><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CONNECT\"><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">-d</code><br/></span><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-DEFINE\"><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-JOBS\"><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LATENCY-LIMIT\"><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--max-tries</code>\u9009\u9879\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u56e0\u4e32\u884c\u5316\u5f02\u5e38\u6216\u6b7b\u9501\u800c\u5931\u8d25\uff0c\u4e14\u5176\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\u5927\u4e8e<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u5219\u4e0d\u4f1a\u518d\u91cd\u8bd5\u3002\u82e5\u53ea\u60f3\u9650\u5236\u5c1d\u8bd5\u603b\u65f6\u95f4\u800c\u4e0d\u9650\u5236\u5c1d\u8bd5\u6b21\u6570\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">--max-tries=0</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"option\">--max-tries</code>\u4e3a 1\uff0c\u51fa\u73b0\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/16/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROTOCOL\"><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5728<code class=\"literal\">prepared</code>\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pgbench</span> \u4ece\u7b2c\u4e8c\u6b21\u67e5\u8be2\u8fed\u4ee3\u5f00\u59cb\u590d\u7528\u89e3\u6790\u5206\u6790\u7ed3\u679c\uff0c\u56e0\u6b64<span class=\"application\">pgbench</span> \u6bd4\u5176\u4ed6\u6a21\u5f0f\u8fd0\u884c\u5f97\u66f4\u5feb\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u503c\u662f\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/16/protocol.html\" title=\"\u7b2c\u00a055\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a055\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-RUN\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SKIP-SOME-UPDATES\"><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS\"><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528<code class=\"option\">--max-tries</code>\u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-REPORT-LATENCIES\"><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-per-command</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RATE\"><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-RUN\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SELECT-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TRANSACTIONS\"><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TIME\"><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VACUUM-ALL\"><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-AGGREGATE-INTERVAL\"><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FAILURES-DETAILED\"><span class=\"term\"><code class=\"option\">--failures-detailed</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e32\u884c\u5316\u5931\u8d25\uff1b</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u6b7b\u9501\u5931\u8d25\uff1b</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/16/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG-PREFIX\"><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-MAX-TRIES\"><span class=\"term\"><code class=\"option\">--max-tries=<em class=\"replaceable\"><code>number_of_tries</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS-TIMESTAMP\"><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RANDOM-SEED\"><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>seed</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>seed</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>seed</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SAMPLING-RATE\"><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SHOW-SCRIPT\"><span class=\"term\"><code class=\"option\">--show-script=</code><em class=\"replaceable\"><code>scriptname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5185\u7f6e\u811a\u672c<em class=\"replaceable\"><code>scriptname</code></em>\u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERBOSE-ERRORS\"><span class=\"term\"><code class=\"option\">--verbose-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/16/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u8fd8\u63a5\u53d7\u4ee5\u4e0b\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u901a\u7528\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-HOST\"><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u6210\u529f\u8fd0\u884c\u65f6\u9000\u51fa\u72b6\u6001\u4e3a 0\u3002\u9000\u51fa\u72b6\u6001 1 \u8868\u793a\u9759\u6001\u95ee\u9898\uff0c\u4f8b\u5982\u65e0\u6548\u7684\u547d\u4ee4\u884c\u9009\u9879\uff0c\u6216\u8005\u672c\u4e0d\u5e94\u53d1\u751f\u7684\u5185\u90e8\u9519\u8bef\u3002\u57fa\u51c6\u6d4b\u8bd5\u542f\u52a8\u9636\u6bb5\u7684\u65e9\u671f\u9519\u8bef\uff0c\u4f8b\u5982\u521d\u59cb\u8fde\u63a5\u5931\u8d25\uff0c\u4e5f\u4f1a\u4ee5\u72b6\u6001 1 \u9000\u51fa\u3002\u8fd0\u884c\u671f\u95f4\u7684\u9519\u8bef\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u9519\u8bef\u6216\u811a\u672c\u95ee\u9898\uff0c\u4f1a\u5bfc\u81f4\u9000\u51fa\u72b6\u6001\u4e3a 2\u3002\u5728\u540e\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0cpgbench \u4f1a\u6253\u5370\u90e8\u5206\u7ed3\u679c\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.8\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/16/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.9\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"TRANSACTIONS-AND-SCRIPTS\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n<p lang=\"zh\">\u5047\u5b9a<span class=\"application\">pgbench</span>\u811a\u672c\u4e0d\u5305\u542b\u4e0d\u5b8c\u6574\u7684 SQL \u4e8b\u52a1\u5757\u3002\u5982\u679c\u5728\u8fd0\u884c\u65f6\u5ba2\u6237\u7aef\u5728\u5c1a\u672a\u5b8c\u6210\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5757\u65f6\u5c31\u5230\u8fbe\u811a\u672c\u672b\u5c3e\uff0c\u8be5\u5ba2\u6237\u7aef\u5c06\u88ab\u4e2d\u6b62\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u673a\u5236\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5e76\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u5982\u4e0a\u6240\u8ff0\uff0c\u53d8\u91cf\u53ef\u4ee5\u7528\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e0b\u6587\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u901a\u8fc7<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u5148\u8bbe\u7f6e\u7684\u53d8\u91cf\u4e4b\u5916\uff0c\u8fd8\u6709\u5c11\u91cf\u53d8\u91cf\u4f1a\u88ab\u81ea\u52a8\u9884\u8bbe\uff0c\u5217\u5728<a class=\"xref\" href=\"/docs/16/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0293.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0293</a>\u4e2d\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u503c\uff0c\u5219\u4f1a\u8986\u76d6\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u4e00\u65e6\u8bbe\u7f6e\u597d\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u5728 SQL \u547d\u4ee4\u4e2d\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u6765\u63d2\u5165\u5176\u503c\u3002\u5f53\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u53d8\u91cf\u96c6\u5408\u3002<span class=\"application\">pgbench</span>\u5728\u5355\u6761\u8bed\u53e5\u4e2d\u6700\u591a\u652f\u6301 255 \u6b21\u53d8\u91cf\u4f7f\u7528\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0293.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u548c\u4f2a\u968f\u673a\u7f6e\u6362\u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [<em class=\"replaceable\"><code>prefix</code></em>]</code> <code class=\"literal\">\\aset [<em class=\"replaceable\"><code>prefix</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e9b\u547d\u4ee4\u53ef\u7528\u4e8e\u7ed3\u675f SQL \u67e5\u8be2\uff0c\u4ee5\u4ee3\u66ff\u7ed3\u5c3e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\gset</code>\u547d\u4ee4\u65f6\uff0c\u524d\u9762\u7684 SQL \u67e5\u8be2\u9884\u671f\u8fd4\u56de\u4e00\u884c\uff0c\u5176\u5404\u5217\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\aset</code>\u547d\u4ee4\u65f6\uff0c\u6240\u6709\u7ec4\u5408 SQL \u67e5\u8be2\uff08\u7531<code class=\"literal\">\\;</code>\u5206\u9694\uff09\u7684\u5217\u90fd\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\u4e2d\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u4e0d\u8fd4\u56de\u4efb\u4f55\u884c\uff0c\u5219\u4e0d\u4f1a\u8fdb\u884c\u8d4b\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u6765\u68c0\u6d4b\u8fd9\u79cd\u60c5\u51b5\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u591a\u884c\uff0c\u5219\u4fdd\u7559\u6700\u540e\u4e00\u4e2a\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\gset</code> \u548c <code class=\"literal\">\\aset</code> \u4e0d\u80fd\u7528\u5728\u7ba1\u9053\u6a21\u5f0f\uff0c\u56e0\u4e3a\u5728\u547d\u4ee4\u9700\u8981\u5b83\u4eec\u7684\u65f6\u5019\uff0c\u67e5\u8be2\u7ed3\u679c\u8fd8\u4e0d\u53ef\u7528\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u7684\u793a\u4f8b\u5c06\u7b2c\u4e00\u4e2a\u67e5\u8be2\u4e2d\u7684\u6700\u7ec8\u8d26\u6237\u4f59\u989d\u653e\u5165\u53d8\u91cf<em class=\"replaceable\"><code>abalance</code></em>\uff0c\u5e76\u7528\u7b2c\u4e09\u4e2a\u67e5\u8be2\u4e2d\u7684\u6574\u6570\u586b\u5145\u53d8\u91cf<em class=\"replaceable\"><code>p_two</code></em>\u548c<em class=\"replaceable\"><code>p_three</code></em>\u3002\u7b2c\u4e8c\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002\u6700\u540e\u4e24\u4e2a\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u5b58\u5165\u53d8\u91cf<em class=\"replaceable\"><code>four</code></em>\u548c<em class=\"replaceable\"><code>five</code></em>\u3002</p>\n<pre class=\"programlisting\">UPDATE pgbench_accounts\n  SET abalance = abalance + :delta\n  WHERE aid = :aid\n  RETURNING abalance \\gset\n-- compound of two queries\nSELECT 1 \\;\nSELECT 2 AS two, 3 AS three \\gset p_\nSELECT 4 AS four \\; SELECT 5 AS five \\aset\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-IF-ELSE\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/16/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/16/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/16/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.18.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u8fc7\u5927\u6216\u8fc7\u5c0f\u7684\u6574\u6570\u548c\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff0c\u4ee5\u53ca\u6574\u6570\u7b97\u672f\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u548c<code class=\"literal\">/</code>\uff09\u90fd\u4f1a\u5728\u6ea2\u51fa\u65f6\u5f15\u53d1\u9519\u8bef\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SLEEP\"><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SETSHELL\"><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SHELL\"><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u547d\u4ee4\u754c\u5b9a SQL \u8bed\u53e5\u7ba1\u9053\u7684\u5f00\u59cb\u548c\u7ed3\u675f\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u4e00\u6761\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/16/libpq-pipeline-mode.html\" title=\"34.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a034.5\u00a0\u8282</a>\u3002\u7ba1\u9053\u6a21\u5f0f\u8981\u6c42\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/16/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0294.\u00a0pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0294</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/16/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002\u8fd9\u4e9b\u64cd\u4f5c\u7b26\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u5217\u51fa\u3002\u9664\u975e\u53e6\u6709\u8bf4\u660e\uff0c\u63a5\u53d7\u4e24\u4e2a\u6570\u5b57\u8f93\u5165\u7684\u64cd\u4f5c\u7b26\u53ea\u8981\u4efb\u4e00\u8f93\u5165\u4e3a\u53cc\u7cbe\u5ea6\uff0c\u5c31\u4f1a\u4ea7\u751f\u53cc\u7cbe\u5ea6\u7ed3\u679c\uff1b\u5426\u5219\u4ea7\u751f\u6574\u6570\u7ed3\u679c\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0294.\u00a0pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u64cd\u4f5c\u7b26</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">OR</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u6216</p>\n<p><code class=\"literal\">5 or 0</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">AND</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u4e0e</p>\n<p><code class=\"literal\">3 and 0</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">NOT</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u975e</p>\n<p><code class=\"literal\">not false</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5e03\u5c14\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 is null</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>value</code></em> <code class=\"literal\">ISNULL|NOTNULL</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7a7a\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 notnull</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 = 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;&gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">!=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 != 5</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e</p>\n<p><code class=\"literal\">5 &lt; 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;= 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e</p>\n<p><code class=\"literal\">5 &gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &gt;= 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">|</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u6216</p>\n<p><code class=\"literal\">1 | 2</code> \u2192 <code class=\"returnvalue\">3</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">#</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5f02\u6216</p>\n<p><code class=\"literal\">1 # 3</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&amp;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u4e0e</p>\n<p><code class=\"literal\">1 &amp; 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">~</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u975e</p>\n<p><code class=\"literal\">~ 1</code> \u2192 <code class=\"returnvalue\">-2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&lt;&lt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5de6\u79fb</p>\n<p><code class=\"literal\">1 &lt;&lt; 2</code> \u2192 <code class=\"returnvalue\">4</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&gt;&gt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u53f3\u79fb</p>\n<p><code class=\"literal\">8 &gt;&gt; 2</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">+</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u52a0\u6cd5</p>\n<p><code class=\"literal\">5 + 4</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u51cf\u6cd5</p>\n<p><code class=\"literal\">3 - 2.0</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">*</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u4e58\u6cd5</p>\n<p><code class=\"literal\">5 * 4</code> \u2192 <code class=\"returnvalue\">20</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">/</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u9664\u6cd5\uff08\u5982\u679c\u4e24\u4e2a\u8f93\u5165\u90fd\u662f\u6574\u6570\uff0c\u5219\u5c06\u7ed3\u679c\u5411\u96f6\u622a\u65ad\uff09</p>\n<p><code class=\"literal\">5 / 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">%</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">3 % 2</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u53d6\u76f8\u53cd\u6570</p>\n<p><code class=\"literal\">- 2.0</code> \u2192 <code class=\"returnvalue\">-2.0</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/16/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0295.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0295</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/16/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0295.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u51fd\u6570</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">abs</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u7edd\u5bf9\u503c</p>\n<p><code class=\"literal\">abs(-17)</code> \u2192 <code class=\"returnvalue\">17</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">debug</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u5c06\u53c2\u6570\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de\u53c2\u6570\u3002</p>\n<p><code class=\"literal\">debug(5432.1)</code> \u2192 <code class=\"returnvalue\">5432.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">double</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u8f6c\u6362\u4e3a double\u3002</p>\n<p><code class=\"literal\">double(5432)</code> \u2192 <code class=\"returnvalue\">5432.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">exp</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u6307\u6570\u51fd\u6570\uff08<code class=\"literal\">e</code> \u7684\u7ed9\u5b9a\u6b21\u5e42\uff09</p>\n<p><code class=\"literal\">exp(1.0)</code> \u2192 <code class=\"returnvalue\">2.718281828459045</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">greatest</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c\u3002</p>\n<p><code class=\"literal\">greatest(5, 4, 3, 2)</code> \u2192 <code class=\"returnvalue\">5</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8fd9\u662f <code class=\"function\">hash_murmur2</code> \u7684\u522b\u540d\u3002</p>\n<p><code class=\"literal\">hash(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_fnv1a</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\" target=\"_top\">FNV-1a hash</a>\u3002</p>\n<p><code class=\"literal\">hash_fnv1a(10, 5432)</code> \u2192 <code class=\"returnvalue\">-7793829335365542153</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_murmur2</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/MurmurHash\" target=\"_top\">MurmurHash2 hash</a>\u3002</p>\n<p><code class=\"literal\">hash_murmur2(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">int</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8f6c\u6362\u4e3a integer\u3002</p>\n<p><code class=\"literal\">int(5.4 + 3.8)</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">least</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c\u3002</p>\n<p><code class=\"literal\">least(5, 4, 3, 2.1)</code> \u2192 <code class=\"returnvalue\">2.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">ln</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u81ea\u7136\u5bf9\u6570</p>\n<p><code class=\"literal\">ln(2.718281828459045)</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">mod</code> ( <em class=\"replaceable\"><code>integer</code></em>, <em class=\"replaceable\"><code>integer</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">mod(54, 32)</code> \u2192 <code class=\"returnvalue\">22</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">permute</code> ( <em class=\"parameter\"><code>i</code></em>, <em class=\"parameter\"><code>size</code></em> [, <em class=\"parameter\"><code>seed</code></em> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\"><em class=\"parameter\"><code>i</code></em>\u7684\u7f6e\u6362\u503c\uff0c\u8303\u56f4\u5728<code class=\"literal\">[0, size)</code>\u5185\u3002\u5b83\u8868\u793a<em class=\"parameter\"><code>i</code></em>\uff08\u6a21<em class=\"parameter\"><code>size</code></em>\uff09\u5728\u6574\u6570<code class=\"literal\">0...size-1</code>\u7684\u4f2a\u968f\u673a\u7f6e\u6362\u4e2d\u7684\u65b0\u4f4d\u7f6e\uff1b\u8be5\u7f6e\u6362\u7531<em class=\"parameter\"><code>seed</code></em>\u53c2\u6570\u5316\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">permute(0, 4)</code> \u2192 <code class=\"returnvalue\">an integer between 0 and 3</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pi</code> () \u2192 <code class=\"returnvalue\">double</code></p>\n<p><span class=\"symbol_font\">\u03c0</span>\u7684\u8fd1\u4f3c\u503c</p>\n<p><code class=\"literal\">pi()</code> \u2192 <code class=\"returnvalue\">3.14159265358979323846</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pow</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p class=\"func_signature\"><code class=\"function\">power</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p><em class=\"parameter\"><code>x</code></em> \u7684 <em class=\"parameter\"><code>y</code></em> \u6b21\u5e42</p>\n<p><code class=\"literal\">pow(2.0, 10)</code> \u2192 <code class=\"returnvalue\">1024.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u5747\u5300\u5206\u5e03\u968f\u673a\u6574\u6570\u3002</p>\n<p><code class=\"literal\">random(1, 10)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_exponential</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u6307\u6570\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_exponential(1, 10, 3.0)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_gaussian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u9ad8\u65af\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_gaussian(1, 10, 2.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_zipfian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684 Zipfian \u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_zipfian(1, 10, 1.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">sqrt</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u5e73\u65b9\u6839</p>\n<p><code class=\"literal\">sqrt(2.0)</code> \u2192 <code class=\"returnvalue\">1.414213562</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002parameter \u5141\u8bb8\u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n<p lang=\"zh\">pgbench \u7684\u5b9e\u73b0\u57fa\u4e8e Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002\u7531\u4e8e\u8be5\u7b97\u6cd5\u7684\u9650\u5236\uff0cparameter \u7684\u53d6\u503c\u9650\u5236\u5728 [1.001, 1000] \u8303\u56f4\u5185\u3002</p>\n</li>\n</ul>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u8bbe\u8ba1\u4ee5\u975e\u5747\u5300\u65b9\u5f0f\u9009\u62e9\u884c\u7684\u57fa\u51c6\u6d4b\u8bd5\u65f6\uff0c\u8981\u6ce8\u610f\u88ab\u9009\u4e2d\u7684\u884c\u53ef\u80fd\u4e0e\u5176\u4ed6\u6570\u636e\u76f8\u5173\uff0c\u4f8b\u5982\u4e0e\u5e8f\u5217\u751f\u6210\u7684 ID \u6216\u7269\u7406\u884c\u987a\u5e8f\u76f8\u5173\uff0c\u8fd9\u53ef\u80fd\u4f1a\u626d\u66f2\u6027\u80fd\u6d4b\u91cf\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u4e3a\u907f\u514d\u8fd9\u4e00\u70b9\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"function\">permute</code>\u51fd\u6570\uff0c\u6216\u91c7\u7528\u5176\u4ed6\u5177\u6709\u7c7b\u4f3c\u6548\u679c\u7684\u989d\u5916\u6b65\u9aa4\uff0c\u5bf9\u9009\u4e2d\u7684\u884c\u8fdb\u884c\u6253\u4e71\u5e76\u79fb\u9664\u6b64\u7c7b\u76f8\u5173\u6027\u3002</p>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570<code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code>\u548c<code class=\"literal\">hash_fnv1a</code>\u90fd\u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f1a\u4f7f\u7528<code class=\"literal\">:default_seed</code>\u7684\u503c\uff1b\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c<code class=\"literal\">-D</code>\u9009\u9879\u8986\u76d6\uff0c\u5426\u5219\u8be5\u503c\u4f1a\u88ab\u968f\u673a\u521d\u59cb\u5316\u3002</p>\n<p lang=\"zh\">permute \u63a5\u53d7\u8f93\u5165\u503c\u3001\u5927\u5c0f\u548c\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5b83\u5728 [0, size) \u8303\u56f4\u5185\u751f\u6210\u6574\u6570\u7684\u4f2a\u968f\u673a\u6392\u5217\uff0c\u5e76\u8fd4\u56de\u8f93\u5165\u503c\u5728\u6392\u5217\u4e2d\u7684\u7d22\u5f15\u3002\u6240\u9009\u6392\u5217\u7531\u79cd\u5b50\u51b3\u5b9a\uff0c\u672a\u6307\u5b9a\u79cd\u5b50\u65f6\u9ed8\u8ba4\u4f7f\u7528 :default_seed\u3002\u4e0e\u54c8\u5e0c\u51fd\u6570\u4e0d\u540c\uff0cpermute \u4fdd\u8bc1\u8f93\u51fa\u503c\u65e2\u65e0\u51b2\u7a81\u4e5f\u65e0\u7a7a\u7f3a\u3002\u533a\u95f4\u5916\u7684\u8f93\u5165\u503c\u4f1a\u5bf9 size \u53d6\u6a21\u3002\u5982\u679c size \u4e0d\u662f\u6b63\u6570\uff0c\u51fd\u6570\u4f1a\u62a5\u9519\u3002permute \u53ef\u7528\u4e8e\u6253\u6563 random_zipfian \u6216 random_exponential \u7b49\u975e\u5747\u5300\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f7f\u66f4\u9891\u7e41\u62bd\u53d6\u7684\u503c\u4e0d\u4f1a\u5b58\u5728\u7b80\u5355\u7684\u5173\u8054\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e0a\u53ef\u80fd\u51fa\u73b0\u7684\u4e00\u7c7b\u5178\u578b\u5b9e\u9645\u8d1f\u8f7d\uff1a\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u8fc7\u91cf\u8d1f\u8f7d\u3002</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, :size, 1.07)\n\\set k 1 + permute(:r, :size)\n</pre>\n<p lang=\"zh\">\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u82e5\u5e72\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u53ef\u9009\u79cd\u5b50\u53c2\u6570\u5c31\u5f88\u6709\u7528\uff1a</p>\n<pre class=\"programlisting\">\\set k1 1 + permute(:r, :size, :default_seed + 123)\n\\set k2 1 + permute(:r, :size, :default_seed + 321)\n</pre>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u7528<code class=\"function\">hash</code>\u8fd1\u4f3c\u5b9e\u73b0\u7c7b\u4f3c\u7684\u884c\u4e3a\uff1a</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, 100 * :size, 1.07)\n\\set k 1 + abs(hash(:r)) % :size\n</pre>\n<p lang=\"zh\">\u4f46\u662f\uff0c\u7531\u4e8e<code class=\"function\">hash</code>\u4f1a\u4ea7\u751f\u51b2\u7a81\uff0c\u6709\u4e9b\u503c\u5c06\u6c38\u8fdc\u4e0d\u53ef\u8fbe\uff0c\u800c\u53e6\u4e00\u4e9b\u503c\u5219\u4f1a\u6bd4\u539f\u59cb\u5206\u5e03\u6240\u9884\u671f\u7684\u66f4\u5e38\u51fa\u73b0\u3002</p>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u6587\u4ef6\u7684\u6bcf\u4e00\u884c\u63cf\u8ff0\u4e00\u4e2a\u4e8b\u52a1\u3002\u5b83\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>client_id</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8fd0\u884c\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>transaction_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edf\u8ba1\u8be5\u4f1a\u8bdd\u5df2\u6267\u884c\u7684\u4e8b\u52a1\u6570\u91cf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u8017\u65f6\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>script_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8be5\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5f53\u901a\u8fc7<code class=\"option\">-f</code>\u6216<code class=\"option\">-b</code>\u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_epoch</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_us</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\u7684\u5c0f\u6570\u79d2\u90e8\u5206\uff0c\u4ee5\u5fae\u79d2\u4e3a\u5355\u4f4d</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>schedule_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff0c\u5373\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff08\u4ec5\u5728\u6307\u5b9a<code class=\"option\">--rate</code>\u65f6\u51fa\u73b0\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4e8b\u52a1\u6267\u884c\u671f\u95f4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08\u4ec5\u5f53 --max-tries \u4e0d\u7b49\u4e8e\u4e00\u65f6\u51fa\u73b0\uff09</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5f53\u540c\u65f6\u4f7f\u7528<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\u65f6\uff0c\u8df3\u8fc7\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">skipped</code>\u3002\u5982\u679c\u4e8b\u52a1\u4ee5\u5931\u8d25\u7ed3\u675f\uff0c\u5176<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">failed</code>\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u4f1a\u6839\u636e\u5931\u8d25\u7c7b\u578b\u62a5\u544a\u4e3a<code class=\"literal\">serialization</code>\u6216<code class=\"literal\">deadlock</code>\uff08\u8be6\u89c1<a class=\"xref\" href=\"/docs/16/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5305\u542b\u5931\u8d25\u4e0e\u91cd\u8bd5\u7684\u65e5\u5fd7\u7247\u6bb5\uff0c\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u8bbe\u4e3a 10\uff08\u6ce8\u610f\u989d\u5916\u7684 retries \u5217\uff09\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 failed 0 1499414498 84905 9\n2 0 failed 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u7684\u7c7b\u578b\u5c06\u5728<em class=\"replaceable\"><code>time</code></em>\u4e2d\u62a5\u544a\uff0c\u5982\u4e0b\u6240\u793a\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 serialization 0 1499414498 84905 9\n2 0 serialization 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--aggregate-interval</code>\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u4f1a\u91c7\u7528\u4e0d\u540c\u7684\u683c\u5f0f\u3002\u6bcf\u4e00\u884c\u65e5\u5fd7\u63cf\u8ff0\u4e00\u4e2a\u805a\u5408\u65f6\u95f4\u95f4\u9694\uff0c\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>interval_start</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u7684\u8d77\u59cb\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>num_transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u5185\u7684\u4e8b\u52a1\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u603b\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>skipped</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56e0\u4e3a\u542f\u52a8\u65f6\u95f4\u4f1a\u592a\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retried</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>serialization_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u4e32\u884c\u5316\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>deadlock_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u6b7b\u9501\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4f7f\u7528\u8fd9\u4e9b\u9009\u9879\u751f\u6210\u7684\u793a\u4f8b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\"><strong class=\"userinput\"><code>pgbench --aggregate-interval=10 --time=20 --client=10 --log --rate=1000 --latency-limit=10 --failures-detailed --max-tries=10 test</code></strong>\n\n1650260552 5178 26171317 177284491527 1136 44462 2647617 7321113867 0 9866 64 7564 28340 4148 0\n1650260562 4808 25573984 220121792172 1171 62083 3037380 9666800914 0 9998 598 7392 26621 4527 0\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u62a5\u544a</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\uff0c<span class=\"application\">pgbench</span>\u4e3a\u6bcf\u4e2a\u8bed\u53e5\u6536\u96c6\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">latency</code> \u2014 \u6bcf\u6761\u8bed\u53e5\u7684\u8017\u65f6\u3002<span class=\"application\">pgbench</span>\u62a5\u544a\u8be5\u8bed\u53e5\u6240\u6709\u6210\u529f\u6267\u884c\u7684\u5e73\u5747\u503c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u7684\u5931\u8d25\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/16/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u53d1\u751f\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/16/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u62a5\u544a\u4ec5\u5728<code class=\"option\">--max-tries</code>\u9009\u9879\u4e0d\u7b49\u4e8e1\u65f6\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6240\u6709\u6570\u503c\u90fd\u662f\u9488\u5bf9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u8ba1\u7b97\u7684\uff0c\u5e76\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u5c06\u7c7b\u4f3c\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nnumber of transactions above the 50.0 ms latency limit: 1311/10000 (13.110 %)\nlatency average = 28.488 ms\nlatency stddev = 21.009 ms\ninitial connection time = 69.068 ms\ntps = 346.224794 (without initial connection time)\nstatement latencies in milliseconds and failures:\n   0.012  0  \\set aid random(1, 100000 * :scale)\n   0.002  0  \\set bid random(1, 1 * :scale)\n   0.002  0  \\set tid random(1, 10 * :scale)\n   0.002  0  \\set delta random(-5000, 5000)\n   0.319  0  BEGIN;\n   0.834  0  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n   0.641  0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  11.126  0  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  12.961  0  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n   0.634  0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n   1.957  0  END;\n</pre>\n<p lang=\"zh\">\u4f7f\u7528\u53ef\u4e32\u884c\u5316\u9ed8\u8ba4\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\u7684\u9ed8\u8ba4\u811a\u672c\u7684\u53e6\u4e00\u4e2a\u8f93\u51fa\u793a\u4f8b\uff08<code class=\"command\">PGOPTIONS='-c default_transaction_isolation=serializable' pgbench ...</code>\uff09\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 10\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 6317/10000\nnumber of failed transactions: 3683 (36.830%)\nnumber of transactions retried: 7667 (76.670%)\ntotal number of retries: 45339\nnumber of transactions above the 50.0 ms latency limit: 106/6317 (1.678 %)\nlatency average = 17.016 ms\nlatency stddev = 13.283 ms\ninitial connection time = 45.017 ms\ntps = 186.792667 (without initial connection time)\nstatement latencies in milliseconds, failures and retries:\n  0.006     0      0  \\set aid random(1, 100000 * :scale)\n  0.001     0      0  \\set bid random(1, 1 * :scale)\n  0.001     0      0  \\set tid random(1, 10 * :scale)\n  0.001     0      0  \\set delta random(-5000, 5000)\n  0.385     0      0  BEGIN;\n  0.773     0      1  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n  0.624     0      0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  1.098   320   3762  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  0.582  3363  41576  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n  0.465     0      0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n  1.933     0      0  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"FAILURES-AND-RETRIES\">\n<h3 lang=\"zh\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</h3>\n<p lang=\"zh\">\u5728\u6267\u884c<span class=\"application\">pgbench</span>\u65f6\uff0c\u6709\u4e09\u79cd\u4e3b\u8981\u7c7b\u578b\u7684\u9519\u8bef\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e3b\u7a0b\u5e8f\u9519\u8bef\u3002\u5b83\u4eec\u6700\u4e3a\u4e25\u91cd\uff0c\u603b\u662f\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\uff0c\u5e76\u663e\u793a\u76f8\u5e94\u7684\u9519\u8bef\u6d88\u606f\u3002\u5b83\u4eec\u5305\u62ec\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\" style=\"list-style-type: circle;\">\n<li class=\"listitem\">\n<p><span class=\"application\">pgbench</span>\u5f00\u59cb\u6267\u884c\u65f6\u7684\u9519\u8bef\uff08\u4f8b\u5982\u9009\u9879\u503c\u65e0\u6548\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u521d\u59cb\u5316\u6a21\u5f0f\u4e2d\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u7528\u4e8e\u521b\u5efa\u5185\u7f6e\u811a\u672c\u6240\u9700\u8868\u7684\u67e5\u8be2\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5728\u7ebf\u7a0b\u542f\u52a8\u4e4b\u524d\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\u65e0\u6cd5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3001\u5143\u547d\u4ee4\u4e2d\u6709\u8bed\u6cd5\u9519\u8bef\u3001\u7ebf\u7a0b\u521b\u5efa\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u6c38\u8fdc\u4e0d\u8be5\u53d1\u751f\u2026\u2026\uff09\u3002</p>\n</li>\n</ul>\n</div>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u7ebf\u7a0b\u5728\u7ba1\u7406\u5176\u5ba2\u6237\u7aef\u65f6\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u5ba2\u6237\u7aef\u65e0\u6cd5\u5f00\u59cb\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u6216\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\u6240\u7528\u7684\u5957\u63a5\u5b57\u5df2\u7ecf\u5931\u6548\uff09\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8be5\u7ebf\u7a0b\u7684\u6240\u6709\u5ba2\u6237\u7aef\u90fd\u4f1a\u505c\u6b62\uff0c\u800c\u5176\u4ed6\u7ebf\u7a0b\u7ee7\u7eed\u5de5\u4f5c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\u3002\u53ea\u6709\u5728\u53d1\u751f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u4e0d\u5e94\u53d1\u751f\uff09\u65f6\uff0c\u5b83\u4eec\u624d\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\u5e76\u663e\u793a\u76f8\u5e94\u9519\u8bef\u6d88\u606f\u3002\u5426\u5219\uff0c\u6700\u574f\u60c5\u51b5\u4e0b\u53ea\u4f1a\u4e2d\u6b62\u5931\u8d25\u7684\u5ba2\u6237\u7aef\uff0c\u800c\u5176\u4ed6\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\uff08\u4f46\u67d0\u4e9b\u5ba2\u6237\u7aef\u9519\u8bef\u4f1a\u5728\u4e0d\u4e2d\u6b62\u5ba2\u6237\u7aef\u7684\u60c5\u51b5\u4e0b\u5904\u7406\u5e76\u5355\u72ec\u62a5\u544a\uff0c\u89c1\u4e0b\u6587\uff09\u3002\u672c\u8282\u540e\u7eed\u9ed8\u8ba4\u8ba8\u8bba\u7684\u90fd\u662f\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\uff0c\u800c\u4e0d\u662f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5ba2\u6237\u7aef\u5728\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u65f6\u4f1a\u4e2d\u6b62\u8fd0\u884c\uff1b\u4f8b\u5982\uff0c\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e22\u5931\uff0c\u6216\u8005\u811a\u672c\u5728\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5c1a\u672a\u5b8c\u6210\u65f6\u5c31\u7ed3\u675f\u4e86\u3002\u53e6\u5916\uff0c\u5982\u679c SQL \u6216\u5143\u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u4e14\u539f\u56e0\u4e0d\u662f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\uff0c\u5ba2\u6237\u7aef\u4e5f\u4f1a\u4e2d\u6b62\u3002\u5426\u5219\uff0c\u5982\u679c SQL \u547d\u4ee4\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5f53\u524d\u4e8b\u52a1\u4f1a\u56de\u6eda\uff0c\u4e5f\u5305\u62ec\u5c06\u5ba2\u6237\u7aef\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u6b64\u4e8b\u52a1\u8fd0\u884c\u4e4b\u524d\u7684\u72b6\u6001\uff08\u5047\u8bbe\u4e00\u4e2a\u4e8b\u52a1\u811a\u672c\u53ea\u5305\u542b\u4e00\u4e2a\u4e8b\u52a1\uff1b\u8be6\u89c1<a class=\"xref\" href=\"/docs/16/pgbench.html#TRANSACTIONS-AND-SCRIPTS\" title=\"\u5728pgbench\u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f\">\u5728 pgbench \u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f</a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff09\u3002\u53d1\u751f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4f1a\u5728\u56de\u6eda\u540e\u91cd\u65b0\u6267\u884c\uff0c\u76f4\u5230\u6210\u529f\u5b8c\u6210\uff0c\u6216\u8005\u8fbe\u5230\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u7531<code class=\"option\">--max-tries</code>\u6307\u5b9a\uff09\u3001\u8fbe\u5230\u6700\u5927\u91cd\u8bd5\u65f6\u95f4\uff08\u7531<code class=\"option\">--latency-limit</code>\u6307\u5b9a\uff09\uff0c\u6216\u8005\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\uff08\u7531<code class=\"option\">--time</code>\u6307\u5b9a\uff09\u3002\u5982\u679c\u6700\u540e\u4e00\u6b21\u5c1d\u8bd5\u4ecd\u7136\u5931\u8d25\uff0c\u8be5\u4e8b\u52a1\u4f1a\u88ab\u62a5\u544a\u4e3a\u5931\u8d25\uff0c\u4f46\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\uff0c\u800c\u662f\u7ee7\u7eed\u5de5\u4f5c\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a --max-tries \u9009\u9879\uff0c\u4e8b\u52a1\u5728\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u4e0d\u4f1a\u91cd\u8bd5\uff0c\u56e0\u4e3a\u5176\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u53ef\u4ee5\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u5e76\u914d\u5408 --latency-limit\uff0c\u4ec5\u9650\u5236\u5c1d\u8bd5\u7684\u6700\u957f\u603b\u8017\u65f6\u3002\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\u65f6\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 --time \u9650\u5236\u57fa\u51c6\u6d4b\u8bd5\u65f6\u957f\u3002</p>\n<p lang=\"zh\">\u5728\u91cd\u590d\u5305\u542b\u591a\u4e2a\u4e8b\u52a1\u7684\u811a\u672c\u65f6\u8981\u5c0f\u5fc3\uff1a\u811a\u672c\u603b\u662f\u5b8c\u5168\u91cd\u8bd5\uff0c\u56e0\u6b64\u6210\u529f\u7684\u4e8b\u52a1\u53ef\u80fd\u4f1a\u6267\u884c\u591a\u6b21\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 shell \u547d\u4ee4\u91cd\u8bd5\u4e8b\u52a1\u65f6\u8981\u5c0f\u5fc3\u3002\u4e0e SQL \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u540c\uff0cshell \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u4f1a\u56de\u6eda\uff0c\u552f\u4e00\u7684\u4f8b\u5916\u662f<code class=\"command\">\\setshell</code>\u547d\u4ee4\u8bbe\u7f6e\u7684\u53d8\u91cf\u503c\u3002</p>\n</div>\n<p lang=\"zh\">\u6210\u529f\u4e8b\u52a1\u7684\u5ef6\u8fdf\u5305\u62ec\u4e8b\u52a1\u6267\u884c\u7684\u6574\u4e2a\u65f6\u95f4\uff0c\u5305\u62ec\u56de\u6eda\u548c\u91cd\u8bd5\u3002\u5ef6\u8fdf\u4ec5\u9488\u5bf9\u6210\u529f\u7684\u4e8b\u52a1\u548c\u547d\u4ee4\u8fdb\u884c\u6d4b\u91cf\uff0c\u800c\u4e0d\u9488\u5bf9\u5931\u8d25\u7684\u4e8b\u52a1\u6216\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u4e3b\u62a5\u544a\u5305\u542b\u5931\u8d25\u4e8b\u52a1\u7684\u6570\u91cf\u3002\u5982\u679c --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1\uff0c\u4e3b\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u91cd\u8bd5\u76f8\u5173\u7edf\u8ba1\uff1a\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u603b\u6570\u548c\u91cd\u8bd5\u603b\u6b21\u6570\u3002\u6bcf\u811a\u672c\u62a5\u544a\u7ee7\u627f\u4e3b\u62a5\u544a\u7684\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u6bcf\u8bed\u53e5\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5e0c\u671b\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\u6309\u57fa\u672c\u7c7b\u578b\u5bf9\u5931\u8d25\u8fdb\u884c\u5206\u7ec4\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\u3002\u5982\u679c\u8fd8\u5e0c\u671b\u6309\u7c7b\u578b\u533a\u5206\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u4e86\u591a\u5c11\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--verbose-errors</code>\u9009\u9879\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.10\">\n<h3 lang=\"zh\">\u8868\u8bbf\u95ee\u65b9\u6cd5</h3>\n<p lang=\"zh\">\u53ef\u4ee5\u4e3a pgbench \u8868\u6307\u5b9a<a class=\"link\" href=\"/docs/16/tableam.html\" title=\"\u7b2c\u00a063\u00a0\u7ae0\u00a0\u8868\u8bbf\u95ee\u65b9\u6cd5\u63a5\u53e3\u5b9a\u4e49\">\u8868\u8bbf\u95ee\u65b9\u6cd5</a>\u3002\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGOPTIONS</code>\u7528\u4e8e\u6307\u5b9a\u901a\u8fc7\u547d\u4ee4\u884c\u4f20\u9012\u7ed9 PostgreSQL \u7684\u6570\u636e\u5e93\u914d\u7f6e\u9009\u9879\uff08\u89c1<a class=\"xref\" href=\"/docs/16/config-setting.html#CONFIG-SETTING-SHELL\" title=\"20.1.4.\u00a0\u901a\u8fc7 Shell \u5f71\u54cd\u53c2\u6570\">\u7b2c\u00a020.1.4\u00a0\u8282</a>\uff09\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u7528\u5982\u4e0b\u65b9\u5f0f\u4e3a pgbench \u521b\u5efa\u7684\u8868\u6307\u5b9a\u4e00\u4e2a\u540d\u4e3a<code class=\"literal\">wuzza</code>\u7684\u5047\u60f3\u9ed8\u8ba4\u8868\u8bbf\u95ee\u65b9\u6cd5\uff1a</p>\n<pre class=\"programlisting\">PGOPTIONS='-c default_table_access_method=wuzza'\n</pre>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.11\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.12\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/16/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.9.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/16/pgbench.html", "method": "same-major semantic node", "sha256": "6ab2cf183a3818b2fbbefa1aae58bdad0a4dc437d5d615bff04b0815580b61f4", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[4]/a[0]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[55]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[57]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/h2[0]", "#PGBENCH/div[7]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[7]/h2[0]", "#PGBENCH/div[7]/p[2]", "#PGBENCH/div[7]/p[3]", "#PGBENCH/div[8]/div[10]/h3[0]", "#PGBENCH/div[8]/div[10]/p[1]", "#PGBENCH/div[8]/div[10]/p[2]", "#PGBENCH/div[8]/div[10]/p[4]", "#PGBENCH/div[8]/div[10]/p[5]", "#PGBENCH/div[8]/div[11]/h3[0]", "#PGBENCH/div[8]/div[11]/p[1]", "#PGBENCH/div[8]/div[1]/h3[0]", "#PGBENCH/div[8]/div[1]/h3[0]/span[1]", "#PGBENCH/div[8]/div[1]/p[1]", "#PGBENCH/div[8]/div[1]/p[2]", "#PGBENCH/div[8]/div[1]/p[4]", "#PGBENCH/div[8]/div[1]/p[5]", "#PGBENCH/div[8]/div[2]/div[3]/h3[0]", "#PGBENCH/div[8]/div[2]/div[3]/p[1]", "#PGBENCH/div[8]/div[2]/div[3]/p[2]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[4]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[5]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[1]", "#PGBENCH/div[8]/div[2]/h3[0]", "#PGBENCH/div[8]/div[2]/p[1]", "#PGBENCH/div[8]/div[2]/p[2]", "#PGBENCH/div[8]/div[2]/p[4]", "#PGBENCH/div[8]/div[2]/p[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[3]/div[2]/p[0]", "#PGBENCH/div[8]/div[3]/h3[0]", "#PGBENCH/div[8]/div[3]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[18]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[4]/div[2]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[8]/div[4]/div[6]/p[1]", "#PGBENCH/div[8]/div[4]/div[6]/p[2]", "#PGBENCH/div[8]/div[4]/h3[0]", "#PGBENCH/div[8]/div[4]/p[10]", "#PGBENCH/div[8]/div[4]/p[12]", "#PGBENCH/div[8]/div[4]/p[14]", "#PGBENCH/div[8]/div[4]/p[15]", "#PGBENCH/div[8]/div[4]/p[17]", "#PGBENCH/div[8]/div[4]/p[1]", "#PGBENCH/div[8]/div[4]/p[4]", "#PGBENCH/div[8]/div[4]/p[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[5]/h3[0]", "#PGBENCH/div[8]/div[5]/p[12]", "#PGBENCH/div[8]/div[5]/p[14]", "#PGBENCH/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[5]/p[4]", "#PGBENCH/div[8]/div[5]/p[5]", "#PGBENCH/div[8]/div[5]/p[7]", "#PGBENCH/div[8]/div[5]/p[9]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[6]/h3[0]", "#PGBENCH/div[8]/div[6]/p[1]", "#PGBENCH/div[8]/div[6]/p[3]", "#PGBENCH/div[8]/div[6]/p[5]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[7]/h3[0]", "#PGBENCH/div[8]/div[7]/p[10]", "#PGBENCH/div[8]/div[7]/p[1]", "#PGBENCH/div[8]/div[7]/p[3]", "#PGBENCH/div[8]/div[7]/p[4]", "#PGBENCH/div[8]/div[7]/p[5]", "#PGBENCH/div[8]/div[7]/p[7]", "#PGBENCH/div[8]/div[7]/p[9]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[8]/div[4]/p[2]", "#PGBENCH/div[8]/div[8]/div[4]/p[3]", "#PGBENCH/div[8]/div[8]/p[1]", "#PGBENCH/div[8]/div[8]/p[3]", "#PGBENCH/div[8]/div[8]/p[5]", "#PGBENCH/div[8]/div[8]/p[7]", "#PGBENCH/div[8]/div[9]/h3[0]", "#PGBENCH/div[8]/div[9]/p[1]", "#PGBENCH/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/16/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/16/facts/0/label": "Documented executable", "/versions/16/facts/0/value": "pgbench", "/versions/16/facts/1/label": "Executable version", "/versions/16/facts/2/label": "Reference inventory", "/versions/16/facts/2/value": "Client applications", "/versions/16/facts/3/label": "Option definition groups", "/versions/16/tables/0/title": "Documented options", "/versions/16/tables/1/title": "Environment variables", "/versions/16/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/16/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/16/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/16/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/16/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/16/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/16/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/16/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/16/tables/0/rows/8/summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "/versions/16/tables/0/rows/9/summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "/versions/16/tables/0/columns/0/label": "Option and arguments", "/versions/16/tables/0/columns/1/label": "Description", "/versions/16/tables/0/rows/10/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/16/tables/0/rows/11/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/16/tables/0/rows/12/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/16/tables/0/rows/13/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/16/tables/0/rows/14/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/16/tables/0/rows/15/summary": "Print debugging output.", "/versions/16/tables/0/rows/16/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/16/tables/0/rows/17/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/16/tables/0/rows/18/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/16/tables/0/rows/19/summary": "Write information about each transaction to a log file. See below for details.", "/versions/16/tables/0/rows/20/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/16/tables/0/rows/21/summary": "Protocol to use for submitting queries to the server:", "/versions/16/tables/0/rows/22/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/16/tables/0/rows/23/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/16/tables/0/rows/24/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "/versions/16/tables/0/rows/25/summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "/versions/16/tables/0/rows/26/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/16/tables/0/rows/27/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/16/tables/0/rows/28/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/16/tables/0/rows/29/summary": "Number of transactions each client runs. Default is 10.", "/versions/16/tables/0/rows/30/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/16/tables/0/rows/31/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/16/tables/0/rows/32/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/16/tables/0/rows/33/summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "/versions/16/tables/0/rows/34/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/16/tables/0/rows/35/summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "/versions/16/tables/0/rows/36/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/16/tables/0/rows/37/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/16/tables/0/rows/38/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/16/tables/0/rows/39/summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "/versions/16/tables/0/rows/40/summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "/versions/16/tables/0/rows/41/summary": "The database server's host name", "/versions/16/tables/0/rows/42/summary": "The database server's port number", "/versions/16/tables/0/rows/43/summary": "The user name to connect as", "/versions/16/tables/0/rows/44/summary": "Print the pgbench version and exit.", "/versions/16/tables/0/rows/45/summary": "Show help about pgbench command line arguments, and exit.", "/versions/16/tables/1/columns/0/label": "Variable", "/versions/16/tables/1/columns/1/label": "Meaning", "/versions/16/tables/1/rows/0/description": "Default connection parameters."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "2c41ed5a93f85a7c713c690986dd5b7d9a120b8d880a5f62340704ffa7cfeeaa"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option with version 14 or later of PostgreSQL to speed up subsequent VACUUM , unless partitions are enabled. Using g causes logging to print one message every 100,000 rows while generating data for the pgbench_accounts table. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "signature": "--partition-method= NAME", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "signature": "--partitions= NUM", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-d", "--debug"], "signature": "-d --debug", "description": "Print debugging output."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 55 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "signature": "-r --report-per-command", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--failures-detailed"], "signature": "--failures-detailed", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "signature": "--max-tries= number_of_tries", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= seed", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "signature": "--show-script= scriptname", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "signature": "--verbose-errors", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}]}, "comparison_hash": "9979b73486f6c5fd952acd238b6556ecf38cec84b1c2a856539e0542e8c72d1a", "manual_language": "zh"}, "17": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "17.11"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "47"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-INITIALIZE", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "text": "--partition-method= NAME"}}, {"summary": "\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-PARTITIONS", "text": "--partitions= NUM"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-TABLESPACE", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-BUILTIN", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-CLIENT", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-CONNECT", "text": "-C --connect"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-DEFINE", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-FILE", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-JOBS", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-LOG", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-PROTOCOL", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528 --max-tries \u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-PROGRESS", "text": "-P sec --progress= sec"}}, {"summary": "\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "text": "-r --report-per-command"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-RATE", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-TIME", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "text": "--aggregate-interval= seconds"}}, {"summary": "\u5f53\u4efb\u4e00\u5ba2\u6237\u7aef\u56e0\u9519\u8bef\u88ab\u4e2d\u6b62\u65f6\uff0c\u7acb\u5373\u9000\u51fa\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u5373\u4f7f\u67d0\u4e2a\u5ba2\u6237\u7aef\u88ab\u4e2d\u6b62\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4ecd\u53ef\u6309 -t \u6216 -T \u7684\u8bbe\u5b9a\u7ee7\u7eed\u8fd0\u884c\uff0c\u6b64\u65f6 pgbench \u4f1a\u8f93\u51fa\u4e0d\u5b8c\u6574\u7684\u7ed3\u679c\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-EXIT-ON-ABORT", "text": "--exit-on-abort"}}, {"summary": "\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "text": "--failures-detailed"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "text": "--log-prefix= prefix"}}, {"summary": "\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "text": "--max-tries= number_of_tries"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 seed \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 seed \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "text": "--random-seed= seed"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "text": "--sampling-rate= rate"}}, {"summary": "\u5c06\u5185\u7f6e\u811a\u672c scriptname \u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "text": "--show-script= scriptname"}}, {"summary": "\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1 \u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5 \u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "text": "--verbose-errors"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-DEBUG", "text": "--debug"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-USERNAME", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/17/pgbench.html#PGBENCH-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-INITIALIZE", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option with version 14 or later of PostgreSQL to speed up subsequent VACUUM , except on the pgbench_accounts table if partitions are enabled. Using g causes logging to print one message every 100,000 rows while generating data for all tables. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-QUIET", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "signature": "--partition-method= NAME", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "signature": "--partitions= NUM", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-PARTITIONS", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-TABLESPACE", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-BUILTIN", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-CLIENT", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-CONNECT", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-DEFINE", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-FILE", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-JOBS", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-LOG", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-PROTOCOL", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 53 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "signature": "-P sec --progress= sec", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-PROGRESS", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "signature": "-r --report-per-command", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-RATE", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-TIME", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--exit-on-abort"], "summary": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case.", "signature": "--exit-on-abort", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-EXIT-ON-ABORT", "description": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case. Note that serialization failures or deadlock failures do not abort the client, so they are not affected by this option. See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--failures-detailed"], "summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "signature": "--failures-detailed", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "signature": "--max-tries= number_of_tries", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= seed", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "signature": "--show-script= scriptname", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "signature": "--verbose-errors", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--debug"], "summary": "Print debugging output.", "signature": "--debug", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-DEBUG", "description": "Print debugging output."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-HOST", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-PORT", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-USERNAME", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-VERSION", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/17/pgbench.html#PGBENCH-OPTION-HELP", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "label": "17.11", "major": "17", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/17/postgresql-17-A4.pdf", "bytes": 15521293, "pages": 3099, "sha256": "1991354df0dc89e70ec39328c28988ef8b19c6a93671dab3893650b63e9f4e36", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/17/postgresql-17-US.pdf", "bytes": 15398150, "pages": 3270, "sha256": "07696c8f38abf31babf22d2db337093936e7c472d2af36d050b000c49bbcf52c", "built_at": "2026-09-26"}}, "tree": "17", "index": "index.html", "major": "17", "pages": 1143, "release": "17.11", "source_url": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "revision": "58419c9b0dd42cb34c8d53695bb025a7e582edf55ccd4c5bcb1c2c7c71a37487", "evidence_kind": "English manual and source declarations", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "sources": [{"url": "https://pg.center/docs/17/pgbench.html", "file": "pgbench.html", "label": "17.11 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "9971a6dfcacb2561d80842bf2c6ac56d905aad3340abde2da4b502d29a7d45a3", "language": "en", "original_url": "/docs/17/pgbench.html"}, {"url": "https://pg.center/docs/17/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "3194fc72ddad8e2fcba55f8e007f83413cb352146cb65aaa9457a18d0314ee1b", "language": "en", "original_url": "/docs/17/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u5178\u578b\u7684<span class=\"application\">pgbench</span>\u8f93\u51fa\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nlatency average = 11.013 ms\nlatency stddev = 7.351 ms\ninitial connection time = 45.758 ms\ntps = 896.967014 (without initial connection time)\n</pre>\n<p lang=\"zh\">\u524d\u4e03\u884c\u7ed9\u51fa\u4e86\u82e5\u5e72\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u7b2c\u516d\u884c\u62a5\u544a\u4e86\u51fa\u73b0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u65f6\u4e8b\u52a1\u5141\u8bb8\u7684\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/17/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u7b2c\u516b\u884c\u62a5\u544a\u5b9e\u9645\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u4e8b\u52a1\u6570\uff08\u540e\u8005\u4ec5\u4e3a\u5ba2\u6237\u7aef\u6570\u91cf\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u6216\u8005\u67d0\u4e9b SQL \u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u5426\u5219\u4e24\u8005\u5e94\u5f53\u76f8\u7b49\u3002\uff08\u5728<code class=\"option\">-T</code>\u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u4e8b\u52a1\u6570\u3002\uff09\u4e0b\u4e00\u884c\u62a5\u544a\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\u7684\u4e8b\u52a1\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/17/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u6700\u540e\u4e00\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">[<span class=\"optional\">-d</span>] <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">[<span class=\"optional\">--dbname=</span>]<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u5219\u4f7f\u7528\u8fde\u63a5\u6307\u5b9a\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INITIALIZE\"><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS\"><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002<em class=\"replaceable\"><code>init_steps</code></em>\u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-D\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-T\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-G\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\u6216<code class=\"literal\">G</code>\uff08\u5728\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">g</code>\uff08\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c\u6570\u636e\u7531<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u751f\u6210\uff0c\u518d\u901a\u8fc7<code class=\"command\">COPY</code>\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4f1a\u5927\u91cf\u5360\u7528\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u5e26\u5bbd\u3002\u5bf9\u4e8e 14 \u53ca\u4ee5\u4e0a\u7248\u672c\u7684<span class=\"productname\">PostgreSQL</span>\uff0c<code class=\"command\">pgbench</code>\u4f1a\u4f7f\u7528<code class=\"option\">FREEZE</code>\u9009\u9879\u88c5\u8f7d\u6570\u636e\uff0c\u4ee5\u52a0\u5feb\u540e\u7eed\u7684<code class=\"command\">VACUUM</code>\uff1b\u4f46\u542f\u7528\u5206\u533a\u65f6\uff0c<code class=\"literal\">pgbench_accounts</code>\u8868\u9664\u5916\u3002\u4f7f\u7528<code class=\"literal\">g</code>\u65f6\uff0c\u5728\u4e3a\u6240\u6709\u8868\u751f\u6210\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6bcf\u751f\u6210 100,000 \u884c\u4f1a\u8f93\u51fa\u4e00\u6761\u65e5\u5fd7\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">G</code>\uff08\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u53ea\u53d1\u9001\u8f83\u5c0f\u7684\u67e5\u8be2\uff0c\u968f\u540e\u5b9e\u9645\u6570\u636e\u5728\u670d\u52a1\u5668\u7aef\u751f\u6210\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u9700\u8981\u5927\u91cf\u5e26\u5bbd\uff0c\u4f46\u670d\u52a1\u5668\u4f1a\u627f\u62c5\u66f4\u591a\u5de5\u4f5c\u3002\u4f7f\u7528<code class=\"literal\">G</code>\u65f6\uff0c\u751f\u6210\u6570\u636e\u671f\u95f4\u4e0d\u4f1a\u6253\u5370\u4efb\u4f55\u8fdb\u5ea6\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u521d\u59cb\u5316\u884c\u4e3a\u4f7f\u7528\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff08\u7b49\u540c\u4e8e<code class=\"literal\">g</code>\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-V\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-P\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-F\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILLFACTOR\"><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-INIT\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n<p lang=\"zh\">\u5982\u679c -I \u4e2d\u6307\u5b9a\u4e86 G\uff0c\u6b64\u8bbe\u7f6e\u4e0d\u751f\u6548\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-INIT\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FOREIGN-KEYS\"><span class=\"term\"><code class=\"option\">--foreign-keys</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INDEX-TABLESPACE\"><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITION-METHOD\"><span class=\"term\"><code class=\"option\">--partition-method=<em class=\"replaceable\"><code>NAME</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITIONS\"><span class=\"term\"><code class=\"option\">--partitions=<em class=\"replaceable\"><code>NUM</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TABLESPACE\"><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-UNLOGGED-TABLES\"><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-BUILTIN\"><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CLIENT\"><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CONNECT\"><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-DEFINE\"><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-JOBS\"><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LATENCY-LIMIT\"><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--max-tries</code>\u9009\u9879\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u56e0\u4e32\u884c\u5316\u5f02\u5e38\u6216\u6b7b\u9501\u800c\u5931\u8d25\uff0c\u4e14\u5176\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\u5927\u4e8e<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u5219\u4e0d\u4f1a\u518d\u91cd\u8bd5\u3002\u82e5\u53ea\u60f3\u9650\u5236\u5c1d\u8bd5\u603b\u65f6\u95f4\u800c\u4e0d\u9650\u5236\u5c1d\u8bd5\u6b21\u6570\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">--max-tries=0</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"option\">--max-tries</code>\u4e3a 1\uff0c\u51fa\u73b0\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/17/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROTOCOL\"><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5728<code class=\"literal\">prepared</code>\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pgbench</span> \u4ece\u7b2c\u4e8c\u6b21\u67e5\u8be2\u8fed\u4ee3\u5f00\u59cb\u590d\u7528\u89e3\u6790\u5206\u6790\u7ed3\u679c\uff0c\u56e0\u6b64<span class=\"application\">pgbench</span> \u6bd4\u5176\u4ed6\u6a21\u5f0f\u8fd0\u884c\u5f97\u66f4\u5feb\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u503c\u662f\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/17/protocol.html\" title=\"\u7b2c\u00a053\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a053\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-RUN\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SKIP-SOME-UPDATES\"><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS\"><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528<code class=\"option\">--max-tries</code>\u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-REPORT-LATENCIES\"><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-per-command</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RATE\"><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-RUN\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SELECT-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TRANSACTIONS\"><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TIME\"><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VACUUM-ALL\"><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-AGGREGATE-INTERVAL\"><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-EXIT-ON-ABORT\"><span class=\"term\"><code class=\"option\">--exit-on-abort</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53\u4efb\u4e00\u5ba2\u6237\u7aef\u56e0\u9519\u8bef\u88ab\u4e2d\u6b62\u65f6\uff0c\u7acb\u5373\u9000\u51fa\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u5373\u4f7f\u67d0\u4e2a\u5ba2\u6237\u7aef\u88ab\u4e2d\u6b62\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4ecd\u53ef\u6309<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u7684\u8bbe\u5b9a\u7ee7\u7eed\u8fd0\u884c\uff0c\u6b64\u65f6<span class=\"application\">pgbench</span>\u4f1a\u8f93\u51fa\u4e0d\u5b8c\u6574\u7684\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4e32\u884c\u5316\u5931\u8d25\u6216\u6b7b\u9501\u5931\u8d25\u4e0d\u4f1a\u4e2d\u6b62\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u4e0d\u53d7\u8be5\u9009\u9879\u5f71\u54cd\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/17/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FAILURES-DETAILED\"><span class=\"term\"><code class=\"option\">--failures-detailed</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e32\u884c\u5316\u5931\u8d25\uff1b</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u6b7b\u9501\u5931\u8d25\uff1b</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/17/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG-PREFIX\"><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-MAX-TRIES\"><span class=\"term\"><code class=\"option\">--max-tries=<em class=\"replaceable\"><code>number_of_tries</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS-TIMESTAMP\"><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RANDOM-SEED\"><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>seed</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>seed</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>seed</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SAMPLING-RATE\"><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SHOW-SCRIPT\"><span class=\"term\"><code class=\"option\">--show-script=</code><em class=\"replaceable\"><code>scriptname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5185\u7f6e\u811a\u672c<em class=\"replaceable\"><code>scriptname</code></em>\u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERBOSE-ERRORS\"><span class=\"term\"><code class=\"option\">--verbose-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/17/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u8fd8\u63a5\u53d7\u4ee5\u4e0b\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u53ca\u5176\u4ed6\u901a\u7528\u8bbe\u7f6e\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HOST\"><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u6210\u529f\u8fd0\u884c\u65f6\u9000\u51fa\u72b6\u6001\u4e3a 0\u3002\u9000\u51fa\u72b6\u6001 1 \u8868\u793a\u9759\u6001\u95ee\u9898\uff0c\u4f8b\u5982\u65e0\u6548\u7684\u547d\u4ee4\u884c\u9009\u9879\uff0c\u6216\u8005\u672c\u4e0d\u5e94\u53d1\u751f\u7684\u5185\u90e8\u9519\u8bef\u3002\u57fa\u51c6\u6d4b\u8bd5\u542f\u52a8\u9636\u6bb5\u7684\u65e9\u671f\u9519\u8bef\uff0c\u4f8b\u5982\u521d\u59cb\u8fde\u63a5\u5931\u8d25\uff0c\u4e5f\u4f1a\u4ee5\u72b6\u6001 1 \u9000\u51fa\u3002\u8fd0\u884c\u671f\u95f4\u7684\u9519\u8bef\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u9519\u8bef\u6216\u811a\u672c\u95ee\u9898\uff0c\u4f1a\u5bfc\u81f4\u9000\u51fa\u72b6\u6001\u4e3a 2\u3002\u5728\u540e\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u6ca1\u6709\u6307\u5b9a --exit-on-abort \u9009\u9879\uff0cpgbench \u4f1a\u6253\u5370\u90e8\u5206\u7ed3\u679c\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.8\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/17/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.9\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"TRANSACTIONS-AND-SCRIPTS\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n<p lang=\"zh\">\u5047\u5b9a<span class=\"application\">pgbench</span>\u811a\u672c\u4e0d\u5305\u542b\u4e0d\u5b8c\u6574\u7684 SQL \u4e8b\u52a1\u5757\u3002\u5982\u679c\u5728\u8fd0\u884c\u65f6\u5ba2\u6237\u7aef\u5728\u5c1a\u672a\u5b8c\u6210\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5757\u65f6\u5c31\u5230\u8fbe\u811a\u672c\u672b\u5c3e\uff0c\u8be5\u5ba2\u6237\u7aef\u5c06\u88ab\u4e2d\u6b62\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u673a\u5236\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5e76\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u5982\u4e0a\u6240\u8ff0\uff0c\u53d8\u91cf\u53ef\u4ee5\u7528\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e0b\u6587\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u901a\u8fc7<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u5148\u8bbe\u7f6e\u7684\u53d8\u91cf\u4e4b\u5916\uff0c\u8fd8\u6709\u5c11\u91cf\u53d8\u91cf\u4f1a\u88ab\u81ea\u52a8\u9884\u8bbe\uff0c\u5217\u5728<a class=\"xref\" href=\"/docs/17/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0298.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0298</a>\u4e2d\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u503c\uff0c\u5219\u4f1a\u8986\u76d6\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u4e00\u65e6\u8bbe\u7f6e\u597d\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u5728 SQL \u547d\u4ee4\u4e2d\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u6765\u63d2\u5165\u5176\u503c\u3002\u5f53\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u53d8\u91cf\u96c6\u5408\u3002<span class=\"application\">pgbench</span>\u5728\u5355\u6761\u8bed\u53e5\u4e2d\u6700\u591a\u652f\u6301 255 \u6b21\u53d8\u91cf\u4f7f\u7528\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0298.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u548c\u4f2a\u968f\u673a\u7f6e\u6362\u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [<em class=\"replaceable\"><code>prefix</code></em>]</code> <code class=\"literal\">\\aset [<em class=\"replaceable\"><code>prefix</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e9b\u547d\u4ee4\u53ef\u7528\u4e8e\u7ed3\u675f SQL \u67e5\u8be2\uff0c\u4ee5\u4ee3\u66ff\u7ed3\u5c3e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\gset</code>\u547d\u4ee4\u65f6\uff0c\u524d\u9762\u7684 SQL \u67e5\u8be2\u9884\u671f\u8fd4\u56de\u4e00\u884c\uff0c\u5176\u5404\u5217\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\aset</code>\u547d\u4ee4\u65f6\uff0c\u6240\u6709\u7ec4\u5408 SQL \u67e5\u8be2\uff08\u7531<code class=\"literal\">\\;</code>\u5206\u9694\uff09\u7684\u5217\u90fd\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\u4e2d\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u4e0d\u8fd4\u56de\u4efb\u4f55\u884c\uff0c\u5219\u4e0d\u4f1a\u8fdb\u884c\u8d4b\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u6765\u68c0\u6d4b\u8fd9\u79cd\u60c5\u51b5\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u591a\u884c\uff0c\u5219\u4fdd\u7559\u6700\u540e\u4e00\u4e2a\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\gset</code> \u548c <code class=\"literal\">\\aset</code> \u4e0d\u80fd\u7528\u5728\u7ba1\u9053\u6a21\u5f0f\uff0c\u56e0\u4e3a\u5728\u547d\u4ee4\u9700\u8981\u5b83\u4eec\u7684\u65f6\u5019\uff0c\u67e5\u8be2\u7ed3\u679c\u8fd8\u4e0d\u53ef\u7528\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u7684\u793a\u4f8b\u5c06\u7b2c\u4e00\u4e2a\u67e5\u8be2\u4e2d\u7684\u6700\u7ec8\u8d26\u6237\u4f59\u989d\u653e\u5165\u53d8\u91cf<em class=\"replaceable\"><code>abalance</code></em>\uff0c\u5e76\u7528\u7b2c\u4e09\u4e2a\u67e5\u8be2\u4e2d\u7684\u6574\u6570\u586b\u5145\u53d8\u91cf<em class=\"replaceable\"><code>p_two</code></em>\u548c<em class=\"replaceable\"><code>p_three</code></em>\u3002\u7b2c\u4e8c\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002\u6700\u540e\u4e24\u4e2a\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u5b58\u5165\u53d8\u91cf<em class=\"replaceable\"><code>four</code></em>\u548c<em class=\"replaceable\"><code>five</code></em>\u3002</p>\n<pre class=\"programlisting\">UPDATE pgbench_accounts\n  SET abalance = abalance + :delta\n  WHERE aid = :aid\n  RETURNING abalance \\gset\n-- compound of two queries\nSELECT 1 \\;\nSELECT 2 AS two, 3 AS three \\gset p_\nSELECT 4 AS four \\; SELECT 5 AS five \\aset\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-IF-ELSE\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/17/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/17/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/17/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.18.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u8fc7\u5927\u6216\u8fc7\u5c0f\u7684\u6574\u6570\u548c\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff0c\u4ee5\u53ca\u6574\u6570\u7b97\u672f\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u548c<code class=\"literal\">/</code>\uff09\u90fd\u4f1a\u5728\u6ea2\u51fa\u65f6\u5f15\u53d1\u9519\u8bef\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SLEEP\"><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SETSHELL\"><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SHELL\"><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\syncpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u7ec4\u547d\u4ee4\u7528\u4e8e\u5b9e\u73b0 SQL \u8bed\u53e5\u7684\u7ba1\u9053\u6267\u884c\u3002\u7ba1\u9053\u5fc5\u987b\u4ee5<code class=\"command\">\\startpipeline</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endpipeline</code>\u7ed3\u675f\uff1b\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u51fa\u73b0\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\syncpipeline</code>\uff0c\u5b83\u4f1a\u53d1\u9001\u4e00\u4e2a<a class=\"link\" href=\"/docs/17/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"53.2.3.\u00a0\u6269\u5c55\u67e5\u8be2\">sync \u6d88\u606f</a>\uff0c\u65e2\u4e0d\u4f1a\u7ed3\u675f\u5f53\u524d\u7ba1\u9053\uff0c\u4e5f\u4e0d\u4f1a\u5237\u65b0\u53d1\u9001\u7f13\u51b2\u533a\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u4e00\u6761\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/17/libpq-pipeline-mode.html\" title=\"32.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a032.5\u00a0\u8282</a>\u3002\u7ba1\u9053\u6a21\u5f0f\u8981\u6c42\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/17/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0299.\u00a0pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0299</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/17/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002\u8fd9\u4e9b\u64cd\u4f5c\u7b26\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u5217\u51fa\u3002\u9664\u975e\u53e6\u6709\u8bf4\u660e\uff0c\u63a5\u53d7\u4e24\u4e2a\u6570\u5b57\u8f93\u5165\u7684\u64cd\u4f5c\u7b26\u53ea\u8981\u4efb\u4e00\u8f93\u5165\u4e3a\u53cc\u7cbe\u5ea6\uff0c\u5c31\u4f1a\u4ea7\u751f\u53cc\u7cbe\u5ea6\u7ed3\u679c\uff1b\u5426\u5219\u4ea7\u751f\u6574\u6570\u7ed3\u679c\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0299.\u00a0pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u64cd\u4f5c\u7b26</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">OR</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u6216</p>\n<p><code class=\"literal\">5 or 0</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">AND</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u4e0e</p>\n<p><code class=\"literal\">3 and 0</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">NOT</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u975e</p>\n<p><code class=\"literal\">not false</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5e03\u5c14\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 is null</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>value</code></em> <code class=\"literal\">ISNULL|NOTNULL</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7a7a\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 notnull</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 = 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;&gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">!=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 != 5</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e</p>\n<p><code class=\"literal\">5 &lt; 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;= 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e</p>\n<p><code class=\"literal\">5 &gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &gt;= 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">|</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u6216</p>\n<p><code class=\"literal\">1 | 2</code> \u2192 <code class=\"returnvalue\">3</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">#</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5f02\u6216</p>\n<p><code class=\"literal\">1 # 3</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&amp;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u4e0e</p>\n<p><code class=\"literal\">1 &amp; 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">~</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u975e</p>\n<p><code class=\"literal\">~ 1</code> \u2192 <code class=\"returnvalue\">-2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&lt;&lt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5de6\u79fb</p>\n<p><code class=\"literal\">1 &lt;&lt; 2</code> \u2192 <code class=\"returnvalue\">4</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&gt;&gt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u53f3\u79fb</p>\n<p><code class=\"literal\">8 &gt;&gt; 2</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">+</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u52a0\u6cd5</p>\n<p><code class=\"literal\">5 + 4</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u51cf\u6cd5</p>\n<p><code class=\"literal\">3 - 2.0</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">*</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u4e58\u6cd5</p>\n<p><code class=\"literal\">5 * 4</code> \u2192 <code class=\"returnvalue\">20</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">/</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u9664\u6cd5\uff08\u5982\u679c\u4e24\u4e2a\u8f93\u5165\u90fd\u662f\u6574\u6570\uff0c\u5219\u5c06\u7ed3\u679c\u5411\u96f6\u622a\u65ad\uff09</p>\n<p><code class=\"literal\">5 / 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">%</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">3 % 2</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u53d6\u76f8\u53cd\u6570</p>\n<p><code class=\"literal\">- 2.0</code> \u2192 <code class=\"returnvalue\">-2.0</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/17/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0300.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0300</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/17/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0300.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u51fd\u6570</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">abs</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u7edd\u5bf9\u503c</p>\n<p><code class=\"literal\">abs(-17)</code> \u2192 <code class=\"returnvalue\">17</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">debug</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u5c06\u53c2\u6570\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de\u53c2\u6570\u3002</p>\n<p><code class=\"literal\">debug(5432.1)</code> \u2192 <code class=\"returnvalue\">5432.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">double</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u8f6c\u6362\u4e3a double\u3002</p>\n<p><code class=\"literal\">double(5432)</code> \u2192 <code class=\"returnvalue\">5432.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">exp</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u6307\u6570\u51fd\u6570\uff08<code class=\"literal\">e</code> \u7684\u7ed9\u5b9a\u6b21\u5e42\uff09</p>\n<p><code class=\"literal\">exp(1.0)</code> \u2192 <code class=\"returnvalue\">2.718281828459045</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">greatest</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c\u3002</p>\n<p><code class=\"literal\">greatest(5, 4, 3, 2)</code> \u2192 <code class=\"returnvalue\">5</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8fd9\u662f <code class=\"function\">hash_murmur2</code> \u7684\u522b\u540d\u3002</p>\n<p><code class=\"literal\">hash(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_fnv1a</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\" target=\"_top\">FNV-1a hash</a>\u3002</p>\n<p><code class=\"literal\">hash_fnv1a(10, 5432)</code> \u2192 <code class=\"returnvalue\">-7793829335365542153</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_murmur2</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/MurmurHash\" target=\"_top\">MurmurHash2 hash</a>\u3002</p>\n<p><code class=\"literal\">hash_murmur2(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">int</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8f6c\u6362\u4e3a integer\u3002</p>\n<p><code class=\"literal\">int(5.4 + 3.8)</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">least</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c\u3002</p>\n<p><code class=\"literal\">least(5, 4, 3, 2.1)</code> \u2192 <code class=\"returnvalue\">2.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">ln</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u81ea\u7136\u5bf9\u6570</p>\n<p><code class=\"literal\">ln(2.718281828459045)</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">mod</code> ( <em class=\"replaceable\"><code>integer</code></em>, <em class=\"replaceable\"><code>integer</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">mod(54, 32)</code> \u2192 <code class=\"returnvalue\">22</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">permute</code> ( <em class=\"parameter\"><code>i</code></em>, <em class=\"parameter\"><code>size</code></em> [, <em class=\"parameter\"><code>seed</code></em> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\"><em class=\"parameter\"><code>i</code></em>\u7684\u7f6e\u6362\u503c\uff0c\u8303\u56f4\u5728<code class=\"literal\">[0, size)</code>\u5185\u3002\u5b83\u8868\u793a<em class=\"parameter\"><code>i</code></em>\uff08\u6a21<em class=\"parameter\"><code>size</code></em>\uff09\u5728\u6574\u6570<code class=\"literal\">0...size-1</code>\u7684\u4f2a\u968f\u673a\u7f6e\u6362\u4e2d\u7684\u65b0\u4f4d\u7f6e\uff1b\u8be5\u7f6e\u6362\u7531<em class=\"parameter\"><code>seed</code></em>\u53c2\u6570\u5316\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">permute(0, 4)</code> \u2192 <code class=\"returnvalue\">an integer between 0 and 3</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pi</code> () \u2192 <code class=\"returnvalue\">double</code></p>\n<p><span class=\"symbol_font\">\u03c0</span>\u7684\u8fd1\u4f3c\u503c</p>\n<p><code class=\"literal\">pi()</code> \u2192 <code class=\"returnvalue\">3.14159265358979323846</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pow</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p class=\"func_signature\"><code class=\"function\">power</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p><em class=\"parameter\"><code>x</code></em> \u7684 <em class=\"parameter\"><code>y</code></em> \u6b21\u5e42</p>\n<p><code class=\"literal\">pow(2.0, 10)</code> \u2192 <code class=\"returnvalue\">1024.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u5747\u5300\u5206\u5e03\u968f\u673a\u6574\u6570\u3002</p>\n<p><code class=\"literal\">random(1, 10)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_exponential</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u6307\u6570\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_exponential(1, 10, 3.0)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_gaussian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u9ad8\u65af\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_gaussian(1, 10, 2.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_zipfian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684 Zipfian \u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_zipfian(1, 10, 1.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">sqrt</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u5e73\u65b9\u6839</p>\n<p><code class=\"literal\">sqrt(2.0)</code> \u2192 <code class=\"returnvalue\">1.414213562</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002parameter \u5141\u8bb8\u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n<p lang=\"zh\">pgbench \u7684\u5b9e\u73b0\u57fa\u4e8e Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002\u7531\u4e8e\u8be5\u7b97\u6cd5\u7684\u9650\u5236\uff0cparameter \u7684\u53d6\u503c\u9650\u5236\u5728 [1.001, 1000] \u8303\u56f4\u5185\u3002</p>\n</li>\n</ul>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u8bbe\u8ba1\u4ee5\u975e\u5747\u5300\u65b9\u5f0f\u9009\u62e9\u884c\u7684\u57fa\u51c6\u6d4b\u8bd5\u65f6\uff0c\u8981\u6ce8\u610f\u88ab\u9009\u4e2d\u7684\u884c\u53ef\u80fd\u4e0e\u5176\u4ed6\u6570\u636e\u76f8\u5173\uff0c\u4f8b\u5982\u4e0e\u5e8f\u5217\u751f\u6210\u7684 ID \u6216\u7269\u7406\u884c\u987a\u5e8f\u76f8\u5173\uff0c\u8fd9\u53ef\u80fd\u4f1a\u626d\u66f2\u6027\u80fd\u6d4b\u91cf\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u4e3a\u907f\u514d\u8fd9\u4e00\u70b9\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"function\">permute</code>\u51fd\u6570\uff0c\u6216\u91c7\u7528\u5176\u4ed6\u5177\u6709\u7c7b\u4f3c\u6548\u679c\u7684\u989d\u5916\u6b65\u9aa4\uff0c\u5bf9\u9009\u4e2d\u7684\u884c\u8fdb\u884c\u6253\u4e71\u5e76\u79fb\u9664\u6b64\u7c7b\u76f8\u5173\u6027\u3002</p>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570<code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code>\u548c<code class=\"literal\">hash_fnv1a</code>\u90fd\u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f1a\u4f7f\u7528<code class=\"literal\">:default_seed</code>\u7684\u503c\uff1b\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c<code class=\"literal\">-D</code>\u9009\u9879\u8986\u76d6\uff0c\u5426\u5219\u8be5\u503c\u4f1a\u88ab\u968f\u673a\u521d\u59cb\u5316\u3002</p>\n<p lang=\"zh\">permute \u63a5\u53d7\u8f93\u5165\u503c\u3001\u5927\u5c0f\u548c\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5b83\u5728 [0, size) \u8303\u56f4\u5185\u751f\u6210\u6574\u6570\u7684\u4f2a\u968f\u673a\u6392\u5217\uff0c\u5e76\u8fd4\u56de\u8f93\u5165\u503c\u5728\u6392\u5217\u4e2d\u7684\u7d22\u5f15\u3002\u6240\u9009\u6392\u5217\u7531\u79cd\u5b50\u51b3\u5b9a\uff0c\u672a\u6307\u5b9a\u79cd\u5b50\u65f6\u9ed8\u8ba4\u4f7f\u7528 :default_seed\u3002\u4e0e\u54c8\u5e0c\u51fd\u6570\u4e0d\u540c\uff0cpermute \u4fdd\u8bc1\u8f93\u51fa\u503c\u65e2\u65e0\u51b2\u7a81\u4e5f\u65e0\u7a7a\u7f3a\u3002\u533a\u95f4\u5916\u7684\u8f93\u5165\u503c\u4f1a\u5bf9 size \u53d6\u6a21\u3002\u5982\u679c size \u4e0d\u662f\u6b63\u6570\uff0c\u51fd\u6570\u4f1a\u62a5\u9519\u3002permute \u53ef\u7528\u4e8e\u6253\u6563 random_zipfian \u6216 random_exponential \u7b49\u975e\u5747\u5300\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f7f\u66f4\u9891\u7e41\u62bd\u53d6\u7684\u503c\u4e0d\u4f1a\u5b58\u5728\u7b80\u5355\u7684\u5173\u8054\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e0a\u53ef\u80fd\u51fa\u73b0\u7684\u4e00\u7c7b\u5178\u578b\u5b9e\u9645\u8d1f\u8f7d\uff1a\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u8fc7\u91cf\u8d1f\u8f7d\u3002</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, :size, 1.07)\n\\set k 1 + permute(:r, :size)\n</pre>\n<p lang=\"zh\">\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u82e5\u5e72\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u53ef\u9009\u79cd\u5b50\u53c2\u6570\u5c31\u5f88\u6709\u7528\uff1a</p>\n<pre class=\"programlisting\">\\set k1 1 + permute(:r, :size, :default_seed + 123)\n\\set k2 1 + permute(:r, :size, :default_seed + 321)\n</pre>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u7528<code class=\"function\">hash</code>\u8fd1\u4f3c\u5b9e\u73b0\u7c7b\u4f3c\u7684\u884c\u4e3a\uff1a</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, 100 * :size, 1.07)\n\\set k 1 + abs(hash(:r)) % :size\n</pre>\n<p lang=\"zh\">\u4f46\u662f\uff0c\u7531\u4e8e<code class=\"function\">hash</code>\u4f1a\u4ea7\u751f\u51b2\u7a81\uff0c\u6709\u4e9b\u503c\u5c06\u6c38\u8fdc\u4e0d\u53ef\u8fbe\uff0c\u800c\u53e6\u4e00\u4e9b\u503c\u5219\u4f1a\u6bd4\u539f\u59cb\u5206\u5e03\u6240\u9884\u671f\u7684\u66f4\u5e38\u51fa\u73b0\u3002</p>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u6587\u4ef6\u7684\u6bcf\u4e00\u884c\u63cf\u8ff0\u4e00\u4e2a\u4e8b\u52a1\u3002\u5b83\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>client_id</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8fd0\u884c\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>transaction_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edf\u8ba1\u8be5\u4f1a\u8bdd\u5df2\u6267\u884c\u7684\u4e8b\u52a1\u6570\u91cf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u8017\u65f6\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>script_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8be5\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5f53\u901a\u8fc7<code class=\"option\">-f</code>\u6216<code class=\"option\">-b</code>\u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_epoch</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_us</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\u7684\u5c0f\u6570\u79d2\u90e8\u5206\uff0c\u4ee5\u5fae\u79d2\u4e3a\u5355\u4f4d</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>schedule_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff0c\u5373\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff08\u4ec5\u5728\u6307\u5b9a<code class=\"option\">--rate</code>\u65f6\u51fa\u73b0\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4e8b\u52a1\u6267\u884c\u671f\u95f4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08\u4ec5\u5f53 --max-tries \u4e0d\u7b49\u4e8e\u4e00\u65f6\u51fa\u73b0\uff09</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5f53\u540c\u65f6\u4f7f\u7528<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\u65f6\uff0c\u8df3\u8fc7\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">skipped</code>\u3002\u5982\u679c\u4e8b\u52a1\u4ee5\u5931\u8d25\u7ed3\u675f\uff0c\u5176<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">failed</code>\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u4f1a\u6839\u636e\u5931\u8d25\u7c7b\u578b\u62a5\u544a\u4e3a<code class=\"literal\">serialization</code>\u6216<code class=\"literal\">deadlock</code>\uff08\u8be6\u89c1<a class=\"xref\" href=\"/docs/17/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5305\u542b\u5931\u8d25\u4e0e\u91cd\u8bd5\u7684\u65e5\u5fd7\u7247\u6bb5\uff0c\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u8bbe\u4e3a 10\uff08\u6ce8\u610f\u989d\u5916\u7684 retries \u5217\uff09\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 failed 0 1499414498 84905 9\n2 0 failed 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u7684\u7c7b\u578b\u5c06\u5728<em class=\"replaceable\"><code>time</code></em>\u4e2d\u62a5\u544a\uff0c\u5982\u4e0b\u6240\u793a\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 serialization 0 1499414498 84905 9\n2 0 serialization 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--aggregate-interval</code>\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u4f1a\u91c7\u7528\u4e0d\u540c\u7684\u683c\u5f0f\u3002\u6bcf\u4e00\u884c\u65e5\u5fd7\u63cf\u8ff0\u4e00\u4e2a\u805a\u5408\u65f6\u95f4\u95f4\u9694\uff0c\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>interval_start</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u7684\u8d77\u59cb\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>num_transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u5185\u7684\u4e8b\u52a1\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u603b\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>skipped</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56e0\u4e3a\u542f\u52a8\u65f6\u95f4\u4f1a\u592a\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retried</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>serialization_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u4e32\u884c\u5316\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>deadlock_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u6b7b\u9501\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4f7f\u7528\u8be5\u9009\u9879\u751f\u6210\u7684\u793a\u4f8b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\"><strong class=\"userinput\"><code>pgbench --aggregate-interval=10 --time=20 --client=10 --log --rate=1000 --latency-limit=10 --failures-detailed --max-tries=10 test</code></strong>\n\n1650260552 5178 26171317 177284491527 1136 44462 2647617 7321113867 0 9866 64 7564 28340 4148 0\n1650260562 4808 25573984 220121792172 1171 62083 3037380 9666800914 0 9998 598 7392 26621 4527 0\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u62a5\u544a</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\uff0c<span class=\"application\">pgbench</span>\u4e3a\u6bcf\u4e2a\u8bed\u53e5\u6536\u96c6\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">latency</code> \u2014 \u6bcf\u6761\u8bed\u53e5\u7684\u8017\u65f6\u3002<span class=\"application\">pgbench</span>\u62a5\u544a\u8be5\u8bed\u53e5\u6240\u6709\u6210\u529f\u6267\u884c\u7684\u5e73\u5747\u503c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u7684\u5931\u8d25\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/17/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u53d1\u751f\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/17/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u62a5\u544a\u4ec5\u5728<code class=\"option\">--max-tries</code>\u9009\u9879\u4e0d\u7b49\u4e8e1\u65f6\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6240\u6709\u6570\u503c\u90fd\u662f\u9488\u5bf9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u8ba1\u7b97\u7684\uff0c\u5e76\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u5c06\u7c7b\u4f3c\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nnumber of transactions above the 50.0 ms latency limit: 1311/10000 (13.110 %)\nlatency average = 28.488 ms\nlatency stddev = 21.009 ms\ninitial connection time = 69.068 ms\ntps = 346.224794 (without initial connection time)\nstatement latencies in milliseconds and failures:\n   0.012  0  \\set aid random(1, 100000 * :scale)\n   0.002  0  \\set bid random(1, 1 * :scale)\n   0.002  0  \\set tid random(1, 10 * :scale)\n   0.002  0  \\set delta random(-5000, 5000)\n   0.319  0  BEGIN;\n   0.834  0  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n   0.641  0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  11.126  0  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  12.961  0  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n   0.634  0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n   1.957  0  END;\n</pre>\n<p lang=\"zh\">\u4f7f\u7528\u53ef\u4e32\u884c\u5316\u9ed8\u8ba4\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\u7684\u9ed8\u8ba4\u811a\u672c\u7684\u53e6\u4e00\u4e2a\u8f93\u51fa\u793a\u4f8b\uff08<code class=\"command\">PGOPTIONS='-c default_transaction_isolation=serializable' pgbench ...</code>\uff09\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 10\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 6317/10000\nnumber of failed transactions: 3683 (36.830%)\nnumber of transactions retried: 7667 (76.670%)\ntotal number of retries: 45339\nnumber of transactions above the 50.0 ms latency limit: 106/6317 (1.678 %)\nlatency average = 17.016 ms\nlatency stddev = 13.283 ms\ninitial connection time = 45.017 ms\ntps = 186.792667 (without initial connection time)\nstatement latencies in milliseconds, failures and retries:\n  0.006     0      0  \\set aid random(1, 100000 * :scale)\n  0.001     0      0  \\set bid random(1, 1 * :scale)\n  0.001     0      0  \\set tid random(1, 10 * :scale)\n  0.001     0      0  \\set delta random(-5000, 5000)\n  0.385     0      0  BEGIN;\n  0.773     0      1  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n  0.624     0      0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  1.098   320   3762  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  0.582  3363  41576  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n  0.465     0      0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n  1.933     0      0  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"FAILURES-AND-RETRIES\">\n<h3 lang=\"zh\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</h3>\n<p lang=\"zh\">\u5728\u6267\u884c<span class=\"application\">pgbench</span>\u65f6\uff0c\u6709\u4e09\u79cd\u4e3b\u8981\u7c7b\u578b\u7684\u9519\u8bef\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e3b\u7a0b\u5e8f\u9519\u8bef\u3002\u5b83\u4eec\u6700\u4e3a\u4e25\u91cd\uff0c\u603b\u662f\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\uff0c\u5e76\u663e\u793a\u76f8\u5e94\u7684\u9519\u8bef\u6d88\u606f\u3002\u5b83\u4eec\u5305\u62ec\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\" style=\"list-style-type: circle;\">\n<li class=\"listitem\">\n<p><span class=\"application\">pgbench</span>\u5f00\u59cb\u6267\u884c\u65f6\u7684\u9519\u8bef\uff08\u4f8b\u5982\u9009\u9879\u503c\u65e0\u6548\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u521d\u59cb\u5316\u6a21\u5f0f\u4e2d\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u7528\u4e8e\u521b\u5efa\u5185\u7f6e\u811a\u672c\u6240\u9700\u8868\u7684\u67e5\u8be2\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5728\u7ebf\u7a0b\u542f\u52a8\u4e4b\u524d\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\u65e0\u6cd5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3001\u5143\u547d\u4ee4\u4e2d\u6709\u8bed\u6cd5\u9519\u8bef\u3001\u7ebf\u7a0b\u521b\u5efa\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u6c38\u8fdc\u4e0d\u8be5\u53d1\u751f\u2026\u2026\uff09\u3002</p>\n</li>\n</ul>\n</div>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u7ebf\u7a0b\u5728\u7ba1\u7406\u5176\u5ba2\u6237\u7aef\u65f6\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u5ba2\u6237\u7aef\u65e0\u6cd5\u5f00\u59cb\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u6216\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\u6240\u7528\u7684\u5957\u63a5\u5b57\u5df2\u7ecf\u5931\u6548\uff09\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8be5\u7ebf\u7a0b\u7684\u6240\u6709\u5ba2\u6237\u7aef\u90fd\u4f1a\u505c\u6b62\uff0c\u800c\u5176\u4ed6\u7ebf\u7a0b\u7ee7\u7eed\u5de5\u4f5c\uff1b\u4f46\u662f\uff0c\u5982\u679c\u6307\u5b9a\u4e86<code class=\"option\">--exit-on-abort</code>\uff0c\u5219\u6240\u6709\u7ebf\u7a0b\u90fd\u4f1a\u7acb\u5373\u505c\u6b62\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\u3002\u5728\u53d1\u751f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u4e0d\u5e94\u53d1\u751f\uff09\u6216\u6307\u5b9a\u4e86<code class=\"option\">--exit-on-abort</code>\u65f6\uff0c\u5b83\u4eec\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\u5e76\u663e\u793a\u76f8\u5e94\u9519\u8bef\u6d88\u606f\u3002\u5426\u5219\uff0c\u6700\u574f\u60c5\u51b5\u4e0b\u53ea\u4f1a\u4e2d\u6b62\u5931\u8d25\u7684\u5ba2\u6237\u7aef\uff0c\u800c\u5176\u4ed6\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\uff08\u4f46\u67d0\u4e9b\u5ba2\u6237\u7aef\u9519\u8bef\u4f1a\u5728\u4e0d\u4e2d\u6b62\u5ba2\u6237\u7aef\u7684\u60c5\u51b5\u4e0b\u5904\u7406\u5e76\u5355\u72ec\u62a5\u544a\uff0c\u89c1\u4e0b\u6587\uff09\u3002\u672c\u8282\u540e\u7eed\u9ed8\u8ba4\u8ba8\u8bba\u7684\u90fd\u662f\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\uff0c\u800c\u4e0d\u662f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5ba2\u6237\u7aef\u5728\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u65f6\u4f1a\u4e2d\u6b62\u8fd0\u884c\uff1b\u4f8b\u5982\uff0c\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e22\u5931\uff0c\u6216\u8005\u811a\u672c\u5728\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5c1a\u672a\u5b8c\u6210\u65f6\u5c31\u7ed3\u675f\u4e86\u3002\u53e6\u5916\uff0c\u5982\u679c SQL \u6216\u5143\u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u4e14\u539f\u56e0\u4e0d\u662f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\uff0c\u5ba2\u6237\u7aef\u4e5f\u4f1a\u4e2d\u6b62\u3002\u5426\u5219\uff0c\u5982\u679c SQL \u547d\u4ee4\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5f53\u524d\u4e8b\u52a1\u4f1a\u56de\u6eda\uff0c\u4e5f\u5305\u62ec\u5c06\u5ba2\u6237\u7aef\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u6b64\u4e8b\u52a1\u8fd0\u884c\u4e4b\u524d\u7684\u72b6\u6001\uff08\u5047\u8bbe\u4e00\u4e2a\u4e8b\u52a1\u811a\u672c\u53ea\u5305\u542b\u4e00\u4e2a\u4e8b\u52a1\uff1b\u8be6\u89c1<a class=\"xref\" href=\"/docs/17/pgbench.html#TRANSACTIONS-AND-SCRIPTS\" title=\"\u5728pgbench\u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f\">\u5728 pgbench \u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f</a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff09\u3002\u53d1\u751f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4f1a\u5728\u56de\u6eda\u540e\u91cd\u65b0\u6267\u884c\uff0c\u76f4\u5230\u6210\u529f\u5b8c\u6210\uff0c\u6216\u8005\u8fbe\u5230\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u7531<code class=\"option\">--max-tries</code>\u6307\u5b9a\uff09\u3001\u8fbe\u5230\u6700\u5927\u91cd\u8bd5\u65f6\u95f4\uff08\u7531<code class=\"option\">--latency-limit</code>\u6307\u5b9a\uff09\uff0c\u6216\u8005\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\uff08\u7531<code class=\"option\">--time</code>\u6307\u5b9a\uff09\u3002\u5982\u679c\u6700\u540e\u4e00\u6b21\u5c1d\u8bd5\u4ecd\u7136\u5931\u8d25\uff0c\u8be5\u4e8b\u52a1\u4f1a\u88ab\u62a5\u544a\u4e3a\u5931\u8d25\uff0c\u4f46\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\uff0c\u800c\u662f\u7ee7\u7eed\u5de5\u4f5c\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a --max-tries \u9009\u9879\uff0c\u4e8b\u52a1\u5728\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u4e0d\u4f1a\u91cd\u8bd5\uff0c\u56e0\u4e3a\u5176\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u53ef\u4ee5\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u5e76\u914d\u5408 --latency-limit\uff0c\u4ec5\u9650\u5236\u5c1d\u8bd5\u7684\u6700\u957f\u603b\u8017\u65f6\u3002\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\u65f6\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 --time \u9650\u5236\u57fa\u51c6\u6d4b\u8bd5\u65f6\u957f\u3002</p>\n<p lang=\"zh\">\u5728\u91cd\u590d\u5305\u542b\u591a\u4e2a\u4e8b\u52a1\u7684\u811a\u672c\u65f6\u8981\u5c0f\u5fc3\uff1a\u811a\u672c\u603b\u662f\u5b8c\u5168\u91cd\u8bd5\uff0c\u56e0\u6b64\u6210\u529f\u7684\u4e8b\u52a1\u53ef\u80fd\u4f1a\u6267\u884c\u591a\u6b21\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 shell \u547d\u4ee4\u91cd\u8bd5\u4e8b\u52a1\u65f6\u8981\u5c0f\u5fc3\u3002\u4e0e SQL \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u540c\uff0cshell \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u4f1a\u56de\u6eda\uff0c\u552f\u4e00\u7684\u4f8b\u5916\u662f<code class=\"command\">\\setshell</code>\u547d\u4ee4\u8bbe\u7f6e\u7684\u53d8\u91cf\u503c\u3002</p>\n</div>\n<p lang=\"zh\">\u6210\u529f\u4e8b\u52a1\u7684\u5ef6\u8fdf\u5305\u62ec\u4e8b\u52a1\u6267\u884c\u7684\u6574\u4e2a\u65f6\u95f4\uff0c\u5305\u62ec\u56de\u6eda\u548c\u91cd\u8bd5\u3002\u5ef6\u8fdf\u4ec5\u9488\u5bf9\u6210\u529f\u7684\u4e8b\u52a1\u548c\u547d\u4ee4\u8fdb\u884c\u6d4b\u91cf\uff0c\u800c\u4e0d\u9488\u5bf9\u5931\u8d25\u7684\u4e8b\u52a1\u6216\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u4e3b\u62a5\u544a\u5305\u542b\u5931\u8d25\u4e8b\u52a1\u7684\u6570\u91cf\u3002\u5982\u679c --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1\uff0c\u4e3b\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u91cd\u8bd5\u76f8\u5173\u7edf\u8ba1\uff1a\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u603b\u6570\u548c\u91cd\u8bd5\u603b\u6b21\u6570\u3002\u6bcf\u811a\u672c\u62a5\u544a\u7ee7\u627f\u4e3b\u62a5\u544a\u7684\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u6bcf\u8bed\u53e5\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5e0c\u671b\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\u6309\u57fa\u672c\u7c7b\u578b\u5bf9\u5931\u8d25\u8fdb\u884c\u5206\u7ec4\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\u3002\u5982\u679c\u8fd8\u5e0c\u671b\u6309\u7c7b\u578b\u533a\u5206\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u4e86\u591a\u5c11\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--verbose-errors</code>\u9009\u9879\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.10\">\n<h3 lang=\"zh\">\u8868\u8bbf\u95ee\u65b9\u6cd5</h3>\n<p lang=\"zh\">\u53ef\u4ee5\u4e3a pgbench \u8868\u6307\u5b9a<a class=\"link\" href=\"/docs/17/tableam.html\" title=\"\u7b2c\u00a061\u00a0\u7ae0\u00a0\u8868\u8bbf\u95ee\u65b9\u6cd5\u63a5\u53e3\u5b9a\u4e49\">\u8868\u8bbf\u95ee\u65b9\u6cd5</a>\u3002\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGOPTIONS</code>\u7528\u4e8e\u6307\u5b9a\u901a\u8fc7\u547d\u4ee4\u884c\u4f20\u9012\u7ed9 PostgreSQL \u7684\u6570\u636e\u5e93\u914d\u7f6e\u9009\u9879\uff08\u89c1<a class=\"xref\" href=\"/docs/17/config-setting.html#CONFIG-SETTING-SHELL\" title=\"19.1.4.\u00a0\u901a\u8fc7 Shell \u5f71\u54cd\u53c2\u6570\">\u7b2c\u00a019.1.4\u00a0\u8282</a>\uff09\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u7528\u5982\u4e0b\u65b9\u5f0f\u4e3a pgbench \u521b\u5efa\u7684\u8868\u6307\u5b9a\u4e00\u4e2a\u540d\u4e3a<code class=\"literal\">wuzza</code>\u7684\u5047\u60f3\u9ed8\u8ba4\u8868\u8bbf\u95ee\u65b9\u6cd5\uff1a</p>\n<pre class=\"programlisting\">PGOPTIONS='-c default_table_access_method=wuzza'\n</pre>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.11\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.12\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/17/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.10.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/17/pgbench.html", "method": "same-major semantic node", "sha256": "c16640c9a24df59ad3afecf40b5d7a89d790fab149857245e243b451646b7dfc", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[4]/a[0]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[55]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[57]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/h2[0]", "#PGBENCH/div[7]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[7]/h2[0]", "#PGBENCH/div[7]/p[2]", "#PGBENCH/div[7]/p[3]", "#PGBENCH/div[8]/div[10]/h3[0]", "#PGBENCH/div[8]/div[10]/p[1]", "#PGBENCH/div[8]/div[10]/p[2]", "#PGBENCH/div[8]/div[10]/p[4]", "#PGBENCH/div[8]/div[10]/p[5]", "#PGBENCH/div[8]/div[11]/h3[0]", "#PGBENCH/div[8]/div[11]/p[1]", "#PGBENCH/div[8]/div[1]/h3[0]", "#PGBENCH/div[8]/div[1]/h3[0]/span[1]", "#PGBENCH/div[8]/div[1]/p[1]", "#PGBENCH/div[8]/div[1]/p[2]", "#PGBENCH/div[8]/div[1]/p[4]", "#PGBENCH/div[8]/div[1]/p[5]", "#PGBENCH/div[8]/div[2]/div[3]/h3[0]", "#PGBENCH/div[8]/div[2]/div[3]/p[1]", "#PGBENCH/div[8]/div[2]/div[3]/p[2]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[4]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[5]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[1]", "#PGBENCH/div[8]/div[2]/h3[0]", "#PGBENCH/div[8]/div[2]/p[1]", "#PGBENCH/div[8]/div[2]/p[2]", "#PGBENCH/div[8]/div[2]/p[4]", "#PGBENCH/div[8]/div[2]/p[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[3]/div[2]/p[0]", "#PGBENCH/div[8]/div[3]/h3[0]", "#PGBENCH/div[8]/div[3]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[18]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[4]/div[2]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[8]/div[4]/div[6]/p[1]", "#PGBENCH/div[8]/div[4]/div[6]/p[2]", "#PGBENCH/div[8]/div[4]/h3[0]", "#PGBENCH/div[8]/div[4]/p[10]", "#PGBENCH/div[8]/div[4]/p[12]", "#PGBENCH/div[8]/div[4]/p[14]", "#PGBENCH/div[8]/div[4]/p[15]", "#PGBENCH/div[8]/div[4]/p[17]", "#PGBENCH/div[8]/div[4]/p[1]", "#PGBENCH/div[8]/div[4]/p[4]", "#PGBENCH/div[8]/div[4]/p[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[5]/h3[0]", "#PGBENCH/div[8]/div[5]/p[12]", "#PGBENCH/div[8]/div[5]/p[14]", "#PGBENCH/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[5]/p[4]", "#PGBENCH/div[8]/div[5]/p[5]", "#PGBENCH/div[8]/div[5]/p[7]", "#PGBENCH/div[8]/div[5]/p[9]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[6]/h3[0]", "#PGBENCH/div[8]/div[6]/p[1]", "#PGBENCH/div[8]/div[6]/p[3]", "#PGBENCH/div[8]/div[6]/p[5]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[7]/h3[0]", "#PGBENCH/div[8]/div[7]/p[10]", "#PGBENCH/div[8]/div[7]/p[1]", "#PGBENCH/div[8]/div[7]/p[3]", "#PGBENCH/div[8]/div[7]/p[4]", "#PGBENCH/div[8]/div[7]/p[5]", "#PGBENCH/div[8]/div[7]/p[7]", "#PGBENCH/div[8]/div[7]/p[9]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[8]/div[4]/p[2]", "#PGBENCH/div[8]/div[8]/div[4]/p[3]", "#PGBENCH/div[8]/div[8]/p[1]", "#PGBENCH/div[8]/div[8]/p[3]", "#PGBENCH/div[8]/div[8]/p[5]", "#PGBENCH/div[8]/div[8]/p[7]", "#PGBENCH/div[8]/div[9]/h3[0]", "#PGBENCH/div[8]/div[9]/p[1]", "#PGBENCH/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/17/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/17/facts/0/label": "Documented executable", "/versions/17/facts/0/value": "pgbench", "/versions/17/facts/1/label": "Executable version", "/versions/17/facts/2/label": "Reference inventory", "/versions/17/facts/2/value": "Client applications", "/versions/17/facts/3/label": "Option definition groups", "/versions/17/tables/0/title": "Documented options", "/versions/17/tables/1/title": "Environment variables", "/versions/17/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/17/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/17/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/17/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/17/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/17/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/17/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/17/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/17/tables/0/rows/8/summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "/versions/17/tables/0/rows/9/summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "/versions/17/tables/0/columns/0/label": "Option and arguments", "/versions/17/tables/0/columns/1/label": "Description", "/versions/17/tables/0/rows/10/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/17/tables/0/rows/11/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/17/tables/0/rows/12/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/17/tables/0/rows/13/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/17/tables/0/rows/14/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/17/tables/0/rows/15/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/17/tables/0/rows/16/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/17/tables/0/rows/17/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/17/tables/0/rows/18/summary": "Write information about each transaction to a log file. See below for details.", "/versions/17/tables/0/rows/19/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/17/tables/0/rows/20/summary": "Protocol to use for submitting queries to the server:", "/versions/17/tables/0/rows/21/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/17/tables/0/rows/22/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/17/tables/0/rows/23/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "/versions/17/tables/0/rows/24/summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "/versions/17/tables/0/rows/25/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/17/tables/0/rows/26/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/17/tables/0/rows/27/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/17/tables/0/rows/28/summary": "Number of transactions each client runs. Default is 10.", "/versions/17/tables/0/rows/29/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/17/tables/0/rows/30/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/17/tables/0/rows/31/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/17/tables/0/rows/32/summary": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case.", "/versions/17/tables/0/rows/33/summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "/versions/17/tables/0/rows/34/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/17/tables/0/rows/35/summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "/versions/17/tables/0/rows/36/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/17/tables/0/rows/37/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/17/tables/0/rows/38/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/17/tables/0/rows/39/summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "/versions/17/tables/0/rows/40/summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "/versions/17/tables/0/rows/41/summary": "Print debugging output.", "/versions/17/tables/0/rows/42/summary": "The database server's host name", "/versions/17/tables/0/rows/43/summary": "The database server's port number", "/versions/17/tables/0/rows/44/summary": "The user name to connect as", "/versions/17/tables/0/rows/45/summary": "Print the pgbench version and exit.", "/versions/17/tables/0/rows/46/summary": "Show help about pgbench command line arguments, and exit.", "/versions/17/tables/1/columns/0/label": "Variable", "/versions/17/tables/1/columns/1/label": "Meaning", "/versions/17/tables/1/rows/0/description": "Default connection parameters."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "e53d657226bdd522b4c38cfdd2b00f8953df82d16d2cb11065741ef59ea3b3e9"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option with version 14 or later of PostgreSQL to speed up subsequent VACUUM , except on the pgbench_accounts table if partitions are enabled. Using g causes logging to print one message every 100,000 rows while generating data for all tables. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "signature": "--partition-method= NAME", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "signature": "--partitions= NUM", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 53 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "signature": "-r --report-per-command", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--exit-on-abort"], "signature": "--exit-on-abort", "description": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case. Note that serialization failures or deadlock failures do not abort the client, so they are not affected by this option. See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--failures-detailed"], "signature": "--failures-detailed", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "signature": "--max-tries= number_of_tries", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= seed", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "signature": "--show-script= scriptname", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "signature": "--verbose-errors", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--debug"], "signature": "--debug", "description": "Print debugging output."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}]}, "comparison_hash": "cfbbc44216efd4ea312f93b245c3b32403ffb244e91b019a295bb5adf5c8dc62", "manual_language": "zh"}, "18": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "47"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-INITIALIZE", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "text": "--partition-method= NAME"}}, {"summary": "\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PARTITIONS", "text": "--partitions= NUM"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-TABLESPACE", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-BUILTIN", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-CLIENT", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-CONNECT", "text": "-C --connect"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-DEFINE", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-FILE", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-JOBS", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-LOG", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROTOCOL", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528 --max-tries \u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROGRESS", "text": "-P sec --progress= sec"}}, {"summary": "\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "text": "-r --report-per-command"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-RATE", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-TIME", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "text": "--aggregate-interval= seconds"}}, {"summary": "\u5f53\u4efb\u4e00\u5ba2\u6237\u7aef\u56e0\u9519\u8bef\u88ab\u4e2d\u6b62\u65f6\uff0c\u7acb\u5373\u9000\u51fa\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u5373\u4f7f\u67d0\u4e2a\u5ba2\u6237\u7aef\u88ab\u4e2d\u6b62\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4ecd\u53ef\u6309 -t \u6216 -T \u7684\u8bbe\u5b9a\u7ee7\u7eed\u8fd0\u884c\uff0c\u6b64\u65f6 pgbench \u4f1a\u8f93\u51fa\u4e0d\u5b8c\u6574\u7684\u7ed3\u679c\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-EXIT-ON-ABORT", "text": "--exit-on-abort"}}, {"summary": "\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "text": "--failures-detailed"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "text": "--log-prefix= prefix"}}, {"summary": "\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "text": "--max-tries= number_of_tries"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 seed \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 seed \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "text": "--random-seed= seed"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "text": "--sampling-rate= rate"}}, {"summary": "\u5c06\u5185\u7f6e\u811a\u672c scriptname \u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "text": "--show-script= scriptname"}}, {"summary": "\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1 \u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5 \u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "text": "--verbose-errors"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-DEBUG", "text": "--debug"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-USERNAME", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-INITIALIZE", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option to load data into ordinary (non-partition) tables with version 14 or later of PostgreSQL to speed up subsequent VACUUM . Using g causes logging to print one message every 100,000 rows while generating data for all tables. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-QUIET", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "signature": "--partition-method= NAME", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "signature": "--partitions= NUM", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PARTITIONS", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-TABLESPACE", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-BUILTIN", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-CLIENT", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-CONNECT", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-DEFINE", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-FILE", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-JOBS", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-LOG", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROTOCOL", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 54 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "signature": "-P sec --progress= sec", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROGRESS", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "signature": "-r --report-per-command", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-RATE", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-TIME", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--exit-on-abort"], "summary": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case.", "signature": "--exit-on-abort", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-EXIT-ON-ABORT", "description": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case. Note that serialization failures or deadlock failures do not abort the client, so they are not affected by this option. See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--failures-detailed"], "summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "signature": "--failures-detailed", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "signature": "--max-tries= number_of_tries", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= seed", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "signature": "--show-script= scriptname", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "signature": "--verbose-errors", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--debug"], "summary": "Print debugging output.", "signature": "--debug", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-DEBUG", "description": "Print debugging output."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-HOST", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PORT", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-USERNAME", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-VERSION", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-HELP", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "https://pg.center/docs/18/pgbench.html", "file": "pgbench.html", "label": "18.6 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "b9c9e5f08998320a7ecce6cb615b5eeddc7ef3d0cb5e6c4e3422f3d44c089004", "language": "en", "original_url": "/docs/18/pgbench.html"}, {"url": "https://pg.center/docs/18/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0", "language": "en", "original_url": "/docs/18/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u5178\u578b\u7684<span class=\"application\">pgbench</span>\u8f93\u51fa\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nlatency average = 11.013 ms\nlatency stddev = 7.351 ms\ninitial connection time = 45.758 ms\ntps = 896.967014 (without initial connection time)\n</pre>\n<p lang=\"zh\">\u524d\u4e03\u884c\u7ed9\u51fa\u4e86\u82e5\u5e72\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u7b2c\u516d\u884c\u62a5\u544a\u4e86\u51fa\u73b0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u65f6\u4e8b\u52a1\u5141\u8bb8\u7684\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u7b2c\u516b\u884c\u62a5\u544a\u5b9e\u9645\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u4e8b\u52a1\u6570\uff08\u540e\u8005\u4ec5\u4e3a\u5ba2\u6237\u7aef\u6570\u91cf\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u6216\u8005\u67d0\u4e9b SQL \u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u5426\u5219\u4e24\u8005\u5e94\u5f53\u76f8\u7b49\u3002\uff08\u5728<code class=\"option\">-T</code>\u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u4e8b\u52a1\u6570\u3002\uff09\u4e0b\u4e00\u884c\u62a5\u544a\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\u7684\u4e8b\u52a1\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u6700\u540e\u4e00\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">[<span class=\"optional\">-d</span>] <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">[<span class=\"optional\">--dbname=</span>]<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u5219\u4f7f\u7528\u8fde\u63a5\u6307\u5b9a\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INITIALIZE\"><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS\"><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002<em class=\"replaceable\"><code>init_steps</code></em>\u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-D\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-T\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-G\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\u6216<code class=\"literal\">G</code>\uff08\u5728\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">g</code>\uff08\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c\u6570\u636e\u7531<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u751f\u6210\uff0c\u518d\u901a\u8fc7<code class=\"command\">COPY</code>\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4f1a\u5927\u91cf\u5360\u7528\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u5e26\u5bbd\u3002\u5bf9\u4e8e 14 \u53ca\u4ee5\u4e0a\u7248\u672c\u7684<span class=\"productname\">PostgreSQL</span>\uff0c<code class=\"command\">pgbench</code>\u4f1a\u5728\u666e\u901a\uff08\u975e\u5206\u533a\uff09\u8868\u4e0a\u4f7f\u7528<code class=\"option\">FREEZE</code>\u9009\u9879\u88c5\u8f7d\u6570\u636e\uff0c\u4ee5\u52a0\u5feb\u540e\u7eed\u7684<code class=\"command\">VACUUM</code>\u3002\u4f7f\u7528<code class=\"literal\">g</code>\u65f6\uff0c\u5728\u4e3a\u6240\u6709\u8868\u751f\u6210\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6bcf\u751f\u6210 100,000 \u884c\u4f1a\u8f93\u51fa\u4e00\u6761\u65e5\u5fd7\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">G</code>\uff08\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u53ea\u53d1\u9001\u8f83\u5c0f\u7684\u67e5\u8be2\uff0c\u968f\u540e\u5b9e\u9645\u6570\u636e\u5728\u670d\u52a1\u5668\u7aef\u751f\u6210\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u9700\u8981\u5927\u91cf\u5e26\u5bbd\uff0c\u4f46\u670d\u52a1\u5668\u4f1a\u627f\u62c5\u66f4\u591a\u5de5\u4f5c\u3002\u4f7f\u7528<code class=\"literal\">G</code>\u65f6\uff0c\u751f\u6210\u6570\u636e\u671f\u95f4\u4e0d\u4f1a\u6253\u5370\u4efb\u4f55\u8fdb\u5ea6\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u521d\u59cb\u5316\u884c\u4e3a\u4f7f\u7528\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff08\u7b49\u540c\u4e8e<code class=\"literal\">g</code>\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-V\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-P\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-F\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILLFACTOR\"><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-INIT\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n<p lang=\"zh\">\u5982\u679c -I \u4e2d\u6307\u5b9a\u4e86 G\uff0c\u6b64\u8bbe\u7f6e\u4e0d\u751f\u6548\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-INIT\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FOREIGN-KEYS\"><span class=\"term\"><code class=\"option\">--foreign-keys</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INDEX-TABLESPACE\"><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITION-METHOD\"><span class=\"term\"><code class=\"option\">--partition-method=<em class=\"replaceable\"><code>NAME</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITIONS\"><span class=\"term\"><code class=\"option\">--partitions=<em class=\"replaceable\"><code>NUM</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TABLESPACE\"><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-UNLOGGED-TABLES\"><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-BUILTIN\"><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CLIENT\"><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CONNECT\"><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-DEFINE\"><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-JOBS\"><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LATENCY-LIMIT\"><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--max-tries</code>\u9009\u9879\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u56e0\u4e32\u884c\u5316\u5f02\u5e38\u6216\u6b7b\u9501\u800c\u5931\u8d25\uff0c\u4e14\u5176\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\u5927\u4e8e<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u5219\u4e0d\u4f1a\u518d\u91cd\u8bd5\u3002\u82e5\u53ea\u60f3\u9650\u5236\u5c1d\u8bd5\u603b\u65f6\u95f4\u800c\u4e0d\u9650\u5236\u5c1d\u8bd5\u6b21\u6570\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">--max-tries=0</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"option\">--max-tries</code>\u4e3a 1\uff0c\u51fa\u73b0\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROTOCOL\"><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5728<code class=\"literal\">prepared</code>\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pgbench</span> \u4ece\u7b2c\u4e8c\u6b21\u67e5\u8be2\u8fed\u4ee3\u5f00\u59cb\u590d\u7528\u89e3\u6790\u5206\u6790\u7ed3\u679c\uff0c\u56e0\u6b64<span class=\"application\">pgbench</span> \u6bd4\u5176\u4ed6\u6a21\u5f0f\u8fd0\u884c\u5f97\u66f4\u5feb\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u503c\u662f\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/protocol.html\" title=\"\u7b2c\u00a054\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a054\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-RUN\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SKIP-SOME-UPDATES\"><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS\"><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528<code class=\"option\">--max-tries</code>\u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-REPORT-LATENCIES\"><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-per-command</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RATE\"><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-RUN\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SELECT-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TRANSACTIONS\"><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TIME\"><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VACUUM-ALL\"><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-AGGREGATE-INTERVAL\"><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-EXIT-ON-ABORT\"><span class=\"term\"><code class=\"option\">--exit-on-abort</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53\u4efb\u4e00\u5ba2\u6237\u7aef\u56e0\u9519\u8bef\u88ab\u4e2d\u6b62\u65f6\uff0c\u7acb\u5373\u9000\u51fa\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u5373\u4f7f\u67d0\u4e2a\u5ba2\u6237\u7aef\u88ab\u4e2d\u6b62\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4ecd\u53ef\u6309<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u7684\u8bbe\u5b9a\u7ee7\u7eed\u8fd0\u884c\uff0c\u6b64\u65f6<span class=\"application\">pgbench</span>\u4f1a\u8f93\u51fa\u4e0d\u5b8c\u6574\u7684\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4e32\u884c\u5316\u5931\u8d25\u6216\u6b7b\u9501\u5931\u8d25\u4e0d\u4f1a\u4e2d\u6b62\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u4e0d\u53d7\u8be5\u9009\u9879\u5f71\u54cd\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FAILURES-DETAILED\"><span class=\"term\"><code class=\"option\">--failures-detailed</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e32\u884c\u5316\u5931\u8d25\uff1b</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u6b7b\u9501\u5931\u8d25\uff1b</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG-PREFIX\"><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-MAX-TRIES\"><span class=\"term\"><code class=\"option\">--max-tries=<em class=\"replaceable\"><code>number_of_tries</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS-TIMESTAMP\"><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RANDOM-SEED\"><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>seed</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>seed</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>seed</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SAMPLING-RATE\"><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SHOW-SCRIPT\"><span class=\"term\"><code class=\"option\">--show-script=</code><em class=\"replaceable\"><code>scriptname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5185\u7f6e\u811a\u672c<em class=\"replaceable\"><code>scriptname</code></em>\u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERBOSE-ERRORS\"><span class=\"term\"><code class=\"option\">--verbose-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u8fd8\u63a5\u53d7\u4ee5\u4e0b\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u53ca\u5176\u4ed6\u901a\u7528\u8bbe\u7f6e\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HOST\"><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u6210\u529f\u8fd0\u884c\u65f6\u9000\u51fa\u72b6\u6001\u4e3a 0\u3002\u9000\u51fa\u72b6\u6001 1 \u8868\u793a\u9759\u6001\u95ee\u9898\uff0c\u4f8b\u5982\u65e0\u6548\u7684\u547d\u4ee4\u884c\u9009\u9879\uff0c\u6216\u8005\u672c\u4e0d\u5e94\u53d1\u751f\u7684\u5185\u90e8\u9519\u8bef\u3002\u57fa\u51c6\u6d4b\u8bd5\u542f\u52a8\u9636\u6bb5\u7684\u65e9\u671f\u9519\u8bef\uff0c\u4f8b\u5982\u521d\u59cb\u8fde\u63a5\u5931\u8d25\uff0c\u4e5f\u4f1a\u4ee5\u72b6\u6001 1 \u9000\u51fa\u3002\u8fd0\u884c\u671f\u95f4\u7684\u9519\u8bef\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u9519\u8bef\u6216\u811a\u672c\u95ee\u9898\uff0c\u4f1a\u5bfc\u81f4\u9000\u51fa\u72b6\u6001\u4e3a 2\u3002\u5728\u540e\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u6ca1\u6709\u6307\u5b9a --exit-on-abort \u9009\u9879\uff0cpgbench \u4f1a\u6253\u5370\u90e8\u5206\u7ed3\u679c\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.8\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.9\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"TRANSACTIONS-AND-SCRIPTS\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n<p lang=\"zh\">\u5047\u5b9a<span class=\"application\">pgbench</span>\u811a\u672c\u4e0d\u5305\u542b\u4e0d\u5b8c\u6574\u7684 SQL \u4e8b\u52a1\u5757\u3002\u5982\u679c\u5728\u8fd0\u884c\u65f6\u5ba2\u6237\u7aef\u5728\u5c1a\u672a\u5b8c\u6210\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5757\u65f6\u5c31\u5230\u8fbe\u811a\u672c\u672b\u5c3e\uff0c\u8be5\u5ba2\u6237\u7aef\u5c06\u88ab\u4e2d\u6b62\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u673a\u5236\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5e76\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u5982\u4e0a\u6240\u8ff0\uff0c\u53d8\u91cf\u53ef\u4ee5\u7528\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e0b\u6587\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u901a\u8fc7<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u5148\u8bbe\u7f6e\u7684\u53d8\u91cf\u4e4b\u5916\uff0c\u8fd8\u6709\u5c11\u91cf\u53d8\u91cf\u4f1a\u88ab\u81ea\u52a8\u9884\u8bbe\uff0c\u5217\u5728<a class=\"xref\" href=\"/docs/18/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0301.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0301</a>\u4e2d\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u503c\uff0c\u5219\u4f1a\u8986\u76d6\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u4e00\u65e6\u8bbe\u7f6e\u597d\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u5728 SQL \u547d\u4ee4\u4e2d\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u6765\u63d2\u5165\u5176\u503c\u3002\u5f53\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u53d8\u91cf\u96c6\u5408\u3002<span class=\"application\">pgbench</span>\u5728\u5355\u6761\u8bed\u53e5\u4e2d\u6700\u591a\u652f\u6301 255 \u6b21\u53d8\u91cf\u4f7f\u7528\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0301.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u548c\u4f2a\u968f\u673a\u7f6e\u6362\u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [<em class=\"replaceable\"><code>prefix</code></em>]</code> <code class=\"literal\">\\aset [<em class=\"replaceable\"><code>prefix</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e9b\u547d\u4ee4\u53ef\u7528\u4e8e\u7ed3\u675f SQL \u67e5\u8be2\uff0c\u4ee5\u4ee3\u66ff\u7ed3\u5c3e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\gset</code>\u547d\u4ee4\u65f6\uff0c\u524d\u9762\u7684 SQL \u67e5\u8be2\u9884\u671f\u8fd4\u56de\u4e00\u884c\uff0c\u5176\u5404\u5217\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\aset</code>\u547d\u4ee4\u65f6\uff0c\u6240\u6709\u7ec4\u5408 SQL \u67e5\u8be2\uff08\u7531<code class=\"literal\">\\;</code>\u5206\u9694\uff09\u7684\u5217\u90fd\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\u4e2d\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u4e0d\u8fd4\u56de\u4efb\u4f55\u884c\uff0c\u5219\u4e0d\u4f1a\u8fdb\u884c\u8d4b\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u6765\u68c0\u6d4b\u8fd9\u79cd\u60c5\u51b5\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u591a\u884c\uff0c\u5219\u4fdd\u7559\u6700\u540e\u4e00\u4e2a\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\gset</code> \u548c <code class=\"literal\">\\aset</code> \u4e0d\u80fd\u7528\u5728\u7ba1\u9053\u6a21\u5f0f\uff0c\u56e0\u4e3a\u5728\u547d\u4ee4\u9700\u8981\u5b83\u4eec\u7684\u65f6\u5019\uff0c\u67e5\u8be2\u7ed3\u679c\u8fd8\u4e0d\u53ef\u7528\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u7684\u793a\u4f8b\u5c06\u7b2c\u4e00\u4e2a\u67e5\u8be2\u4e2d\u7684\u6700\u7ec8\u8d26\u6237\u4f59\u989d\u653e\u5165\u53d8\u91cf<em class=\"replaceable\"><code>abalance</code></em>\uff0c\u5e76\u7528\u7b2c\u4e09\u4e2a\u67e5\u8be2\u4e2d\u7684\u6574\u6570\u586b\u5145\u53d8\u91cf<em class=\"replaceable\"><code>p_two</code></em>\u548c<em class=\"replaceable\"><code>p_three</code></em>\u3002\u7b2c\u4e8c\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002\u6700\u540e\u4e24\u4e2a\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u5b58\u5165\u53d8\u91cf<em class=\"replaceable\"><code>four</code></em>\u548c<em class=\"replaceable\"><code>five</code></em>\u3002</p>\n<pre class=\"programlisting\">UPDATE pgbench_accounts\n  SET abalance = abalance + :delta\n  WHERE aid = :aid\n  RETURNING abalance \\gset\n-- compound of two queries\nSELECT 1 \\;\nSELECT 2 AS two, 3 AS three \\gset p_\nSELECT 4 AS four \\; SELECT 5 AS five \\aset\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-IF-ELSE\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/18/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/18/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/18/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.18.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u8fc7\u5927\u6216\u8fc7\u5c0f\u7684\u6574\u6570\u548c\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff0c\u4ee5\u53ca\u6574\u6570\u7b97\u672f\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u548c<code class=\"literal\">/</code>\uff09\u90fd\u4f1a\u5728\u6ea2\u51fa\u65f6\u5f15\u53d1\u9519\u8bef\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SLEEP\"><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SETSHELL\"><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SHELL\"><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\syncpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u7ec4\u547d\u4ee4\u7528\u4e8e\u5b9e\u73b0 SQL \u8bed\u53e5\u7684\u7ba1\u9053\u6267\u884c\u3002\u7ba1\u9053\u5fc5\u987b\u4ee5<code class=\"command\">\\startpipeline</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endpipeline</code>\u7ed3\u675f\uff1b\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u51fa\u73b0\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\syncpipeline</code>\uff0c\u5b83\u4f1a\u53d1\u9001\u4e00\u4e2a<a class=\"link\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3.\u00a0\u6269\u5c55\u67e5\u8be2\">sync \u6d88\u606f</a>\uff0c\u65e2\u4e0d\u4f1a\u7ed3\u675f\u5f53\u524d\u7ba1\u9053\uff0c\u4e5f\u4e0d\u4f1a\u5237\u65b0\u53d1\u9001\u7f13\u51b2\u533a\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u4e00\u6761\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/libpq-pipeline-mode.html\" title=\"32.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a032.5\u00a0\u8282</a>\u3002\u7ba1\u9053\u6a21\u5f0f\u8981\u6c42\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/18/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0302.\u00a0pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0302</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/18/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002\u8fd9\u4e9b\u64cd\u4f5c\u7b26\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u5217\u51fa\u3002\u9664\u975e\u53e6\u6709\u8bf4\u660e\uff0c\u63a5\u53d7\u4e24\u4e2a\u6570\u5b57\u8f93\u5165\u7684\u64cd\u4f5c\u7b26\u53ea\u8981\u4efb\u4e00\u8f93\u5165\u4e3a\u53cc\u7cbe\u5ea6\uff0c\u5c31\u4f1a\u4ea7\u751f\u53cc\u7cbe\u5ea6\u7ed3\u679c\uff1b\u5426\u5219\u4ea7\u751f\u6574\u6570\u7ed3\u679c\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0302.\u00a0pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u64cd\u4f5c\u7b26</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">OR</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u6216</p>\n<p><code class=\"literal\">5 or 0</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">AND</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u4e0e</p>\n<p><code class=\"literal\">3 and 0</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">NOT</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u975e</p>\n<p><code class=\"literal\">not false</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5e03\u5c14\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 is null</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>value</code></em> <code class=\"literal\">ISNULL|NOTNULL</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7a7a\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 notnull</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 = 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;&gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">!=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 != 5</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e</p>\n<p><code class=\"literal\">5 &lt; 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;= 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e</p>\n<p><code class=\"literal\">5 &gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &gt;= 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">|</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u6216</p>\n<p><code class=\"literal\">1 | 2</code> \u2192 <code class=\"returnvalue\">3</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">#</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5f02\u6216</p>\n<p><code class=\"literal\">1 # 3</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&amp;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u4e0e</p>\n<p><code class=\"literal\">1 &amp; 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">~</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u975e</p>\n<p><code class=\"literal\">~ 1</code> \u2192 <code class=\"returnvalue\">-2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&lt;&lt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5de6\u79fb</p>\n<p><code class=\"literal\">1 &lt;&lt; 2</code> \u2192 <code class=\"returnvalue\">4</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&gt;&gt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u53f3\u79fb</p>\n<p><code class=\"literal\">8 &gt;&gt; 2</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">+</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u52a0\u6cd5</p>\n<p><code class=\"literal\">5 + 4</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u51cf\u6cd5</p>\n<p><code class=\"literal\">3 - 2.0</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">*</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u4e58\u6cd5</p>\n<p><code class=\"literal\">5 * 4</code> \u2192 <code class=\"returnvalue\">20</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">/</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u9664\u6cd5\uff08\u5982\u679c\u4e24\u4e2a\u8f93\u5165\u90fd\u662f\u6574\u6570\uff0c\u5219\u5c06\u7ed3\u679c\u5411\u96f6\u622a\u65ad\uff09</p>\n<p><code class=\"literal\">5 / 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">%</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">3 % 2</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u53d6\u76f8\u53cd\u6570</p>\n<p><code class=\"literal\">- 2.0</code> \u2192 <code class=\"returnvalue\">-2.0</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/18/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0303.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0303</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/18/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0303.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u51fd\u6570</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">abs</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u7edd\u5bf9\u503c</p>\n<p><code class=\"literal\">abs(-17)</code> \u2192 <code class=\"returnvalue\">17</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">debug</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u5c06\u53c2\u6570\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de\u53c2\u6570\u3002</p>\n<p><code class=\"literal\">debug(5432.1)</code> \u2192 <code class=\"returnvalue\">5432.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">double</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u8f6c\u6362\u4e3a double\u3002</p>\n<p><code class=\"literal\">double(5432)</code> \u2192 <code class=\"returnvalue\">5432.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">exp</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u6307\u6570\u51fd\u6570\uff08<code class=\"literal\">e</code> \u7684\u7ed9\u5b9a\u6b21\u5e42\uff09</p>\n<p><code class=\"literal\">exp(1.0)</code> \u2192 <code class=\"returnvalue\">2.718281828459045</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">greatest</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c\u3002</p>\n<p><code class=\"literal\">greatest(5, 4, 3, 2)</code> \u2192 <code class=\"returnvalue\">5</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8fd9\u662f <code class=\"function\">hash_murmur2</code> \u7684\u522b\u540d\u3002</p>\n<p><code class=\"literal\">hash(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_fnv1a</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\" target=\"_top\">FNV-1a hash</a>\u3002</p>\n<p><code class=\"literal\">hash_fnv1a(10, 5432)</code> \u2192 <code class=\"returnvalue\">-7793829335365542153</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_murmur2</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/MurmurHash\" target=\"_top\">MurmurHash2 hash</a>\u3002</p>\n<p><code class=\"literal\">hash_murmur2(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">int</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8f6c\u6362\u4e3a integer\u3002</p>\n<p><code class=\"literal\">int(5.4 + 3.8)</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">least</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c\u3002</p>\n<p><code class=\"literal\">least(5, 4, 3, 2.1)</code> \u2192 <code class=\"returnvalue\">2.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">ln</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u81ea\u7136\u5bf9\u6570</p>\n<p><code class=\"literal\">ln(2.718281828459045)</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">mod</code> ( <em class=\"replaceable\"><code>integer</code></em>, <em class=\"replaceable\"><code>integer</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">mod(54, 32)</code> \u2192 <code class=\"returnvalue\">22</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">permute</code> ( <em class=\"parameter\"><code>i</code></em>, <em class=\"parameter\"><code>size</code></em> [, <em class=\"parameter\"><code>seed</code></em> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\"><em class=\"parameter\"><code>i</code></em>\u7684\u7f6e\u6362\u503c\uff0c\u8303\u56f4\u5728<code class=\"literal\">[0, size)</code>\u5185\u3002\u5b83\u8868\u793a<em class=\"parameter\"><code>i</code></em>\uff08\u6a21<em class=\"parameter\"><code>size</code></em>\uff09\u5728\u6574\u6570<code class=\"literal\">0...size-1</code>\u7684\u4f2a\u968f\u673a\u7f6e\u6362\u4e2d\u7684\u65b0\u4f4d\u7f6e\uff1b\u8be5\u7f6e\u6362\u7531<em class=\"parameter\"><code>seed</code></em>\u53c2\u6570\u5316\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">permute(0, 4)</code> \u2192 <code class=\"returnvalue\">an integer between 0 and 3</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pi</code> () \u2192 <code class=\"returnvalue\">double</code></p>\n<p><span class=\"symbol_font\">\u03c0</span>\u7684\u8fd1\u4f3c\u503c</p>\n<p><code class=\"literal\">pi()</code> \u2192 <code class=\"returnvalue\">3.14159265358979323846</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pow</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p class=\"func_signature\"><code class=\"function\">power</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p><em class=\"parameter\"><code>x</code></em> \u7684 <em class=\"parameter\"><code>y</code></em> \u6b21\u5e42</p>\n<p><code class=\"literal\">pow(2.0, 10)</code> \u2192 <code class=\"returnvalue\">1024.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u5747\u5300\u5206\u5e03\u968f\u673a\u6574\u6570\u3002</p>\n<p><code class=\"literal\">random(1, 10)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_exponential</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u6307\u6570\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_exponential(1, 10, 3.0)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_gaussian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u9ad8\u65af\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_gaussian(1, 10, 2.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_zipfian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684 Zipfian \u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_zipfian(1, 10, 1.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">sqrt</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u5e73\u65b9\u6839</p>\n<p><code class=\"literal\">sqrt(2.0)</code> \u2192 <code class=\"returnvalue\">1.414213562</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002parameter \u5141\u8bb8\u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n<p lang=\"zh\">pgbench \u7684\u5b9e\u73b0\u57fa\u4e8e Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002\u7531\u4e8e\u8be5\u7b97\u6cd5\u7684\u9650\u5236\uff0cparameter \u7684\u53d6\u503c\u9650\u5236\u5728 [1.001, 1000] \u8303\u56f4\u5185\u3002</p>\n</li>\n</ul>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u8bbe\u8ba1\u4ee5\u975e\u5747\u5300\u65b9\u5f0f\u9009\u62e9\u884c\u7684\u57fa\u51c6\u6d4b\u8bd5\u65f6\uff0c\u8981\u6ce8\u610f\u88ab\u9009\u4e2d\u7684\u884c\u53ef\u80fd\u4e0e\u5176\u4ed6\u6570\u636e\u76f8\u5173\uff0c\u4f8b\u5982\u4e0e\u5e8f\u5217\u751f\u6210\u7684 ID \u6216\u7269\u7406\u884c\u987a\u5e8f\u76f8\u5173\uff0c\u8fd9\u53ef\u80fd\u4f1a\u626d\u66f2\u6027\u80fd\u6d4b\u91cf\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u4e3a\u907f\u514d\u8fd9\u4e00\u70b9\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"function\">permute</code>\u51fd\u6570\uff0c\u6216\u91c7\u7528\u5176\u4ed6\u5177\u6709\u7c7b\u4f3c\u6548\u679c\u7684\u989d\u5916\u6b65\u9aa4\uff0c\u5bf9\u9009\u4e2d\u7684\u884c\u8fdb\u884c\u6253\u4e71\u5e76\u79fb\u9664\u6b64\u7c7b\u76f8\u5173\u6027\u3002</p>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570<code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code>\u548c<code class=\"literal\">hash_fnv1a</code>\u90fd\u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f1a\u4f7f\u7528<code class=\"literal\">:default_seed</code>\u7684\u503c\uff1b\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c<code class=\"literal\">-D</code>\u9009\u9879\u8986\u76d6\uff0c\u5426\u5219\u8be5\u503c\u4f1a\u88ab\u968f\u673a\u521d\u59cb\u5316\u3002</p>\n<p lang=\"zh\">permute \u63a5\u53d7\u8f93\u5165\u503c\u3001\u5927\u5c0f\u548c\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5b83\u5728 [0, size) \u8303\u56f4\u5185\u751f\u6210\u6574\u6570\u7684\u4f2a\u968f\u673a\u6392\u5217\uff0c\u5e76\u8fd4\u56de\u8f93\u5165\u503c\u5728\u6392\u5217\u4e2d\u7684\u7d22\u5f15\u3002\u6240\u9009\u6392\u5217\u7531\u79cd\u5b50\u51b3\u5b9a\uff0c\u672a\u6307\u5b9a\u79cd\u5b50\u65f6\u9ed8\u8ba4\u4f7f\u7528 :default_seed\u3002\u4e0e\u54c8\u5e0c\u51fd\u6570\u4e0d\u540c\uff0cpermute \u4fdd\u8bc1\u8f93\u51fa\u503c\u65e2\u65e0\u51b2\u7a81\u4e5f\u65e0\u7a7a\u7f3a\u3002\u533a\u95f4\u5916\u7684\u8f93\u5165\u503c\u4f1a\u5bf9 size \u53d6\u6a21\u3002\u5982\u679c size \u4e0d\u662f\u6b63\u6570\uff0c\u51fd\u6570\u4f1a\u62a5\u9519\u3002permute \u53ef\u7528\u4e8e\u6253\u6563 random_zipfian \u6216 random_exponential \u7b49\u975e\u5747\u5300\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f7f\u66f4\u9891\u7e41\u62bd\u53d6\u7684\u503c\u4e0d\u4f1a\u5b58\u5728\u7b80\u5355\u7684\u5173\u8054\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e0a\u53ef\u80fd\u51fa\u73b0\u7684\u4e00\u7c7b\u5178\u578b\u5b9e\u9645\u8d1f\u8f7d\uff1a\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u8fc7\u91cf\u8d1f\u8f7d\u3002</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, :size, 1.07)\n\\set k 1 + permute(:r, :size)\n</pre>\n<p lang=\"zh\">\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u82e5\u5e72\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u53ef\u9009\u79cd\u5b50\u53c2\u6570\u5c31\u5f88\u6709\u7528\uff1a</p>\n<pre class=\"programlisting\">\\set k1 1 + permute(:r, :size, :default_seed + 123)\n\\set k2 1 + permute(:r, :size, :default_seed + 321)\n</pre>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u7528<code class=\"function\">hash</code>\u8fd1\u4f3c\u5b9e\u73b0\u7c7b\u4f3c\u7684\u884c\u4e3a\uff1a</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, 100 * :size, 1.07)\n\\set k 1 + abs(hash(:r)) % :size\n</pre>\n<p lang=\"zh\">\u4f46\u662f\uff0c\u7531\u4e8e<code class=\"function\">hash</code>\u4f1a\u4ea7\u751f\u51b2\u7a81\uff0c\u6709\u4e9b\u503c\u5c06\u6c38\u8fdc\u4e0d\u53ef\u8fbe\uff0c\u800c\u53e6\u4e00\u4e9b\u503c\u5219\u4f1a\u6bd4\u539f\u59cb\u5206\u5e03\u6240\u9884\u671f\u7684\u66f4\u5e38\u51fa\u73b0\u3002</p>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u6587\u4ef6\u7684\u6bcf\u4e00\u884c\u63cf\u8ff0\u4e00\u4e2a\u4e8b\u52a1\u3002\u5b83\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>client_id</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8fd0\u884c\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>transaction_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edf\u8ba1\u8be5\u4f1a\u8bdd\u5df2\u6267\u884c\u7684\u4e8b\u52a1\u6570\u91cf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u8017\u65f6\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>script_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8be5\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5f53\u901a\u8fc7<code class=\"option\">-f</code>\u6216<code class=\"option\">-b</code>\u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_epoch</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_us</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\u7684\u5c0f\u6570\u79d2\u90e8\u5206\uff0c\u4ee5\u5fae\u79d2\u4e3a\u5355\u4f4d</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>schedule_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff0c\u5373\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff08\u4ec5\u5728\u6307\u5b9a<code class=\"option\">--rate</code>\u65f6\u51fa\u73b0\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4e8b\u52a1\u6267\u884c\u671f\u95f4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08\u4ec5\u5f53 --max-tries \u4e0d\u7b49\u4e8e\u4e00\u65f6\u51fa\u73b0\uff09</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5f53\u540c\u65f6\u4f7f\u7528<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\u65f6\uff0c\u8df3\u8fc7\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">skipped</code>\u3002\u5982\u679c\u4e8b\u52a1\u4ee5\u5931\u8d25\u7ed3\u675f\uff0c\u5176<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">failed</code>\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u4f1a\u6839\u636e\u5931\u8d25\u7c7b\u578b\u62a5\u544a\u4e3a<code class=\"literal\">serialization</code>\u6216<code class=\"literal\">deadlock</code>\uff08\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5305\u542b\u5931\u8d25\u4e0e\u91cd\u8bd5\u7684\u65e5\u5fd7\u7247\u6bb5\uff0c\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u8bbe\u4e3a 10\uff08\u6ce8\u610f\u989d\u5916\u7684 retries \u5217\uff09\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 failed 0 1499414498 84905 9\n2 0 failed 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u7684\u7c7b\u578b\u5c06\u5728<em class=\"replaceable\"><code>time</code></em>\u4e2d\u62a5\u544a\uff0c\u5982\u4e0b\u6240\u793a\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 serialization 0 1499414498 84905 9\n2 0 serialization 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--aggregate-interval</code>\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u4f1a\u91c7\u7528\u4e0d\u540c\u7684\u683c\u5f0f\u3002\u6bcf\u4e00\u884c\u65e5\u5fd7\u63cf\u8ff0\u4e00\u4e2a\u805a\u5408\u65f6\u95f4\u95f4\u9694\uff0c\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>interval_start</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u7684\u8d77\u59cb\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>num_transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u5185\u7684\u4e8b\u52a1\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u603b\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>skipped</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56e0\u4e3a\u542f\u52a8\u65f6\u95f4\u4f1a\u592a\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retried</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>serialization_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u4e32\u884c\u5316\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>deadlock_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u6b7b\u9501\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4f7f\u7528\u8be5\u9009\u9879\u751f\u6210\u7684\u793a\u4f8b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\"><strong class=\"userinput\"><code>pgbench --aggregate-interval=10 --time=20 --client=10 --log --rate=1000 --latency-limit=10 --failures-detailed --max-tries=10 test</code></strong>\n\n1650260552 5178 26171317 177284491527 1136 44462 2647617 7321113867 0 9866 64 7564 28340 4148 0\n1650260562 4808 25573984 220121792172 1171 62083 3037380 9666800914 0 9998 598 7392 26621 4527 0\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u62a5\u544a</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\uff0c<span class=\"application\">pgbench</span>\u4e3a\u6bcf\u4e2a\u8bed\u53e5\u6536\u96c6\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">latency</code> \u2014 \u6bcf\u6761\u8bed\u53e5\u7684\u8017\u65f6\u3002<span class=\"application\">pgbench</span>\u62a5\u544a\u8be5\u8bed\u53e5\u6240\u6709\u6210\u529f\u6267\u884c\u7684\u5e73\u5747\u503c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u7684\u5931\u8d25\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u53d1\u751f\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u62a5\u544a\u4ec5\u5728<code class=\"option\">--max-tries</code>\u9009\u9879\u4e0d\u7b49\u4e8e1\u65f6\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6240\u6709\u6570\u503c\u90fd\u662f\u9488\u5bf9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u8ba1\u7b97\u7684\uff0c\u5e76\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u5c06\u7c7b\u4f3c\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nnumber of transactions above the 50.0 ms latency limit: 1311/10000 (13.110 %)\nlatency average = 28.488 ms\nlatency stddev = 21.009 ms\ninitial connection time = 69.068 ms\ntps = 346.224794 (without initial connection time)\nstatement latencies in milliseconds and failures:\n   0.012  0  \\set aid random(1, 100000 * :scale)\n   0.002  0  \\set bid random(1, 1 * :scale)\n   0.002  0  \\set tid random(1, 10 * :scale)\n   0.002  0  \\set delta random(-5000, 5000)\n   0.319  0  BEGIN;\n   0.834  0  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n   0.641  0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  11.126  0  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  12.961  0  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n   0.634  0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n   1.957  0  END;\n</pre>\n<p lang=\"zh\">\u4f7f\u7528\u53ef\u4e32\u884c\u5316\u9ed8\u8ba4\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\u7684\u9ed8\u8ba4\u811a\u672c\u7684\u53e6\u4e00\u4e2a\u8f93\u51fa\u793a\u4f8b\uff08<code class=\"command\">PGOPTIONS='-c default_transaction_isolation=serializable' pgbench ...</code>\uff09\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 10\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 6317/10000\nnumber of failed transactions: 3683 (36.830%)\nnumber of transactions retried: 7667 (76.670%)\ntotal number of retries: 45339\nnumber of transactions above the 50.0 ms latency limit: 106/6317 (1.678 %)\nlatency average = 17.016 ms\nlatency stddev = 13.283 ms\ninitial connection time = 45.017 ms\ntps = 186.792667 (without initial connection time)\nstatement latencies in milliseconds, failures and retries:\n  0.006     0      0  \\set aid random(1, 100000 * :scale)\n  0.001     0      0  \\set bid random(1, 1 * :scale)\n  0.001     0      0  \\set tid random(1, 10 * :scale)\n  0.001     0      0  \\set delta random(-5000, 5000)\n  0.385     0      0  BEGIN;\n  0.773     0      1  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n  0.624     0      0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  1.098   320   3762  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  0.582  3363  41576  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n  0.465     0      0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n  1.933     0      0  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"FAILURES-AND-RETRIES\">\n<h3 lang=\"zh\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</h3>\n<p lang=\"zh\">\u5728\u6267\u884c<span class=\"application\">pgbench</span>\u65f6\uff0c\u6709\u4e09\u79cd\u4e3b\u8981\u7c7b\u578b\u7684\u9519\u8bef\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e3b\u7a0b\u5e8f\u9519\u8bef\u3002\u5b83\u4eec\u6700\u4e3a\u4e25\u91cd\uff0c\u603b\u662f\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\uff0c\u5e76\u663e\u793a\u76f8\u5e94\u7684\u9519\u8bef\u6d88\u606f\u3002\u5b83\u4eec\u5305\u62ec\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\" style=\"list-style-type: circle;\">\n<li class=\"listitem\">\n<p><span class=\"application\">pgbench</span>\u5f00\u59cb\u6267\u884c\u65f6\u7684\u9519\u8bef\uff08\u4f8b\u5982\u9009\u9879\u503c\u65e0\u6548\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u521d\u59cb\u5316\u6a21\u5f0f\u4e2d\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u7528\u4e8e\u521b\u5efa\u5185\u7f6e\u811a\u672c\u6240\u9700\u8868\u7684\u67e5\u8be2\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5728\u7ebf\u7a0b\u542f\u52a8\u4e4b\u524d\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\u65e0\u6cd5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3001\u5143\u547d\u4ee4\u4e2d\u6709\u8bed\u6cd5\u9519\u8bef\u3001\u7ebf\u7a0b\u521b\u5efa\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u6c38\u8fdc\u4e0d\u8be5\u53d1\u751f\u2026\u2026\uff09\u3002</p>\n</li>\n</ul>\n</div>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u7ebf\u7a0b\u5728\u7ba1\u7406\u5176\u5ba2\u6237\u7aef\u65f6\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u5ba2\u6237\u7aef\u65e0\u6cd5\u5f00\u59cb\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u6216\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\u6240\u7528\u7684\u5957\u63a5\u5b57\u5df2\u7ecf\u5931\u6548\uff09\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8be5\u7ebf\u7a0b\u7684\u6240\u6709\u5ba2\u6237\u7aef\u90fd\u4f1a\u505c\u6b62\uff0c\u800c\u5176\u4ed6\u7ebf\u7a0b\u7ee7\u7eed\u5de5\u4f5c\uff1b\u4f46\u662f\uff0c\u5982\u679c\u6307\u5b9a\u4e86<code class=\"option\">--exit-on-abort</code>\uff0c\u5219\u6240\u6709\u7ebf\u7a0b\u90fd\u4f1a\u7acb\u5373\u505c\u6b62\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\u3002\u5728\u53d1\u751f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u4e0d\u5e94\u53d1\u751f\uff09\u6216\u6307\u5b9a\u4e86<code class=\"option\">--exit-on-abort</code>\u65f6\uff0c\u5b83\u4eec\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\u5e76\u663e\u793a\u76f8\u5e94\u9519\u8bef\u6d88\u606f\u3002\u5426\u5219\uff0c\u6700\u574f\u60c5\u51b5\u4e0b\u53ea\u4f1a\u4e2d\u6b62\u5931\u8d25\u7684\u5ba2\u6237\u7aef\uff0c\u800c\u5176\u4ed6\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\uff08\u4f46\u67d0\u4e9b\u5ba2\u6237\u7aef\u9519\u8bef\u4f1a\u5728\u4e0d\u4e2d\u6b62\u5ba2\u6237\u7aef\u7684\u60c5\u51b5\u4e0b\u5904\u7406\u5e76\u5355\u72ec\u62a5\u544a\uff0c\u89c1\u4e0b\u6587\uff09\u3002\u672c\u8282\u540e\u7eed\u9ed8\u8ba4\u8ba8\u8bba\u7684\u90fd\u662f\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\uff0c\u800c\u4e0d\u662f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5ba2\u6237\u7aef\u5728\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u65f6\u4f1a\u4e2d\u6b62\u8fd0\u884c\uff1b\u4f8b\u5982\uff0c\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e22\u5931\uff0c\u6216\u8005\u811a\u672c\u5728\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5c1a\u672a\u5b8c\u6210\u65f6\u5c31\u7ed3\u675f\u4e86\u3002\u53e6\u5916\uff0c\u5982\u679c SQL \u6216\u5143\u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u4e14\u539f\u56e0\u4e0d\u662f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\uff0c\u5ba2\u6237\u7aef\u4e5f\u4f1a\u4e2d\u6b62\u3002\u5426\u5219\uff0c\u5982\u679c SQL \u547d\u4ee4\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5f53\u524d\u4e8b\u52a1\u4f1a\u56de\u6eda\uff0c\u4e5f\u5305\u62ec\u5c06\u5ba2\u6237\u7aef\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u6b64\u4e8b\u52a1\u8fd0\u884c\u4e4b\u524d\u7684\u72b6\u6001\uff08\u5047\u8bbe\u4e00\u4e2a\u4e8b\u52a1\u811a\u672c\u53ea\u5305\u542b\u4e00\u4e2a\u4e8b\u52a1\uff1b\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#TRANSACTIONS-AND-SCRIPTS\" title=\"\u5728pgbench\u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f\">\u5728 pgbench \u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f</a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff09\u3002\u53d1\u751f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4f1a\u5728\u56de\u6eda\u540e\u91cd\u65b0\u6267\u884c\uff0c\u76f4\u5230\u6210\u529f\u5b8c\u6210\uff0c\u6216\u8005\u8fbe\u5230\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u7531<code class=\"option\">--max-tries</code>\u6307\u5b9a\uff09\u3001\u8fbe\u5230\u6700\u5927\u91cd\u8bd5\u65f6\u95f4\uff08\u7531<code class=\"option\">--latency-limit</code>\u6307\u5b9a\uff09\uff0c\u6216\u8005\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\uff08\u7531<code class=\"option\">--time</code>\u6307\u5b9a\uff09\u3002\u5982\u679c\u6700\u540e\u4e00\u6b21\u5c1d\u8bd5\u4ecd\u7136\u5931\u8d25\uff0c\u8be5\u4e8b\u52a1\u4f1a\u88ab\u62a5\u544a\u4e3a\u5931\u8d25\uff0c\u4f46\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\uff0c\u800c\u662f\u7ee7\u7eed\u5de5\u4f5c\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a --max-tries \u9009\u9879\uff0c\u4e8b\u52a1\u5728\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u4e0d\u4f1a\u91cd\u8bd5\uff0c\u56e0\u4e3a\u5176\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u53ef\u4ee5\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u5e76\u914d\u5408 --latency-limit\uff0c\u4ec5\u9650\u5236\u5c1d\u8bd5\u7684\u6700\u957f\u603b\u8017\u65f6\u3002\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\u65f6\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 --time \u9650\u5236\u57fa\u51c6\u6d4b\u8bd5\u65f6\u957f\u3002</p>\n<p lang=\"zh\">\u5728\u91cd\u590d\u5305\u542b\u591a\u4e2a\u4e8b\u52a1\u7684\u811a\u672c\u65f6\u8981\u5c0f\u5fc3\uff1a\u811a\u672c\u603b\u662f\u5b8c\u5168\u91cd\u8bd5\uff0c\u56e0\u6b64\u6210\u529f\u7684\u4e8b\u52a1\u53ef\u80fd\u4f1a\u6267\u884c\u591a\u6b21\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 shell \u547d\u4ee4\u91cd\u8bd5\u4e8b\u52a1\u65f6\u8981\u5c0f\u5fc3\u3002\u4e0e SQL \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u540c\uff0cshell \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u4f1a\u56de\u6eda\uff0c\u552f\u4e00\u7684\u4f8b\u5916\u662f<code class=\"command\">\\setshell</code>\u547d\u4ee4\u8bbe\u7f6e\u7684\u53d8\u91cf\u503c\u3002</p>\n</div>\n<p lang=\"zh\">\u6210\u529f\u4e8b\u52a1\u7684\u5ef6\u8fdf\u5305\u62ec\u4e8b\u52a1\u6267\u884c\u7684\u6574\u4e2a\u65f6\u95f4\uff0c\u5305\u62ec\u56de\u6eda\u548c\u91cd\u8bd5\u3002\u5ef6\u8fdf\u4ec5\u9488\u5bf9\u6210\u529f\u7684\u4e8b\u52a1\u548c\u547d\u4ee4\u8fdb\u884c\u6d4b\u91cf\uff0c\u800c\u4e0d\u9488\u5bf9\u5931\u8d25\u7684\u4e8b\u52a1\u6216\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u4e3b\u62a5\u544a\u5305\u542b\u5931\u8d25\u4e8b\u52a1\u7684\u6570\u91cf\u3002\u5982\u679c --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1\uff0c\u4e3b\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u91cd\u8bd5\u76f8\u5173\u7edf\u8ba1\uff1a\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u603b\u6570\u548c\u91cd\u8bd5\u603b\u6b21\u6570\u3002\u6bcf\u811a\u672c\u62a5\u544a\u7ee7\u627f\u4e3b\u62a5\u544a\u7684\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u6bcf\u8bed\u53e5\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5e0c\u671b\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\u6309\u57fa\u672c\u7c7b\u578b\u5bf9\u5931\u8d25\u8fdb\u884c\u5206\u7ec4\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\u3002\u5982\u679c\u8fd8\u5e0c\u671b\u6309\u7c7b\u578b\u533a\u5206\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u4e86\u591a\u5c11\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--verbose-errors</code>\u9009\u9879\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.10\">\n<h3 lang=\"zh\">\u8868\u8bbf\u95ee\u65b9\u6cd5</h3>\n<p lang=\"zh\">\u53ef\u4ee5\u4e3a pgbench \u8868\u6307\u5b9a<a class=\"link\" href=\"/docs/18/tableam.html\" title=\"\u7b2c\u00a062\u00a0\u7ae0\u00a0\u8868\u8bbf\u95ee\u65b9\u6cd5\u63a5\u53e3\u5b9a\u4e49\">\u8868\u8bbf\u95ee\u65b9\u6cd5</a>\u3002\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGOPTIONS</code>\u7528\u4e8e\u6307\u5b9a\u901a\u8fc7\u547d\u4ee4\u884c\u4f20\u9012\u7ed9 PostgreSQL \u7684\u6570\u636e\u5e93\u914d\u7f6e\u9009\u9879\uff08\u89c1<a class=\"xref\" href=\"/docs/18/config-setting.html#CONFIG-SETTING-SHELL\" title=\"19.1.4.\u00a0\u901a\u8fc7 Shell \u5f71\u54cd\u53c2\u6570\">\u7b2c\u00a019.1.4\u00a0\u8282</a>\uff09\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u7528\u5982\u4e0b\u65b9\u5f0f\u4e3a pgbench \u521b\u5efa\u7684\u8868\u6307\u5b9a\u4e00\u4e2a\u540d\u4e3a<code class=\"literal\">wuzza</code>\u7684\u5047\u60f3\u9ed8\u8ba4\u8868\u8bbf\u95ee\u65b9\u6cd5\uff1a</p>\n<pre class=\"programlisting\">PGOPTIONS='-c default_table_access_method=wuzza'\n</pre>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.11\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.12\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/18/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.10.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/18/pgbench.html", "method": "same-major semantic node", "sha256": "60943db39d7d7f13b4348a7156e67a1d2cdf13ffa959d3bbec221e9302ccb7ca", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[4]/a[0]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[55]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[57]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/h2[0]", "#PGBENCH/div[7]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[7]/h2[0]", "#PGBENCH/div[7]/p[2]", "#PGBENCH/div[7]/p[3]", "#PGBENCH/div[8]/div[10]/h3[0]", "#PGBENCH/div[8]/div[10]/p[1]", "#PGBENCH/div[8]/div[10]/p[2]", "#PGBENCH/div[8]/div[10]/p[4]", "#PGBENCH/div[8]/div[10]/p[5]", "#PGBENCH/div[8]/div[11]/h3[0]", "#PGBENCH/div[8]/div[11]/p[1]", "#PGBENCH/div[8]/div[1]/h3[0]", "#PGBENCH/div[8]/div[1]/h3[0]/span[1]", "#PGBENCH/div[8]/div[1]/p[1]", "#PGBENCH/div[8]/div[1]/p[2]", "#PGBENCH/div[8]/div[1]/p[4]", "#PGBENCH/div[8]/div[1]/p[5]", "#PGBENCH/div[8]/div[2]/div[3]/h3[0]", "#PGBENCH/div[8]/div[2]/div[3]/p[1]", "#PGBENCH/div[8]/div[2]/div[3]/p[2]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[4]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[5]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[1]", "#PGBENCH/div[8]/div[2]/h3[0]", "#PGBENCH/div[8]/div[2]/p[1]", "#PGBENCH/div[8]/div[2]/p[2]", "#PGBENCH/div[8]/div[2]/p[4]", "#PGBENCH/div[8]/div[2]/p[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[3]/div[2]/p[0]", "#PGBENCH/div[8]/div[3]/h3[0]", "#PGBENCH/div[8]/div[3]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[18]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[4]/div[2]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[8]/div[4]/div[6]/p[1]", "#PGBENCH/div[8]/div[4]/div[6]/p[2]", "#PGBENCH/div[8]/div[4]/h3[0]", "#PGBENCH/div[8]/div[4]/p[10]", "#PGBENCH/div[8]/div[4]/p[12]", "#PGBENCH/div[8]/div[4]/p[14]", "#PGBENCH/div[8]/div[4]/p[15]", "#PGBENCH/div[8]/div[4]/p[17]", "#PGBENCH/div[8]/div[4]/p[1]", "#PGBENCH/div[8]/div[4]/p[4]", "#PGBENCH/div[8]/div[4]/p[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[5]/h3[0]", "#PGBENCH/div[8]/div[5]/p[12]", "#PGBENCH/div[8]/div[5]/p[14]", "#PGBENCH/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[5]/p[4]", "#PGBENCH/div[8]/div[5]/p[5]", "#PGBENCH/div[8]/div[5]/p[7]", "#PGBENCH/div[8]/div[5]/p[9]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[6]/h3[0]", "#PGBENCH/div[8]/div[6]/p[1]", "#PGBENCH/div[8]/div[6]/p[3]", "#PGBENCH/div[8]/div[6]/p[5]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[7]/h3[0]", "#PGBENCH/div[8]/div[7]/p[10]", "#PGBENCH/div[8]/div[7]/p[1]", "#PGBENCH/div[8]/div[7]/p[3]", "#PGBENCH/div[8]/div[7]/p[4]", "#PGBENCH/div[8]/div[7]/p[5]", "#PGBENCH/div[8]/div[7]/p[7]", "#PGBENCH/div[8]/div[7]/p[9]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[8]/div[4]/p[2]", "#PGBENCH/div[8]/div[8]/div[4]/p[3]", "#PGBENCH/div[8]/div[8]/p[1]", "#PGBENCH/div[8]/div[8]/p[3]", "#PGBENCH/div[8]/div[8]/p[5]", "#PGBENCH/div[8]/div[8]/p[7]", "#PGBENCH/div[8]/div[9]/h3[0]", "#PGBENCH/div[8]/div[9]/p[1]", "#PGBENCH/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/0/value": "pgbench", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Client applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/tables/1/title": "Environment variables", "/versions/18/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/18/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/18/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/18/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/18/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/18/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/18/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/18/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/18/tables/0/rows/8/summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "/versions/18/tables/0/rows/9/summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/18/tables/0/rows/11/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/18/tables/0/rows/12/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/18/tables/0/rows/13/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/18/tables/0/rows/14/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/18/tables/0/rows/15/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/18/tables/0/rows/16/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/18/tables/0/rows/17/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/18/tables/0/rows/18/summary": "Write information about each transaction to a log file. See below for details.", "/versions/18/tables/0/rows/19/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/18/tables/0/rows/20/summary": "Protocol to use for submitting queries to the server:", "/versions/18/tables/0/rows/21/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/18/tables/0/rows/22/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/18/tables/0/rows/23/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "/versions/18/tables/0/rows/24/summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "/versions/18/tables/0/rows/25/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/18/tables/0/rows/26/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/18/tables/0/rows/27/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/18/tables/0/rows/28/summary": "Number of transactions each client runs. Default is 10.", "/versions/18/tables/0/rows/29/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/18/tables/0/rows/30/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/18/tables/0/rows/31/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/18/tables/0/rows/32/summary": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case.", "/versions/18/tables/0/rows/33/summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "/versions/18/tables/0/rows/34/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/18/tables/0/rows/35/summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "/versions/18/tables/0/rows/36/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/18/tables/0/rows/37/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/18/tables/0/rows/38/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/18/tables/0/rows/39/summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "/versions/18/tables/0/rows/40/summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "/versions/18/tables/0/rows/41/summary": "Print debugging output.", "/versions/18/tables/0/rows/42/summary": "The database server's host name", "/versions/18/tables/0/rows/43/summary": "The database server's port number", "/versions/18/tables/0/rows/44/summary": "The user name to connect as", "/versions/18/tables/0/rows/45/summary": "Print the pgbench version and exit.", "/versions/18/tables/0/rows/46/summary": "Show help about pgbench command line arguments, and exit.", "/versions/18/tables/1/columns/0/label": "Variable", "/versions/18/tables/1/columns/1/label": "Meaning", "/versions/18/tables/1/rows/0/description": "Default connection parameters."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "d046021a2b2b5e07aeb05eab043ddf066e09285bd0e833f53652f9b65b21231c"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option to load data into ordinary (non-partition) tables with version 14 or later of PostgreSQL to speed up subsequent VACUUM . Using g causes logging to print one message every 100,000 rows while generating data for all tables. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "signature": "--partition-method= NAME", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "signature": "--partitions= NUM", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 54 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "signature": "-r --report-per-command", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--exit-on-abort"], "signature": "--exit-on-abort", "description": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case. Note that serialization failures or deadlock failures do not abort the client, so they are not affected by this option. See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--failures-detailed"], "signature": "--failures-detailed", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "signature": "--max-tries= number_of_tries", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= seed", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "signature": "--show-script= scriptname", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "signature": "--verbose-errors", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--debug"], "signature": "--debug", "description": "Print debugging output."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}]}, "comparison_hash": "3fee128ed72e2dadb503883963e144eb39fe4ec647ea20726a6508671823ee62", "manual_language": "zh"}, "19": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "19beta4"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "48"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-INITIALIZE", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "text": "--partition-method= NAME"}}, {"summary": "\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-PARTITIONS", "text": "--partitions= NUM"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-TABLESPACE", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-BUILTIN", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-CLIENT", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-CONNECT", "text": "-C --connect"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-DEFINE", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-FILE", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-JOBS", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-LOG", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-PROTOCOL", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528 --max-tries \u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-PROGRESS", "text": "-P sec --progress= sec"}}, {"summary": "\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "text": "-r --report-per-command"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-RATE", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-TIME", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "text": "--aggregate-interval= seconds"}}, {"summary": "\u5373\u4f7f SQL \u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u4ee5\u5916\u7684\u9519\u8bef\u5931\u8d25\uff0c\u4e5f\u5141\u8bb8\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5ba2\u6237\u7aef\u4f1a\u5728\u8fd9\u7c7b\u9519\u8bef\u540e\u4e2d\u6b62\uff1b\u542f\u7528\u6b64\u9009\u9879\u540e\uff0c\u5b83\u4eec\u4f1a\u8f6c\u5230\u4e0b\u4e00\u4e2a\u4e8b\u52a1\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u9519\u8bef\u5bfc\u81f4\u8fde\u63a5\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4ecd\u7136\u4f1a\u4e2d\u6b62\u3002\u66f4\u591a\u4fe1\u606f\u89c1 \u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5 \u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-CONTINUE-ON-ERROR", "text": "--continue-on-error"}}, {"summary": "\u5f53\u4efb\u4e00\u5ba2\u6237\u7aef\u56e0\u9519\u8bef\u88ab\u4e2d\u6b62\u65f6\uff0c\u7acb\u5373\u9000\u51fa\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u5373\u4f7f\u67d0\u4e2a\u5ba2\u6237\u7aef\u88ab\u4e2d\u6b62\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4ecd\u53ef\u6309 -t \u6216 -T \u7684\u8bbe\u5b9a\u7ee7\u7eed\u8fd0\u884c\uff0c\u6b64\u65f6 pgbench \u4f1a\u8f93\u51fa\u4e0d\u5b8c\u6574\u7684\u7ed3\u679c\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-EXIT-ON-ABORT", "text": "--exit-on-abort"}}, {"summary": "\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "text": "--failures-detailed"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "text": "--log-prefix= prefix"}}, {"summary": "\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "text": "--max-tries= number_of_tries"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 seed \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 seed \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "text": "--random-seed= seed"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "text": "--sampling-rate= rate"}}, {"summary": "\u5c06\u5185\u7f6e\u811a\u672c scriptname \u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "text": "--show-script= scriptname"}}, {"summary": "\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1 \u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5 \u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "text": "--verbose-errors"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-DEBUG", "text": "--debug"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-USERNAME", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/19/pgbench.html#PGBENCH-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-INITIALIZE", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option to load data into ordinary (non-partition) tables with version 14 or later of PostgreSQL to speed up subsequent VACUUM . Using g causes logging to print one message every 100,000 rows while generating data for all tables. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-QUIET", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "signature": "--partition-method= NAME", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "signature": "--partitions= NUM", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-PARTITIONS", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-TABLESPACE", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-BUILTIN", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-CLIENT", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-CONNECT", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-DEFINE", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-FILE", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-JOBS", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-LOG", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-PROTOCOL", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 54 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "signature": "-P sec --progress= sec", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-PROGRESS", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "signature": "-r --report-per-command", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-RATE", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-TIME", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--continue-on-error"], "summary": "Allows clients to continue running even if an SQL statement fails due to errors other than serialization or deadlock. By default, clients abort after such errors, but with this option enabled, they proceed to the next transaction instead. Note that clients still abort even with this option if an error causes the connection to fail. See Failures and Serialization/Deadlock Retries for more information.", "signature": "--continue-on-error", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-CONTINUE-ON-ERROR", "description": "Allows clients to continue running even if an SQL statement fails due to errors other than serialization or deadlock. By default, clients abort after such errors, but with this option enabled, they proceed to the next transaction instead. Note that clients still abort even with this option if an error causes the connection to fail. See Failures and Serialization/Deadlock Retries for more information. This option is useful when your custom script may raise errors such as unique constraint violations, but you want the benchmark to continue despite individual statement failures. Failed transactions are reported separately, but are not counted as transactions actually processed; time spent on failed transactions remains part of the benchmark duration, so such failures can lower the reported TPS."}, {"names": ["--exit-on-abort"], "summary": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case.", "signature": "--exit-on-abort", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-EXIT-ON-ABORT", "description": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case. Note that serialization failures or deadlock failures do not abort the client, so they are not affected by this option. See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--failures-detailed"], "summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "signature": "--failures-detailed", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; other failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "signature": "--max-tries= number_of_tries", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= seed", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "signature": "--show-script= scriptname", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "signature": "--verbose-errors", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--debug"], "summary": "Print debugging output.", "signature": "--debug", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-DEBUG", "description": "Print debugging output."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-HOST", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-PORT", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-USERNAME", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-VERSION", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/19/pgbench.html#PGBENCH-OPTION-HELP", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "label": "19beta4", "major": "19", "channel": "preview", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/19/postgresql-19-A4.pdf", "bytes": 16064841, "pages": 3052, "sha256": "4dd099e4125c591128fc5f3ebd02178dc24781f9e5ae629f96d67c4c8547427b", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/19/postgresql-19-US.pdf", "bytes": 15974616, "pages": 3225, "sha256": "61971fa857f0956d47341a0388fa6af9ae10acf691d4b2fc009007d384b0342b", "built_at": "2026-09-26"}}, "tree": "19", "index": "index.html", "major": "19", "pages": 1155, "release": "19beta4", "source_url": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "svg_assets": 5, "source_mode": "en SGML built with pinned official archive", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "revision": "1bbbbf4133d426f0e4304010688d2984c30fb67df0cc3a61b3e37eb3f6f37833", "evidence_kind": "English manual and source declarations", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "sources": [{"url": "https://pg.center/docs/19/pgbench.html", "file": "pgbench.html", "label": "19beta4 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "ba3f6c7e86ce94e467ad95f30b4baa005833b085647efba257a4804eb3fab882", "language": "en", "original_url": "/docs/19/pgbench.html"}, {"url": "https://pg.center/docs/19/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "c827f460db781b39da305303c88e73729a419cd2b2b9dedb126d8ad5cbf02c95", "language": "en", "original_url": "/docs/19/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u5178\u578b\u7684<span class=\"application\">pgbench</span>\u8f93\u51fa\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nlatency average = 11.013 ms\nlatency stddev = 7.351 ms\ninitial connection time = 45.758 ms\ntps = 896.967014 (without initial connection time)\n</pre>\n<p lang=\"zh\">\u524d\u4e03\u884c\u7ed9\u51fa\u4e86\u82e5\u5e72\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u7b2c\u516d\u884c\u62a5\u544a\u4e86\u51fa\u73b0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u65f6\u4e8b\u52a1\u5141\u8bb8\u7684\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u7b2c\u516b\u884c\u62a5\u544a\u5b9e\u9645\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u4e8b\u52a1\u6570\uff08\u540e\u8005\u4ec5\u4e3a\u5ba2\u6237\u7aef\u6570\u91cf\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u6216\u8005\u67d0\u4e9b SQL \u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u5426\u5219\u4e24\u8005\u5e94\u5f53\u76f8\u7b49\u3002\uff08\u5728<code class=\"option\">-T</code>\u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u4e8b\u52a1\u6570\u3002\uff09\u4e0b\u4e00\u884c\u62a5\u544a\u5931\u8d25\u7684\u4e8b\u52a1\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u6700\u540e\u4e00\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">[<span class=\"optional\">-d</span>] <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">[<span class=\"optional\">--dbname=</span>]<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u5219\u4f7f\u7528\u8fde\u63a5\u6307\u5b9a\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INITIALIZE\"><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS\"><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002<em class=\"replaceable\"><code>init_steps</code></em>\u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-D\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-T\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-G\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\u6216<code class=\"literal\">G</code>\uff08\u5728\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">g</code>\uff08\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c\u6570\u636e\u7531<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u751f\u6210\uff0c\u518d\u901a\u8fc7<code class=\"command\">COPY</code>\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4f1a\u5927\u91cf\u5360\u7528\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u5e26\u5bbd\u3002\u5bf9\u4e8e 14 \u53ca\u4ee5\u4e0a\u7248\u672c\u7684<span class=\"productname\">PostgreSQL</span>\uff0c<code class=\"command\">pgbench</code>\u4f1a\u5728\u666e\u901a\uff08\u975e\u5206\u533a\uff09\u8868\u4e0a\u4f7f\u7528<code class=\"option\">FREEZE</code>\u9009\u9879\u88c5\u8f7d\u6570\u636e\uff0c\u4ee5\u52a0\u5feb\u540e\u7eed\u7684<code class=\"command\">VACUUM</code>\u3002\u4f7f\u7528<code class=\"literal\">g</code>\u65f6\uff0c\u5728\u4e3a\u6240\u6709\u8868\u751f\u6210\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6bcf\u751f\u6210 100,000 \u884c\u4f1a\u8f93\u51fa\u4e00\u6761\u65e5\u5fd7\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">G</code>\uff08\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u53ea\u53d1\u9001\u8f83\u5c0f\u7684\u67e5\u8be2\uff0c\u968f\u540e\u5b9e\u9645\u6570\u636e\u5728\u670d\u52a1\u5668\u7aef\u751f\u6210\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u9700\u8981\u5927\u91cf\u5e26\u5bbd\uff0c\u4f46\u670d\u52a1\u5668\u4f1a\u627f\u62c5\u66f4\u591a\u5de5\u4f5c\u3002\u4f7f\u7528<code class=\"literal\">G</code>\u65f6\uff0c\u751f\u6210\u6570\u636e\u671f\u95f4\u4e0d\u4f1a\u6253\u5370\u4efb\u4f55\u8fdb\u5ea6\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u521d\u59cb\u5316\u884c\u4e3a\u4f7f\u7528\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff08\u7b49\u540c\u4e8e<code class=\"literal\">g</code>\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-V\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-P\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-F\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILLFACTOR\"><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-INIT\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n<p lang=\"zh\">\u5982\u679c -I \u4e2d\u6307\u5b9a\u4e86 G\uff0c\u6b64\u8bbe\u7f6e\u4e0d\u751f\u6548\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-INIT\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FOREIGN-KEYS\"><span class=\"term\"><code class=\"option\">--foreign-keys</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INDEX-TABLESPACE\"><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITION-METHOD\"><span class=\"term\"><code class=\"option\">--partition-method=<em class=\"replaceable\"><code>NAME</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITIONS\"><span class=\"term\"><code class=\"option\">--partitions=<em class=\"replaceable\"><code>NUM</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TABLESPACE\"><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-UNLOGGED-TABLES\"><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-BUILTIN\"><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CLIENT\"><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CONNECT\"><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-DEFINE\"><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-JOBS\"><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LATENCY-LIMIT\"><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--max-tries</code>\u9009\u9879\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u56e0\u4e32\u884c\u5316\u5f02\u5e38\u6216\u6b7b\u9501\u800c\u5931\u8d25\uff0c\u4e14\u5176\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\u5927\u4e8e<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u5219\u4e0d\u4f1a\u518d\u91cd\u8bd5\u3002\u82e5\u53ea\u60f3\u9650\u5236\u5c1d\u8bd5\u603b\u65f6\u95f4\u800c\u4e0d\u9650\u5236\u5c1d\u8bd5\u6b21\u6570\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">--max-tries=0</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"option\">--max-tries</code>\u4e3a 1\uff0c\u51fa\u73b0\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROTOCOL\"><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5728<code class=\"literal\">prepared</code>\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pgbench</span> \u4ece\u7b2c\u4e8c\u6b21\u67e5\u8be2\u8fed\u4ee3\u5f00\u59cb\u590d\u7528\u89e3\u6790\u5206\u6790\u7ed3\u679c\uff0c\u56e0\u6b64<span class=\"application\">pgbench</span> \u6bd4\u5176\u4ed6\u6a21\u5f0f\u8fd0\u884c\u5f97\u66f4\u5feb\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u503c\u662f\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/19/protocol.html\" title=\"\u7b2c\u00a054\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a054\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-RUN\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SKIP-SOME-UPDATES\"><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS\"><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528<code class=\"option\">--max-tries</code>\u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-REPORT-LATENCIES\"><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-per-command</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RATE\"><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-RUN\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SELECT-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TRANSACTIONS\"><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TIME\"><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VACUUM-ALL\"><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-AGGREGATE-INTERVAL\"><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CONTINUE-ON-ERROR\"><span class=\"term\"><code class=\"option\">--continue-on-error</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5373\u4f7f SQL \u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u4ee5\u5916\u7684\u9519\u8bef\u5931\u8d25\uff0c\u4e5f\u5141\u8bb8\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5ba2\u6237\u7aef\u4f1a\u5728\u8fd9\u7c7b\u9519\u8bef\u540e\u4e2d\u6b62\uff1b\u542f\u7528\u6b64\u9009\u9879\u540e\uff0c\u5b83\u4eec\u4f1a\u8f6c\u5230\u4e0b\u4e00\u4e2a\u4e8b\u52a1\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u9519\u8bef\u5bfc\u81f4\u8fde\u63a5\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4ecd\u7136\u4f1a\u4e2d\u6b62\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n<p lang=\"zh\">\u5f53\u81ea\u5b9a\u4e49\u811a\u672c\u53ef\u80fd\u5f15\u53d1\u552f\u4e00\u7ea6\u675f\u8fdd\u80cc\u7b49\u9519\u8bef\uff0c\u4f46\u5e0c\u671b\u57fa\u51c6\u6d4b\u8bd5\u5728\u4e2a\u522b\u8bed\u53e5\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u8fd0\u884c\u65f6\uff0c\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u5931\u8d25\u7684\u4e8b\u52a1\u4f1a\u5355\u72ec\u62a5\u544a\uff0c\u4e0d\u8ba1\u5165\u5b9e\u9645\u5904\u7406\u7684\u4e8b\u52a1\u6570\uff1b\u4f46\u5931\u8d25\u4e8b\u52a1\u6240\u82b1\u8d39\u7684\u65f6\u95f4\u4ecd\u8ba1\u5165\u57fa\u51c6\u6d4b\u8bd5\u65f6\u957f\uff0c\u56e0\u6b64\u8fd9\u4e9b\u5931\u8d25\u53ef\u80fd\u964d\u4f4e\u62a5\u544a\u7684 TPS\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-EXIT-ON-ABORT\"><span class=\"term\"><code class=\"option\">--exit-on-abort</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53\u4efb\u4e00\u5ba2\u6237\u7aef\u56e0\u9519\u8bef\u88ab\u4e2d\u6b62\u65f6\uff0c\u7acb\u5373\u9000\u51fa\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u5373\u4f7f\u67d0\u4e2a\u5ba2\u6237\u7aef\u88ab\u4e2d\u6b62\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4ecd\u53ef\u6309<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u7684\u8bbe\u5b9a\u7ee7\u7eed\u8fd0\u884c\uff0c\u6b64\u65f6<span class=\"application\">pgbench</span>\u4f1a\u8f93\u51fa\u4e0d\u5b8c\u6574\u7684\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4e32\u884c\u5316\u5931\u8d25\u6216\u6b7b\u9501\u5931\u8d25\u4e0d\u4f1a\u4e2d\u6b62\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u4e0d\u53d7\u8be5\u9009\u9879\u5f71\u54cd\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FAILURES-DETAILED\"><span class=\"term\"><code class=\"option\">--failures-detailed</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e32\u884c\u5316\u5931\u8d25\uff1b</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u6b7b\u9501\u5931\u8d25\uff1b</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5176\u4ed6\u5931\u8d25\uff1b</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG-PREFIX\"><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-MAX-TRIES\"><span class=\"term\"><code class=\"option\">--max-tries=<em class=\"replaceable\"><code>number_of_tries</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS-TIMESTAMP\"><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RANDOM-SEED\"><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>seed</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>seed</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>seed</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SAMPLING-RATE\"><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SHOW-SCRIPT\"><span class=\"term\"><code class=\"option\">--show-script=</code><em class=\"replaceable\"><code>scriptname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5185\u7f6e\u811a\u672c<em class=\"replaceable\"><code>scriptname</code></em>\u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERBOSE-ERRORS\"><span class=\"term\"><code class=\"option\">--verbose-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u8fd8\u63a5\u53d7\u4ee5\u4e0b\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u53ca\u5176\u4ed6\u901a\u7528\u8bbe\u7f6e\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HOST\"><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u6210\u529f\u8fd0\u884c\u65f6\u9000\u51fa\u72b6\u6001\u4e3a 0\u3002\u9000\u51fa\u72b6\u6001 1 \u8868\u793a\u9759\u6001\u95ee\u9898\uff0c\u4f8b\u5982\u65e0\u6548\u7684\u547d\u4ee4\u884c\u9009\u9879\uff0c\u6216\u8005\u672c\u4e0d\u5e94\u53d1\u751f\u7684\u5185\u90e8\u9519\u8bef\u3002\u57fa\u51c6\u6d4b\u8bd5\u542f\u52a8\u9636\u6bb5\u7684\u65e9\u671f\u9519\u8bef\uff0c\u4f8b\u5982\u521d\u59cb\u8fde\u63a5\u5931\u8d25\uff0c\u4e5f\u4f1a\u4ee5\u72b6\u6001 1 \u9000\u51fa\u3002\u8fd0\u884c\u671f\u95f4\u7684\u9519\u8bef\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u9519\u8bef\u6216\u811a\u672c\u95ee\u9898\uff0c\u4f1a\u5bfc\u81f4\u9000\u51fa\u72b6\u6001\u4e3a 2\u3002\u5728\u540e\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u6ca1\u6709\u6307\u5b9a --exit-on-abort \u9009\u9879\uff0cpgbench \u4f1a\u6253\u5370\u90e8\u5206\u7ed3\u679c\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.8\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/19/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.9\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"TRANSACTIONS-AND-SCRIPTS\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n<p lang=\"zh\">\u5047\u5b9a<span class=\"application\">pgbench</span>\u811a\u672c\u4e0d\u5305\u542b\u4e0d\u5b8c\u6574\u7684 SQL \u4e8b\u52a1\u5757\u3002\u5982\u679c\u5728\u8fd0\u884c\u65f6\u5ba2\u6237\u7aef\u5728\u5c1a\u672a\u5b8c\u6210\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5757\u65f6\u5c31\u5230\u8fbe\u811a\u672c\u672b\u5c3e\uff0c\u8be5\u5ba2\u6237\u7aef\u5c06\u88ab\u4e2d\u6b62\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u673a\u5236\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5e76\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u5982\u4e0a\u6240\u8ff0\uff0c\u53d8\u91cf\u53ef\u4ee5\u7528\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e0b\u6587\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u901a\u8fc7<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u5148\u8bbe\u7f6e\u7684\u53d8\u91cf\u4e4b\u5916\uff0c\u8fd8\u6709\u5c11\u91cf\u53d8\u91cf\u4f1a\u88ab\u81ea\u52a8\u9884\u8bbe\uff0c\u5217\u5728<a class=\"xref\" href=\"/docs/19/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0308.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0308</a>\u4e2d\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u503c\uff0c\u5219\u4f1a\u8986\u76d6\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u4e00\u65e6\u8bbe\u7f6e\u597d\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u5728 SQL \u547d\u4ee4\u4e2d\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u6765\u63d2\u5165\u5176\u503c\u3002\u5f53\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u53d8\u91cf\u96c6\u5408\u3002<span class=\"application\">pgbench</span>\u5728\u5355\u6761\u8bed\u53e5\u4e2d\u6700\u591a\u652f\u6301 255 \u6b21\u53d8\u91cf\u4f7f\u7528\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0308.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u548c\u4f2a\u968f\u673a\u7f6e\u6362\u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [<em class=\"replaceable\"><code>prefix</code></em>]</code><br/></span><span class=\"term\"><code class=\"literal\">\\aset [<em class=\"replaceable\"><code>prefix</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e9b\u547d\u4ee4\u53ef\u7528\u4e8e\u7ed3\u675f SQL \u67e5\u8be2\uff0c\u4ee5\u4ee3\u66ff\u7ed3\u5c3e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\gset</code>\u547d\u4ee4\u65f6\uff0c\u524d\u9762\u7684 SQL \u67e5\u8be2\u9884\u671f\u8fd4\u56de\u4e00\u884c\uff0c\u5176\u5404\u5217\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u96f6\u884c\u6216\u591a\u884c\uff0c\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\aset</code>\u547d\u4ee4\u65f6\uff0c\u6240\u6709\u7ec4\u5408 SQL \u67e5\u8be2\uff08\u7531<code class=\"literal\">\\;</code>\u5206\u9694\uff09\u7684\u5217\u90fd\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\u4e2d\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u4e0d\u8fd4\u56de\u4efb\u4f55\u884c\uff0c\u5219\u4e0d\u4f1a\u8fdb\u884c\u8d4b\u503c\u3002\u53ef\u4ee5\u5148\u628a\u53d8\u91cf\u521d\u59cb\u5316\u4e3a\u4e00\u4e2a\u67e5\u8be2\u4e0d\u53ef\u80fd\u8fd4\u56de\u7684\u503c\uff0c\u518d\u68c0\u67e5\u5b83\u662f\u5426\u53d1\u751f\u53d8\u5316\uff0c\u4ee5\u68c0\u6d4b\u8fd9\u79cd\u60c5\u51b5\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u591a\u884c\uff0c\u5219\u4fdd\u7559\u6700\u540e\u4e00\u4e2a\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\gset</code> \u548c <code class=\"literal\">\\aset</code> \u4e0d\u80fd\u7528\u5728\u7ba1\u9053\u6a21\u5f0f\uff0c\u56e0\u4e3a\u5728\u547d\u4ee4\u9700\u8981\u5b83\u4eec\u7684\u65f6\u5019\uff0c\u67e5\u8be2\u7ed3\u679c\u8fd8\u4e0d\u53ef\u7528\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u7684\u793a\u4f8b\u5c06\u7b2c\u4e00\u4e2a\u67e5\u8be2\u4e2d\u7684\u6700\u7ec8\u8d26\u6237\u4f59\u989d\u653e\u5165\u53d8\u91cf<em class=\"replaceable\"><code>abalance</code></em>\uff0c\u5e76\u7528\u7b2c\u4e09\u4e2a\u67e5\u8be2\u4e2d\u7684\u6574\u6570\u586b\u5145\u53d8\u91cf<em class=\"replaceable\"><code>p_two</code></em>\u548c<em class=\"replaceable\"><code>p_three</code></em>\u3002\u7b2c\u4e8c\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002\u6700\u540e\u4e24\u4e2a\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u5b58\u5165\u53d8\u91cf<em class=\"replaceable\"><code>four</code></em>\u548c<em class=\"replaceable\"><code>five</code></em>\u3002</p>\n<pre class=\"programlisting\">UPDATE pgbench_accounts\n  SET abalance = abalance + :delta\n  WHERE aid = :aid\n  RETURNING abalance \\gset\n-- compound of two queries\nSELECT 1 \\;\nSELECT 2 AS two, 3 AS three \\gset p_\nSELECT 4 AS four \\; SELECT 5 AS five \\aset\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-IF-ELSE\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/19/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/19/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/19/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.19.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u8fc7\u5927\u6216\u8fc7\u5c0f\u7684\u6574\u6570\u548c\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff0c\u4ee5\u53ca\u6574\u6570\u7b97\u672f\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u548c<code class=\"literal\">/</code>\uff09\u90fd\u4f1a\u5728\u6ea2\u51fa\u65f6\u5f15\u53d1\u9519\u8bef\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SLEEP\"><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SETSHELL\"><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SHELL\"><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\syncpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u7ec4\u547d\u4ee4\u7528\u4e8e\u5b9e\u73b0 SQL \u8bed\u53e5\u7684\u7ba1\u9053\u6267\u884c\u3002\u7ba1\u9053\u5fc5\u987b\u4ee5<code class=\"command\">\\startpipeline</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endpipeline</code>\u7ed3\u675f\uff1b\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u51fa\u73b0\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\syncpipeline</code>\uff0c\u5b83\u4f1a\u53d1\u9001\u4e00\u4e2a<a class=\"link\" href=\"/docs/19/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3.\u00a0\u6269\u5c55\u67e5\u8be2\">sync \u6d88\u606f</a>\uff0c\u65e2\u4e0d\u4f1a\u7ed3\u675f\u5f53\u524d\u7ba1\u9053\uff0c\u4e5f\u4e0d\u4f1a\u5237\u65b0\u53d1\u9001\u7f13\u51b2\u533a\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u4e00\u6761\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/19/libpq-pipeline-mode.html\" title=\"32.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a032.5\u00a0\u8282</a>\u3002\u7ba1\u9053\u6a21\u5f0f\u8981\u6c42\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/19/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0309.\u00a0pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0309</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/19/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002\u8fd9\u4e9b\u64cd\u4f5c\u7b26\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u5217\u51fa\u3002\u9664\u975e\u53e6\u6709\u8bf4\u660e\uff0c\u63a5\u53d7\u4e24\u4e2a\u6570\u5b57\u8f93\u5165\u7684\u64cd\u4f5c\u7b26\u53ea\u8981\u4efb\u4e00\u8f93\u5165\u4e3a\u53cc\u7cbe\u5ea6\uff0c\u5c31\u4f1a\u4ea7\u751f\u53cc\u7cbe\u5ea6\u7ed3\u679c\uff1b\u5426\u5219\u4ea7\u751f\u6574\u6570\u7ed3\u679c\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0309.\u00a0pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u64cd\u4f5c\u7b26</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">OR</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u6216</p>\n<p><code class=\"literal\">5 or 0</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">AND</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u4e0e</p>\n<p><code class=\"literal\">3 and 0</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">NOT</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u975e</p>\n<p><code class=\"literal\">not false</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5e03\u5c14\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 is null</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>value</code></em> <code class=\"literal\">ISNULL|NOTNULL</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7a7a\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 notnull</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 = 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;&gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">!=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 != 5</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e</p>\n<p><code class=\"literal\">5 &lt; 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;= 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e</p>\n<p><code class=\"literal\">5 &gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &gt;= 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">|</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u6216</p>\n<p><code class=\"literal\">1 | 2</code> \u2192 <code class=\"returnvalue\">3</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">#</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5f02\u6216</p>\n<p><code class=\"literal\">1 # 3</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&amp;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u4e0e</p>\n<p><code class=\"literal\">1 &amp; 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">~</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u975e</p>\n<p><code class=\"literal\">~ 1</code> \u2192 <code class=\"returnvalue\">-2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&lt;&lt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5de6\u79fb</p>\n<p><code class=\"literal\">1 &lt;&lt; 2</code> \u2192 <code class=\"returnvalue\">4</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&gt;&gt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u53f3\u79fb</p>\n<p><code class=\"literal\">8 &gt;&gt; 2</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">+</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u52a0\u6cd5</p>\n<p><code class=\"literal\">5 + 4</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u51cf\u6cd5</p>\n<p><code class=\"literal\">3 - 2.0</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">*</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u4e58\u6cd5</p>\n<p><code class=\"literal\">5 * 4</code> \u2192 <code class=\"returnvalue\">20</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">/</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u9664\u6cd5\uff08\u5982\u679c\u4e24\u4e2a\u8f93\u5165\u90fd\u662f\u6574\u6570\uff0c\u5219\u5c06\u7ed3\u679c\u5411\u96f6\u622a\u65ad\uff09</p>\n<p><code class=\"literal\">5 / 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">%</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">3 % 2</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u53d6\u76f8\u53cd\u6570</p>\n<p><code class=\"literal\">- 2.0</code> \u2192 <code class=\"returnvalue\">-2.0</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/19/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0310.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0310</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/19/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0310.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u51fd\u6570</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">abs</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u7edd\u5bf9\u503c</p>\n<p><code class=\"literal\">abs(-17)</code> \u2192 <code class=\"returnvalue\">17</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">debug</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u5c06\u53c2\u6570\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de\u53c2\u6570\u3002</p>\n<p><code class=\"literal\">debug(5432.1)</code> \u2192 <code class=\"returnvalue\">5432.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">double</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u8f6c\u6362\u4e3a double\u3002</p>\n<p><code class=\"literal\">double(5432)</code> \u2192 <code class=\"returnvalue\">5432.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">exp</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u6307\u6570\u51fd\u6570\uff08<code class=\"literal\">e</code> \u7684\u7ed9\u5b9a\u6b21\u5e42\uff09</p>\n<p><code class=\"literal\">exp(1.0)</code> \u2192 <code class=\"returnvalue\">2.718281828459045</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">greatest</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c\u3002</p>\n<p><code class=\"literal\">greatest(5, 4, 3, 2)</code> \u2192 <code class=\"returnvalue\">5</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8fd9\u662f <code class=\"function\">hash_murmur2</code> \u7684\u522b\u540d\u3002</p>\n<p><code class=\"literal\">hash(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_fnv1a</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\" target=\"_top\">FNV-1a hash</a>\u3002</p>\n<p><code class=\"literal\">hash_fnv1a(10, 5432)</code> \u2192 <code class=\"returnvalue\">-7793829335365542153</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_murmur2</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/MurmurHash\" target=\"_top\">MurmurHash2 hash</a>\u3002</p>\n<p><code class=\"literal\">hash_murmur2(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">int</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8f6c\u6362\u4e3a integer\u3002</p>\n<p><code class=\"literal\">int(5.4 + 3.8)</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">least</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c\u3002</p>\n<p><code class=\"literal\">least(5, 4, 3, 2.1)</code> \u2192 <code class=\"returnvalue\">2.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">ln</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u81ea\u7136\u5bf9\u6570</p>\n<p><code class=\"literal\">ln(2.718281828459045)</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">mod</code> ( <em class=\"replaceable\"><code>integer</code></em>, <em class=\"replaceable\"><code>integer</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">mod(54, 32)</code> \u2192 <code class=\"returnvalue\">22</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">permute</code> ( <em class=\"parameter\"><code>i</code></em>, <em class=\"parameter\"><code>size</code></em> [, <em class=\"parameter\"><code>seed</code></em> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\"><em class=\"parameter\"><code>i</code></em>\u7684\u7f6e\u6362\u503c\uff0c\u8303\u56f4\u5728<code class=\"literal\">[0, size)</code>\u5185\u3002\u5b83\u8868\u793a<em class=\"parameter\"><code>i</code></em>\uff08\u6a21<em class=\"parameter\"><code>size</code></em>\uff09\u5728\u6574\u6570<code class=\"literal\">0...size-1</code>\u7684\u4f2a\u968f\u673a\u7f6e\u6362\u4e2d\u7684\u65b0\u4f4d\u7f6e\uff1b\u8be5\u7f6e\u6362\u7531<em class=\"parameter\"><code>seed</code></em>\u53c2\u6570\u5316\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">permute(0, 4)</code> \u2192 <code class=\"returnvalue\">an integer between 0 and 3</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pi</code> () \u2192 <code class=\"returnvalue\">double</code></p>\n<p><span class=\"symbol_font\">\u03c0</span>\u7684\u8fd1\u4f3c\u503c</p>\n<p><code class=\"literal\">pi()</code> \u2192 <code class=\"returnvalue\">3.14159265358979323846</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pow</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p class=\"func_signature\"><code class=\"function\">power</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p><em class=\"parameter\"><code>x</code></em> \u7684 <em class=\"parameter\"><code>y</code></em> \u6b21\u5e42</p>\n<p><code class=\"literal\">pow(2.0, 10)</code> \u2192 <code class=\"returnvalue\">1024.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u5747\u5300\u5206\u5e03\u968f\u673a\u6574\u6570\u3002</p>\n<p><code class=\"literal\">random(1, 10)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_exponential</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u6307\u6570\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_exponential(1, 10, 3.0)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_gaussian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u9ad8\u65af\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_gaussian(1, 10, 2.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_zipfian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684 Zipfian \u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_zipfian(1, 10, 1.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">sqrt</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u5e73\u65b9\u6839</p>\n<p><code class=\"literal\">sqrt(2.0)</code> \u2192 <code class=\"returnvalue\">1.414213562</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002parameter \u5141\u8bb8\u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n<p lang=\"zh\">pgbench \u7684\u5b9e\u73b0\u57fa\u4e8e Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002\u7531\u4e8e\u8be5\u7b97\u6cd5\u7684\u9650\u5236\uff0cparameter \u7684\u53d6\u503c\u9650\u5236\u5728 [1.001, 1000] \u8303\u56f4\u5185\u3002</p>\n</li>\n</ul>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u8bbe\u8ba1\u4ee5\u975e\u5747\u5300\u65b9\u5f0f\u9009\u62e9\u884c\u7684\u57fa\u51c6\u6d4b\u8bd5\u65f6\uff0c\u8981\u6ce8\u610f\u88ab\u9009\u4e2d\u7684\u884c\u53ef\u80fd\u4e0e\u5176\u4ed6\u6570\u636e\u76f8\u5173\uff0c\u4f8b\u5982\u4e0e\u5e8f\u5217\u751f\u6210\u7684 ID \u6216\u7269\u7406\u884c\u987a\u5e8f\u76f8\u5173\uff0c\u8fd9\u53ef\u80fd\u4f1a\u626d\u66f2\u6027\u80fd\u6d4b\u91cf\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u4e3a\u907f\u514d\u8fd9\u4e00\u70b9\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"function\">permute</code>\u51fd\u6570\uff0c\u6216\u91c7\u7528\u5176\u4ed6\u5177\u6709\u7c7b\u4f3c\u6548\u679c\u7684\u989d\u5916\u6b65\u9aa4\uff0c\u5bf9\u9009\u4e2d\u7684\u884c\u8fdb\u884c\u6253\u4e71\u5e76\u79fb\u9664\u6b64\u7c7b\u76f8\u5173\u6027\u3002</p>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570<code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code>\u548c<code class=\"literal\">hash_fnv1a</code>\u90fd\u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f1a\u4f7f\u7528<code class=\"literal\">:default_seed</code>\u7684\u503c\uff1b\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c<code class=\"literal\">-D</code>\u9009\u9879\u8986\u76d6\uff0c\u5426\u5219\u8be5\u503c\u4f1a\u88ab\u968f\u673a\u521d\u59cb\u5316\u3002</p>\n<p lang=\"zh\">permute \u63a5\u53d7\u8f93\u5165\u503c\u3001\u5927\u5c0f\u548c\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5b83\u5728 [0, size) \u8303\u56f4\u5185\u751f\u6210\u6574\u6570\u7684\u4f2a\u968f\u673a\u6392\u5217\uff0c\u5e76\u8fd4\u56de\u8f93\u5165\u503c\u5728\u6392\u5217\u4e2d\u7684\u7d22\u5f15\u3002\u6240\u9009\u6392\u5217\u7531\u79cd\u5b50\u51b3\u5b9a\uff0c\u672a\u6307\u5b9a\u79cd\u5b50\u65f6\u9ed8\u8ba4\u4f7f\u7528 :default_seed\u3002\u4e0e\u54c8\u5e0c\u51fd\u6570\u4e0d\u540c\uff0cpermute \u4fdd\u8bc1\u8f93\u51fa\u503c\u65e2\u65e0\u51b2\u7a81\u4e5f\u65e0\u7a7a\u7f3a\u3002\u533a\u95f4\u5916\u7684\u8f93\u5165\u503c\u4f1a\u5bf9 size \u53d6\u6a21\u3002\u5982\u679c size \u4e0d\u662f\u6b63\u6570\uff0c\u51fd\u6570\u4f1a\u62a5\u9519\u3002permute \u53ef\u7528\u4e8e\u6253\u6563 random_zipfian \u6216 random_exponential \u7b49\u975e\u5747\u5300\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f7f\u66f4\u9891\u7e41\u62bd\u53d6\u7684\u503c\u4e0d\u4f1a\u5b58\u5728\u7b80\u5355\u7684\u5173\u8054\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e0a\u53ef\u80fd\u51fa\u73b0\u7684\u4e00\u7c7b\u5178\u578b\u5b9e\u9645\u8d1f\u8f7d\uff1a\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u8fc7\u91cf\u8d1f\u8f7d\u3002</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, :size, 1.07)\n\\set k 1 + permute(:r, :size)\n</pre>\n<p lang=\"zh\">\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u82e5\u5e72\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u53ef\u9009\u79cd\u5b50\u53c2\u6570\u5c31\u5f88\u6709\u7528\uff1a</p>\n<pre class=\"programlisting\">\\set k1 1 + permute(:r, :size, :default_seed + 123)\n\\set k2 1 + permute(:r, :size, :default_seed + 321)\n</pre>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u7528<code class=\"function\">hash</code>\u8fd1\u4f3c\u5b9e\u73b0\u7c7b\u4f3c\u7684\u884c\u4e3a\uff1a</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, 100 * :size, 1.07)\n\\set k 1 + abs(hash(:r)) % :size\n</pre>\n<p lang=\"zh\">\u4f46\u662f\uff0c\u7531\u4e8e<code class=\"function\">hash</code>\u4f1a\u4ea7\u751f\u51b2\u7a81\uff0c\u6709\u4e9b\u503c\u5c06\u6c38\u8fdc\u4e0d\u53ef\u8fbe\uff0c\u800c\u53e6\u4e00\u4e9b\u503c\u5219\u4f1a\u6bd4\u539f\u59cb\u5206\u5e03\u6240\u9884\u671f\u7684\u66f4\u5e38\u51fa\u73b0\u3002</p>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u6587\u4ef6\u7684\u6bcf\u4e00\u884c\u63cf\u8ff0\u4e00\u4e2a\u4e8b\u52a1\u3002\u5b83\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>client_id</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8fd0\u884c\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>transaction_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edf\u8ba1\u8be5\u4f1a\u8bdd\u5df2\u6267\u884c\u7684\u4e8b\u52a1\u6570\u91cf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u8017\u65f6\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>script_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8be5\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5f53\u901a\u8fc7<code class=\"option\">-f</code>\u6216<code class=\"option\">-b</code>\u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_epoch</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_us</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\u7684\u5c0f\u6570\u79d2\u90e8\u5206\uff0c\u4ee5\u5fae\u79d2\u4e3a\u5355\u4f4d</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>schedule_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff0c\u5373\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff08\u4ec5\u5728\u6307\u5b9a<code class=\"option\">--rate</code>\u65f6\u51fa\u73b0\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4e8b\u52a1\u6267\u884c\u671f\u95f4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08\u4ec5\u5f53 --max-tries \u4e0d\u7b49\u4e8e\u4e00\u65f6\u51fa\u73b0\uff09</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5f53\u540c\u65f6\u4f7f\u7528<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\u65f6\uff0c\u8df3\u8fc7\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">skipped</code>\u3002\u5982\u679c\u4e8b\u52a1\u4ee5\u5931\u8d25\u7ed3\u675f\uff0c\u5176<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">failed</code>\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u4f1a\u6839\u636e\u5931\u8d25\u7c7b\u578b\u62a5\u544a\u4e3a<code class=\"literal\">serialization</code>\u3001<code class=\"literal\">deadlock</code>\u6216<code class=\"literal\">other</code>\uff08\u8be6\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5305\u542b\u5931\u8d25\u4e0e\u91cd\u8bd5\u7684\u65e5\u5fd7\u7247\u6bb5\uff0c\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u8bbe\u4e3a 10\uff08\u6ce8\u610f\u989d\u5916\u7684 retries \u5217\uff09\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 failed 0 1499414498 84905 9\n2 0 failed 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u7684\u7c7b\u578b\u5c06\u5728<em class=\"replaceable\"><code>time</code></em>\u4e2d\u62a5\u544a\uff0c\u5982\u4e0b\u6240\u793a\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 serialization 0 1499414498 84905 9\n2 0 serialization 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--aggregate-interval</code>\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u4f1a\u91c7\u7528\u4e0d\u540c\u7684\u683c\u5f0f\u3002\u6bcf\u4e00\u884c\u65e5\u5fd7\u63cf\u8ff0\u4e00\u4e2a\u805a\u5408\u65f6\u95f4\u95f4\u9694\uff0c\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>interval_start</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u7684\u8d77\u59cb\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>num_transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u5185\u7684\u4e8b\u52a1\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u603b\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>skipped</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56e0\u4e3a\u542f\u52a8\u65f6\u95f4\u4f1a\u592a\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retried</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>serialization_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u4e32\u884c\u5316\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>deadlock_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u6b7b\u9501\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>other_sql_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f SQL \u9519\u8bef\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u540c\u65f6\u6307\u5b9a<code class=\"option\">--failures-detailed</code>\u548c<code class=\"option\">--continue-on-error</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4f7f\u7528\u8be5\u9009\u9879\u751f\u6210\u7684\u793a\u4f8b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\"><strong class=\"userinput\"><code>pgbench --aggregate-interval=10 --time=20 --client=10 --log --rate=1000 --latency-limit=10 --failures-detailed --max-tries=10 test</code></strong>\n\n1650260552 5178 26171317 177284491527 1136 44462 2647617 7321113867 0 9866 64 7564 28340 4148 0 0\n1650260562 4808 25573984 220121792172 1171 62083 3037380 9666800914 0 9998 598 7392 26621 4527 0 0\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u62a5\u544a</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\uff0c<span class=\"application\">pgbench</span>\u4e3a\u6bcf\u4e2a\u8bed\u53e5\u6536\u96c6\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">latency</code> \u2014 \u6bcf\u6761\u8bed\u53e5\u7684\u8017\u65f6\u3002<span class=\"application\">pgbench</span>\u62a5\u544a\u8be5\u8bed\u53e5\u6240\u6709\u6210\u529f\u6267\u884c\u7684\u5e73\u5747\u503c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u7684\u5931\u8d25\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u53d1\u751f\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u62a5\u544a\u4ec5\u5728<code class=\"option\">--max-tries</code>\u9009\u9879\u4e0d\u7b49\u4e8e1\u65f6\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6240\u6709\u6570\u503c\u90fd\u662f\u9488\u5bf9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u8ba1\u7b97\u7684\uff0c\u5e76\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u5c06\u7c7b\u4f3c\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nnumber of transactions above the 50.0 ms latency limit: 1311/10000 (13.110 %)\nlatency average = 28.488 ms\nlatency stddev = 21.009 ms\ninitial connection time = 69.068 ms\ntps = 346.224794 (without initial connection time)\nstatement latencies in milliseconds and failures:\n   0.012  0  \\set aid random(1, 100000 * :scale)\n   0.002  0  \\set bid random(1, 1 * :scale)\n   0.002  0  \\set tid random(1, 10 * :scale)\n   0.002  0  \\set delta random(-5000, 5000)\n   0.319  0  BEGIN;\n   0.834  0  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n   0.641  0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  11.126  0  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  12.961  0  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n   0.634  0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n   1.957  0  END;\n</pre>\n<p lang=\"zh\">\u4f7f\u7528\u53ef\u4e32\u884c\u5316\u9ed8\u8ba4\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\u7684\u9ed8\u8ba4\u811a\u672c\u7684\u53e6\u4e00\u4e2a\u8f93\u51fa\u793a\u4f8b\uff08<code class=\"command\">PGOPTIONS='-c default_transaction_isolation=serializable' pgbench ...</code>\uff09\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 10\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 6317/10000\nnumber of failed transactions: 3683 (36.830%)\nnumber of transactions retried: 7667 (76.670%)\ntotal number of retries: 45339\nnumber of transactions above the 50.0 ms latency limit: 106/6317 (1.678 %)\nlatency average = 17.016 ms\nlatency stddev = 13.283 ms\ninitial connection time = 45.017 ms\ntps = 186.792667 (without initial connection time)\nstatement latencies in milliseconds, failures and retries:\n  0.006     0      0  \\set aid random(1, 100000 * :scale)\n  0.001     0      0  \\set bid random(1, 1 * :scale)\n  0.001     0      0  \\set tid random(1, 10 * :scale)\n  0.001     0      0  \\set delta random(-5000, 5000)\n  0.385     0      0  BEGIN;\n  0.773     0      1  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n  0.624     0      0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  1.098   320   3762  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  0.582  3363  41576  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n  0.465     0      0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n  1.933     0      0  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"FAILURES-AND-RETRIES\">\n<h3 lang=\"zh\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</h3>\n<p lang=\"zh\">\u5728\u6267\u884c<span class=\"application\">pgbench</span>\u65f6\uff0c\u6709\u4e09\u79cd\u4e3b\u8981\u7c7b\u578b\u7684\u9519\u8bef\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e3b\u7a0b\u5e8f\u9519\u8bef\u3002\u5b83\u4eec\u6700\u4e3a\u4e25\u91cd\uff0c\u603b\u662f\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\uff0c\u5e76\u663e\u793a\u76f8\u5e94\u7684\u9519\u8bef\u6d88\u606f\u3002\u5b83\u4eec\u5305\u62ec\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\" style=\"list-style-type: circle;\">\n<li class=\"listitem\">\n<p><span class=\"application\">pgbench</span>\u5f00\u59cb\u6267\u884c\u65f6\u7684\u9519\u8bef\uff08\u4f8b\u5982\u9009\u9879\u503c\u65e0\u6548\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u521d\u59cb\u5316\u6a21\u5f0f\u4e2d\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u7528\u4e8e\u521b\u5efa\u5185\u7f6e\u811a\u672c\u6240\u9700\u8868\u7684\u67e5\u8be2\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5728\u7ebf\u7a0b\u542f\u52a8\u4e4b\u524d\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\u65e0\u6cd5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3001\u5143\u547d\u4ee4\u4e2d\u6709\u8bed\u6cd5\u9519\u8bef\u3001\u7ebf\u7a0b\u521b\u5efa\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u6c38\u8fdc\u4e0d\u8be5\u53d1\u751f\u2026\u2026\uff09\u3002</p>\n</li>\n</ul>\n</div>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u7ebf\u7a0b\u5728\u7ba1\u7406\u5176\u5ba2\u6237\u7aef\u65f6\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u5ba2\u6237\u7aef\u65e0\u6cd5\u5f00\u59cb\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u6216\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\u6240\u7528\u7684\u5957\u63a5\u5b57\u5df2\u7ecf\u5931\u6548\uff09\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8be5\u7ebf\u7a0b\u7684\u6240\u6709\u5ba2\u6237\u7aef\u90fd\u4f1a\u505c\u6b62\uff0c\u800c\u5176\u4ed6\u7ebf\u7a0b\u7ee7\u7eed\u5de5\u4f5c\uff1b\u4f46\u662f\uff0c\u5982\u679c\u6307\u5b9a\u4e86<code class=\"option\">--exit-on-abort</code>\uff0c\u5219\u6240\u6709\u7ebf\u7a0b\u90fd\u4f1a\u7acb\u5373\u505c\u6b62\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\u3002\u5728\u53d1\u751f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u4e0d\u5e94\u53d1\u751f\uff09\u6216\u6307\u5b9a\u4e86<code class=\"option\">--exit-on-abort</code>\u65f6\uff0c\u5b83\u4eec\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\u5e76\u663e\u793a\u76f8\u5e94\u9519\u8bef\u6d88\u606f\u3002\u5426\u5219\uff0c\u6700\u574f\u60c5\u51b5\u4e0b\u53ea\u4f1a\u4e2d\u6b62\u5931\u8d25\u7684\u5ba2\u6237\u7aef\uff0c\u800c\u5176\u4ed6\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\uff08\u4f46\u67d0\u4e9b\u5ba2\u6237\u7aef\u9519\u8bef\u4f1a\u5728\u4e0d\u4e2d\u6b62\u5ba2\u6237\u7aef\u7684\u60c5\u51b5\u4e0b\u5904\u7406\u5e76\u5355\u72ec\u62a5\u544a\uff0c\u89c1\u4e0b\u6587\uff09\u3002\u672c\u8282\u540e\u7eed\u9ed8\u8ba4\u8ba8\u8bba\u7684\u90fd\u662f\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\uff0c\u800c\u4e0d\u662f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5ba2\u6237\u7aef\u5728\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u65f6\u4f1a\u4e2d\u6b62\u8fd0\u884c\uff1b\u4f8b\u5982\uff0c\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e22\u5931\uff0c\u6216\u8005\u811a\u672c\u5728\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5c1a\u672a\u5b8c\u6210\u65f6\u5c31\u7ed3\u675f\u4e86\u3002\u5ba2\u6237\u7aef\u4e5f\u4f1a\u5728\u5143\u547d\u4ee4\u5931\u8d25\u65f6\u4e2d\u6b62\uff1b\u5982\u679c SQL \u547d\u4ee4\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u4e4b\u5916\u7684\u9519\u8bef\u5931\u8d25\uff0c\u4e14\u672a\u6307\u5b9a <code class=\"option\">--continue-on-error</code>\uff0c\u5ba2\u6237\u7aef\u540c\u6837\u4f1a\u4e2d\u6b62\u3002\u542f\u7528 <code class=\"option\">--continue-on-error</code> \u65f6\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u56e0\u8fd9\u7c7b SQL \u9519\u8bef\u4e2d\u6b62\uff0c\u800c\u662f\u8f6c\u5230\u4e0b\u4e00\u4e2a\u4e8b\u52a1\u3002\u8fd9\u4e9b\u60c5\u51b5\u4f1a\u5728\u8f93\u51fa\u4e2d\u62a5\u544a\u4e3a <code class=\"literal\">other failures</code>\u3002\u4e0d\u8fc7\uff0c\u5982\u679c\u9519\u8bef\u53d1\u751f\u5728\u5143\u547d\u4ee4\u4e2d\uff0c\u5373\u4f7f\u6307\u5b9a\u4e86\u8be5\u9009\u9879\uff0c\u5ba2\u6237\u7aef\u4ecd\u7136\u4f1a\u4e2d\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c SQL \u547d\u4ee4\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\uff0c\u4e0d\u8bba\u662f\u5426\u4f7f\u7528 <code class=\"option\">--continue-on-error</code>\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5f53\u524d\u4e8b\u52a1\u4f1a\u56de\u6eda\uff0c\u4e5f\u5305\u62ec\u5c06\u5ba2\u6237\u7aef\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u6b64\u4e8b\u52a1\u8fd0\u884c\u4e4b\u524d\u7684\u72b6\u6001\uff08\u5047\u8bbe\u4e00\u4e2a\u4e8b\u52a1\u811a\u672c\u53ea\u5305\u542b\u4e00\u4e2a\u4e8b\u52a1\uff1b\u8be6\u89c1<a class=\"xref\" href=\"/docs/19/pgbench.html#TRANSACTIONS-AND-SCRIPTS\" title=\"\u5728pgbench\u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f\">\u5728 pgbench \u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f</a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff09\u3002\u53d1\u751f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4f1a\u5728\u56de\u6eda\u540e\u91cd\u65b0\u6267\u884c\uff0c\u76f4\u5230\u6210\u529f\u5b8c\u6210\uff0c\u6216\u8005\u8fbe\u5230\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u7531<code class=\"option\">--max-tries</code>\u6307\u5b9a\uff09\u3001\u8fbe\u5230\u6700\u5927\u91cd\u8bd5\u65f6\u95f4\uff08\u7531<code class=\"option\">--latency-limit</code>\u6307\u5b9a\uff09\uff0c\u6216\u8005\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\uff08\u7531<code class=\"option\">--time</code>\u6307\u5b9a\uff09\u3002\u5982\u679c\u6700\u540e\u4e00\u6b21\u5c1d\u8bd5\u4ecd\u7136\u5931\u8d25\uff0c\u8be5\u4e8b\u52a1\u4f1a\u88ab\u62a5\u544a\u4e3a\u5931\u8d25\uff0c\u4f46\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\uff0c\u800c\u662f\u7ee7\u7eed\u5de5\u4f5c\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a --max-tries \u9009\u9879\uff0c\u4e8b\u52a1\u5728\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u4e0d\u4f1a\u91cd\u8bd5\uff0c\u56e0\u4e3a\u5176\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u53ef\u4ee5\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u5e76\u914d\u5408 --latency-limit\uff0c\u4ec5\u9650\u5236\u5c1d\u8bd5\u7684\u6700\u957f\u603b\u8017\u65f6\u3002\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\u65f6\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 --time \u9650\u5236\u57fa\u51c6\u6d4b\u8bd5\u65f6\u957f\u3002</p>\n<p lang=\"zh\">\u5728\u91cd\u590d\u5305\u542b\u591a\u4e2a\u4e8b\u52a1\u7684\u811a\u672c\u65f6\u8981\u5c0f\u5fc3\uff1a\u811a\u672c\u603b\u662f\u5b8c\u5168\u91cd\u8bd5\uff0c\u56e0\u6b64\u6210\u529f\u7684\u4e8b\u52a1\u53ef\u80fd\u4f1a\u6267\u884c\u591a\u6b21\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 shell \u547d\u4ee4\u91cd\u8bd5\u4e8b\u52a1\u65f6\u8981\u5c0f\u5fc3\u3002\u4e0e SQL \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u540c\uff0cshell \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u4f1a\u56de\u6eda\uff0c\u552f\u4e00\u7684\u4f8b\u5916\u662f<code class=\"command\">\\setshell</code>\u547d\u4ee4\u8bbe\u7f6e\u7684\u53d8\u91cf\u503c\u3002</p>\n</div>\n<p lang=\"zh\">\u6210\u529f\u4e8b\u52a1\u7684\u5ef6\u8fdf\u5305\u62ec\u4e8b\u52a1\u6267\u884c\u7684\u5168\u90e8\u65f6\u95f4\uff0c\u5176\u4e2d\u5305\u542b\u56de\u6eda\u548c\u91cd\u8bd5\u3002\u5728\u4e3b\u62a5\u544a\u4e2d\uff0c\u5982\u679c\u672a\u6307\u5b9a <code class=\"option\">--progress</code>\u3001<code class=\"option\">--rate</code> \u548c <code class=\"option\">--latency-limit</code>\uff0c\u5219 <code class=\"literal\">latency average</code> \u7531\u57fa\u51c6\u6d4b\u8bd5\u603b\u65f6\u957f\u9664\u4ee5\u6210\u529f\u548c\u5931\u8d25\u4e8b\u52a1\u7684\u603b\u6570\u8ba1\u7b97\u5f97\u51fa\uff0c\u56e0\u800c\u5305\u542b\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u5426\u5219\uff0c\u4e3b\u62a5\u544a\u4e2d\u663e\u793a\u7684 <code class=\"literal\">latency average</code> \u548c <code class=\"literal\">latency stddev</code> \u53ea\u5bf9\u6210\u529f\u4e8b\u52a1\u8fdb\u884c\u6d4b\u91cf\u3002\u8be6\u7ec6\u5ef6\u8fdf\u7edf\u8ba1\uff0c\u5305\u62ec\u6309\u811a\u672c\u548c\u6309\u547d\u4ee4\u7684\u62a5\u544a\uff0c\u4e5f\u53ea\u5bf9\u6210\u529f\u4e8b\u52a1\u548c\u547d\u4ee4\u8fdb\u884c\u6d4b\u91cf\uff0c\u4e0d\u5305\u62ec\u5931\u8d25\u7684\u4e8b\u52a1\u6216\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u4e3b\u62a5\u544a\u5305\u542b\u5931\u8d25\u4e8b\u52a1\u7684\u6570\u91cf\u3002\u5982\u679c --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1\uff0c\u4e3b\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u91cd\u8bd5\u76f8\u5173\u7edf\u8ba1\uff1a\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u603b\u6570\u548c\u91cd\u8bd5\u603b\u6b21\u6570\u3002\u6bcf\u811a\u672c\u62a5\u544a\u7ee7\u627f\u4e3b\u62a5\u544a\u7684\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u6bcf\u8bed\u53e5\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5e0c\u671b\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\u6309\u57fa\u672c\u7c7b\u578b\u5bf9\u5931\u8d25\u8fdb\u884c\u5206\u7ec4\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\u3002\u5982\u679c\u8fd8\u5e0c\u671b\u6309\u7c7b\u578b\u533a\u5206\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u4e86\u591a\u5c11\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--verbose-errors</code>\u9009\u9879\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.10\">\n<h3 lang=\"zh\">\u8868\u8bbf\u95ee\u65b9\u6cd5</h3>\n<p lang=\"zh\">\u53ef\u4ee5\u4e3a pgbench \u8868\u6307\u5b9a<a class=\"link\" href=\"/docs/19/tableam.html\" title=\"\u7b2c\u00a062\u00a0\u7ae0\u00a0\u8868\u8bbf\u95ee\u65b9\u6cd5\u63a5\u53e3\u5b9a\u4e49\">\u8868\u8bbf\u95ee\u65b9\u6cd5</a>\u3002\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGOPTIONS</code>\u7528\u4e8e\u6307\u5b9a\u901a\u8fc7\u547d\u4ee4\u884c\u4f20\u9012\u7ed9 PostgreSQL \u7684\u6570\u636e\u5e93\u914d\u7f6e\u9009\u9879\uff08\u89c1<a class=\"xref\" href=\"/docs/19/config-setting.html#CONFIG-SETTING-SHELL\" title=\"19.1.4.\u00a0\u901a\u8fc7 Shell \u5f71\u54cd\u53c2\u6570\">\u7b2c\u00a019.1.4\u00a0\u8282</a>\uff09\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u7528\u5982\u4e0b\u65b9\u5f0f\u4e3a pgbench \u521b\u5efa\u7684\u8868\u6307\u5b9a\u4e00\u4e2a\u540d\u4e3a<code class=\"literal\">wuzza</code>\u7684\u5047\u60f3\u9ed8\u8ba4\u8868\u8bbf\u95ee\u65b9\u6cd5\uff1a</p>\n<pre class=\"programlisting\">PGOPTIONS='-c default_table_access_method=wuzza'\n</pre>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.11\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.12\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/19/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.11.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/19/pgbench.html", "method": "same-major semantic node", "sha256": "90c28b355d8da1bdd161b3dd39bc5fa1287551de17127cd3bc68383273780877", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[4]/a[0]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[55]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[55]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[57]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[59]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/h2[0]", "#PGBENCH/div[7]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[7]/h2[0]", "#PGBENCH/div[7]/p[2]", "#PGBENCH/div[7]/p[3]", "#PGBENCH/div[8]/div[10]/h3[0]", "#PGBENCH/div[8]/div[10]/p[1]", "#PGBENCH/div[8]/div[10]/p[2]", "#PGBENCH/div[8]/div[10]/p[4]", "#PGBENCH/div[8]/div[10]/p[5]", "#PGBENCH/div[8]/div[11]/h3[0]", "#PGBENCH/div[8]/div[11]/p[1]", "#PGBENCH/div[8]/div[1]/h3[0]", "#PGBENCH/div[8]/div[1]/h3[0]/span[1]", "#PGBENCH/div[8]/div[1]/p[1]", "#PGBENCH/div[8]/div[1]/p[2]", "#PGBENCH/div[8]/div[1]/p[4]", "#PGBENCH/div[8]/div[1]/p[5]", "#PGBENCH/div[8]/div[2]/div[3]/h3[0]", "#PGBENCH/div[8]/div[2]/div[3]/p[1]", "#PGBENCH/div[8]/div[2]/div[3]/p[2]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[4]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[5]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[1]", "#PGBENCH/div[8]/div[2]/h3[0]", "#PGBENCH/div[8]/div[2]/p[1]", "#PGBENCH/div[8]/div[2]/p[2]", "#PGBENCH/div[8]/div[2]/p[4]", "#PGBENCH/div[8]/div[2]/p[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[3]/div[2]/p[0]", "#PGBENCH/div[8]/div[3]/h3[0]", "#PGBENCH/div[8]/div[3]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[18]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[4]/div[2]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[8]/div[4]/div[6]/p[1]", "#PGBENCH/div[8]/div[4]/div[6]/p[2]", "#PGBENCH/div[8]/div[4]/h3[0]", "#PGBENCH/div[8]/div[4]/p[10]", "#PGBENCH/div[8]/div[4]/p[12]", "#PGBENCH/div[8]/div[4]/p[14]", "#PGBENCH/div[8]/div[4]/p[15]", "#PGBENCH/div[8]/div[4]/p[17]", "#PGBENCH/div[8]/div[4]/p[1]", "#PGBENCH/div[8]/div[4]/p[4]", "#PGBENCH/div[8]/div[4]/p[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[5]/h3[0]", "#PGBENCH/div[8]/div[5]/p[12]", "#PGBENCH/div[8]/div[5]/p[14]", "#PGBENCH/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[5]/p[4]", "#PGBENCH/div[8]/div[5]/p[5]", "#PGBENCH/div[8]/div[5]/p[7]", "#PGBENCH/div[8]/div[5]/p[9]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[6]/h3[0]", "#PGBENCH/div[8]/div[6]/p[1]", "#PGBENCH/div[8]/div[6]/p[3]", "#PGBENCH/div[8]/div[6]/p[5]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[7]/h3[0]", "#PGBENCH/div[8]/div[7]/p[10]", "#PGBENCH/div[8]/div[7]/p[1]", "#PGBENCH/div[8]/div[7]/p[3]", "#PGBENCH/div[8]/div[7]/p[4]", "#PGBENCH/div[8]/div[7]/p[5]", "#PGBENCH/div[8]/div[7]/p[7]", "#PGBENCH/div[8]/div[7]/p[9]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[8]/div[5]/p[3]", "#PGBENCH/div[8]/div[8]/p[1]", "#PGBENCH/div[8]/div[8]/p[3]", "#PGBENCH/div[8]/div[8]/p[4]", "#PGBENCH/div[8]/div[8]/p[6]", "#PGBENCH/div[8]/div[8]/p[8]", "#PGBENCH/div[8]/div[9]/h3[0]", "#PGBENCH/div[8]/div[9]/p[1]", "#PGBENCH/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/19/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/19/facts/0/label": "Documented executable", "/versions/19/facts/0/value": "pgbench", "/versions/19/facts/1/label": "Executable version", "/versions/19/facts/2/label": "Reference inventory", "/versions/19/facts/2/value": "Client applications", "/versions/19/facts/3/label": "Option definition groups", "/versions/19/tables/0/title": "Documented options", "/versions/19/tables/1/title": "Environment variables", "/versions/19/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/19/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/19/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/19/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/19/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/19/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/19/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/19/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/19/tables/0/rows/8/summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "/versions/19/tables/0/rows/9/summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "/versions/19/tables/0/columns/0/label": "Option and arguments", "/versions/19/tables/0/columns/1/label": "Description", "/versions/19/tables/0/rows/10/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/19/tables/0/rows/11/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/19/tables/0/rows/12/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/19/tables/0/rows/13/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/19/tables/0/rows/14/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/19/tables/0/rows/15/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/19/tables/0/rows/16/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/19/tables/0/rows/17/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/19/tables/0/rows/18/summary": "Write information about each transaction to a log file. See below for details.", "/versions/19/tables/0/rows/19/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/19/tables/0/rows/20/summary": "Protocol to use for submitting queries to the server:", "/versions/19/tables/0/rows/21/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/19/tables/0/rows/22/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/19/tables/0/rows/23/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "/versions/19/tables/0/rows/24/summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "/versions/19/tables/0/rows/25/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/19/tables/0/rows/26/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/19/tables/0/rows/27/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/19/tables/0/rows/28/summary": "Number of transactions each client runs. Default is 10.", "/versions/19/tables/0/rows/29/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/19/tables/0/rows/30/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/19/tables/0/rows/31/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/19/tables/0/rows/32/summary": "Allows clients to continue running even if an SQL statement fails due to errors other than serialization or deadlock. By default, clients abort after such errors, but with this option enabled, they proceed to the next transaction instead. Note that clients still abort even with this option if an error causes the connection to fail. See Failures and Serialization/Deadlock Retries for more information.", "/versions/19/tables/0/rows/33/summary": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case.", "/versions/19/tables/0/rows/34/summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "/versions/19/tables/0/rows/35/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/19/tables/0/rows/36/summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "/versions/19/tables/0/rows/37/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/19/tables/0/rows/38/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/19/tables/0/rows/39/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/19/tables/0/rows/40/summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "/versions/19/tables/0/rows/41/summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "/versions/19/tables/0/rows/42/summary": "Print debugging output.", "/versions/19/tables/0/rows/43/summary": "The database server's host name", "/versions/19/tables/0/rows/44/summary": "The database server's port number", "/versions/19/tables/0/rows/45/summary": "The user name to connect as", "/versions/19/tables/0/rows/46/summary": "Print the pgbench version and exit.", "/versions/19/tables/0/rows/47/summary": "Show help about pgbench command line arguments, and exit.", "/versions/19/tables/1/columns/0/label": "Variable", "/versions/19/tables/1/columns/1/label": "Meaning", "/versions/19/tables/1/rows/0/description": "Default connection parameters."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "93b4122ee2ac89c84bb8a7c67a251c49b504d7263f6a4ade8ddc5fbde95d6d2d"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option to load data into ordinary (non-partition) tables with version 14 or later of PostgreSQL to speed up subsequent VACUUM . Using g causes logging to print one message every 100,000 rows while generating data for all tables. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "signature": "--partition-method= NAME", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "signature": "--partitions= NUM", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 54 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "signature": "-r --report-per-command", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--continue-on-error"], "signature": "--continue-on-error", "description": "Allows clients to continue running even if an SQL statement fails due to errors other than serialization or deadlock. By default, clients abort after such errors, but with this option enabled, they proceed to the next transaction instead. Note that clients still abort even with this option if an error causes the connection to fail. See Failures and Serialization/Deadlock Retries for more information. This option is useful when your custom script may raise errors such as unique constraint violations, but you want the benchmark to continue despite individual statement failures. Failed transactions are reported separately, but are not counted as transactions actually processed; time spent on failed transactions remains part of the benchmark duration, so such failures can lower the reported TPS."}, {"names": ["--exit-on-abort"], "signature": "--exit-on-abort", "description": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case. Note that serialization failures or deadlock failures do not abort the client, so they are not affected by this option. See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--failures-detailed"], "signature": "--failures-detailed", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; other failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "signature": "--max-tries= number_of_tries", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= seed", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "signature": "--show-script= scriptname", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "signature": "--verbose-errors", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--debug"], "signature": "--debug", "description": "Print debugging output."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}]}, "comparison_hash": "5bb7e2ae519396dc20b55cd4d1d13760bc016dfbe24274fdb39d42d217aa4f23", "manual_language": "zh"}, "20": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "20devel"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "48"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-INITIALIZE", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "text": "--partition-method= NAME"}}, {"summary": "\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PARTITIONS", "text": "--partitions= NUM"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-TABLESPACE", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-BUILTIN", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-CLIENT", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u53ea\u5efa\u7acb\u4e00\u6b21\u8fde\u63a5\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-CONNECT", "text": "-C --connect"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-DEFINE", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-FILE", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-JOBS", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-LOG", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PROTOCOL", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528 --max-tries \u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PROGRESS", "text": "-P sec --progress= sec"}}, {"summary": "\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "text": "-r --report-per-command"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-RATE", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-TIME", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "text": "--aggregate-interval= seconds"}}, {"summary": "\u5373\u4f7f SQL \u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u4ee5\u5916\u7684\u9519\u8bef\u5931\u8d25\uff0c\u4e5f\u5141\u8bb8\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5ba2\u6237\u7aef\u4f1a\u5728\u8fd9\u7c7b\u9519\u8bef\u540e\u4e2d\u6b62\uff1b\u542f\u7528\u6b64\u9009\u9879\u540e\uff0c\u5b83\u4eec\u4f1a\u8f6c\u5230\u4e0b\u4e00\u4e2a\u4e8b\u52a1\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u9519\u8bef\u5bfc\u81f4\u8fde\u63a5\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4ecd\u7136\u4f1a\u4e2d\u6b62\u3002\u66f4\u591a\u4fe1\u606f\u89c1 \u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5 \u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-CONTINUE-ON-ERROR", "text": "--continue-on-error"}}, {"summary": "\u5f53\u4efb\u4e00\u5ba2\u6237\u7aef\u56e0\u9519\u8bef\u88ab\u4e2d\u6b62\u65f6\uff0c\u7acb\u5373\u9000\u51fa\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u5373\u4f7f\u67d0\u4e2a\u5ba2\u6237\u7aef\u88ab\u4e2d\u6b62\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4ecd\u53ef\u6309 -t \u6216 -T \u7684\u8bbe\u5b9a\u7ee7\u7eed\u8fd0\u884c\uff0c\u6b64\u65f6 pgbench \u4f1a\u8f93\u51fa\u4e0d\u5b8c\u6574\u7684\u7ed3\u679c\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-EXIT-ON-ABORT", "text": "--exit-on-abort"}}, {"summary": "\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "text": "--failures-detailed"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "text": "--log-prefix= prefix"}}, {"summary": "\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "text": "--max-tries= number_of_tries"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 seed \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 seed \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "text": "--random-seed= seed"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "text": "--sampling-rate= rate"}}, {"summary": "\u5c06\u5185\u7f6e\u811a\u672c scriptname \u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "text": "--show-script= scriptname"}}, {"summary": "\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1 \u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5 \u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "text": "--verbose-errors"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-DEBUG", "text": "--debug"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-USERNAME", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/pgbench.html#PGBENCH-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-INITIALIZE", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option to load data into ordinary (non-partition) tables with version 14 or later of PostgreSQL to speed up subsequent VACUUM . Using g causes logging to print one message every 100,000 rows while generating data for all tables. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-QUIET", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "signature": "--partition-method= NAME", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "signature": "--partitions= NUM", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PARTITIONS", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-TABLESPACE", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-BUILTIN", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-CLIENT", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-CONNECT", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-DEFINE", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-FILE", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-JOBS", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-LOG", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PROTOCOL", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 54 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "signature": "-P sec --progress= sec", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PROGRESS", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "signature": "-r --report-per-command", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-RATE", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-TIME", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--continue-on-error"], "summary": "Allows clients to continue running even if an SQL statement fails due to errors other than serialization or deadlock. By default, clients abort after such errors, but with this option enabled, they proceed to the next transaction instead. Note that clients still abort even with this option if an error causes the connection to fail. See Failures and Serialization/Deadlock Retries for more information.", "signature": "--continue-on-error", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-CONTINUE-ON-ERROR", "description": "Allows clients to continue running even if an SQL statement fails due to errors other than serialization or deadlock. By default, clients abort after such errors, but with this option enabled, they proceed to the next transaction instead. Note that clients still abort even with this option if an error causes the connection to fail. See Failures and Serialization/Deadlock Retries for more information. This option is useful when your custom script may raise errors such as unique constraint violations, but you want the benchmark to continue despite individual statement failures. Failed transactions are reported separately, but are not counted as transactions actually processed; time spent on failed transactions remains part of the benchmark duration, so such failures can lower the reported TPS."}, {"names": ["--exit-on-abort"], "summary": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case.", "signature": "--exit-on-abort", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-EXIT-ON-ABORT", "description": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case. Note that serialization failures or deadlock failures do not abort the client, so they are not affected by this option. See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--failures-detailed"], "summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "signature": "--failures-detailed", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; other failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "signature": "--max-tries= number_of_tries", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= seed", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "signature": "--show-script= scriptname", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "signature": "--verbose-errors", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--debug"], "summary": "Print debugging output.", "signature": "--debug", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-DEBUG", "description": "Print debugging output."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-HOST", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-PORT", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-USERNAME", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-VERSION", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/devel/pgbench.html#PGBENCH-OPTION-HELP", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "label": "20devel", "major": "20", "channel": "devel", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/20/postgresql-20-A4.pdf", "bytes": 16030631, "pages": 3052, "sha256": "bd5d82c0ce38fc18f92a0447818a91a193a261776bca1c37564bf9a683e177d0", "built_at": "2026-09-28"}, "US": {"url": "/files/documentation/pdf/20/postgresql-20-US.pdf", "bytes": 15936613, "pages": 3223, "sha256": "d97d9e0db479a02f4234b175f50fcad70c3661619afc8d6df9b9437882e3c299", "built_at": "2026-09-28"}}, "tree": "0", "index": "index.html", "major": "20", "pages": 1156, "release": "20devel", "source_url": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "svg_assets": 6, "source_mode": "en SGML built with pinned official archive", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41", "source_snapshot_utc": "26-Sep-2026 20:22"}, "revision": "2eba5e0fd4c3bffb2803247b6cd537878e9d6ee5a6dfbe3c50ece8b421b80918", "evidence_kind": "English manual and source declarations", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41"}, "sources": [{"url": "https://pg.center/docs/devel/pgbench.html", "file": "pgbench.html", "label": "20devel English manual \u00b7 pgbench.html", "anchor": "", "sha256": "5a2b439bdd46c9852e26db457992fd0cffd0e48937bf511a98fcf15cbd514b38", "language": "en", "original_url": "/docs/devel/pgbench.html"}, {"url": "https://pg.center/docs/devel/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "a6c7ba748fa1d9feac5bb7cde41d1d36a1f4c26d5963e07fb103d02918b2a8ca", "language": "en", "original_url": "/docs/devel/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u5178\u578b\u7684<span class=\"application\">pgbench</span>\u8f93\u51fa\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nlatency average = 11.013 ms\nlatency stddev = 7.351 ms\ninitial connection time = 45.758 ms\ntps = 896.967014 (without initial connection time)\n</pre>\n<p lang=\"zh\">\u524d\u4e03\u884c\u7ed9\u51fa\u4e86\u82e5\u5e72\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u7b2c\u516d\u884c\u62a5\u544a\u4e86\u51fa\u73b0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u65f6\u4e8b\u52a1\u5141\u8bb8\u7684\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u7b2c\u516b\u884c\u62a5\u544a\u5b9e\u9645\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u4e8b\u52a1\u6570\uff08\u540e\u8005\u4ec5\u4e3a\u5ba2\u6237\u7aef\u6570\u91cf\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u6216\u8005\u67d0\u4e9b SQL \u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u5426\u5219\u4e24\u8005\u5e94\u5f53\u76f8\u7b49\u3002\uff08\u5728<code class=\"option\">-T</code>\u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u4e8b\u52a1\u6570\u3002\uff09\u4e0b\u4e00\u884c\u62a5\u544a\u5931\u8d25\u7684\u4e8b\u52a1\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u6700\u540e\u4e00\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">[<span class=\"optional\">-d</span>] <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">[<span class=\"optional\">--dbname=</span>]<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u5219\u4f7f\u7528\u8fde\u63a5\u6307\u5b9a\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INITIALIZE\"><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS\"><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002<em class=\"replaceable\"><code>init_steps</code></em>\u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-D\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-T\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-G\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\u6216<code class=\"literal\">G</code>\uff08\u5728\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">g</code>\uff08\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c\u6570\u636e\u7531<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u751f\u6210\uff0c\u518d\u901a\u8fc7<code class=\"command\">COPY</code>\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4f1a\u5927\u91cf\u5360\u7528\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u5e26\u5bbd\u3002\u5bf9\u4e8e 14 \u53ca\u4ee5\u4e0a\u7248\u672c\u7684<span class=\"productname\">PostgreSQL</span>\uff0c<code class=\"command\">pgbench</code>\u4f1a\u5728\u666e\u901a\uff08\u975e\u5206\u533a\uff09\u8868\u4e0a\u4f7f\u7528<code class=\"option\">FREEZE</code>\u9009\u9879\u88c5\u8f7d\u6570\u636e\uff0c\u4ee5\u52a0\u5feb\u540e\u7eed\u7684<code class=\"command\">VACUUM</code>\u3002\u4f7f\u7528<code class=\"literal\">g</code>\u65f6\uff0c\u5728\u4e3a\u6240\u6709\u8868\u751f\u6210\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6bcf\u751f\u6210 100,000 \u884c\u4f1a\u8f93\u51fa\u4e00\u6761\u65e5\u5fd7\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">G</code>\uff08\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u53ea\u53d1\u9001\u8f83\u5c0f\u7684\u67e5\u8be2\uff0c\u968f\u540e\u5b9e\u9645\u6570\u636e\u5728\u670d\u52a1\u5668\u7aef\u751f\u6210\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u9700\u8981\u5927\u91cf\u5e26\u5bbd\uff0c\u4f46\u670d\u52a1\u5668\u4f1a\u627f\u62c5\u66f4\u591a\u5de5\u4f5c\u3002\u4f7f\u7528<code class=\"literal\">G</code>\u65f6\uff0c\u751f\u6210\u6570\u636e\u671f\u95f4\u4e0d\u4f1a\u6253\u5370\u4efb\u4f55\u8fdb\u5ea6\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u521d\u59cb\u5316\u884c\u4e3a\u4f7f\u7528\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff08\u7b49\u540c\u4e8e<code class=\"literal\">g</code>\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-V\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-P\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-F\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILLFACTOR\"><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-INIT\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n<p lang=\"zh\">\u5982\u679c -I \u4e2d\u6307\u5b9a\u4e86 G\uff0c\u6b64\u8bbe\u7f6e\u4e0d\u751f\u6548\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-INIT\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FOREIGN-KEYS\"><span class=\"term\"><code class=\"option\">--foreign-keys</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INDEX-TABLESPACE\"><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITION-METHOD\"><span class=\"term\"><code class=\"option\">--partition-method=<em class=\"replaceable\"><code>NAME</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITIONS\"><span class=\"term\"><code class=\"option\">--partitions=<em class=\"replaceable\"><code>NUM</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TABLESPACE\"><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-UNLOGGED-TABLES\"><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-BUILTIN\"><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CLIENT\"><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CONNECT\"><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u53ea\u5efa\u7acb\u4e00\u6b21\u8fde\u63a5\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-DEFINE\"><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-JOBS\"><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LATENCY-LIMIT\"><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--max-tries</code>\u9009\u9879\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u56e0\u4e32\u884c\u5316\u5f02\u5e38\u6216\u6b7b\u9501\u800c\u5931\u8d25\uff0c\u4e14\u5176\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\u5927\u4e8e<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u5219\u4e0d\u4f1a\u518d\u91cd\u8bd5\u3002\u82e5\u53ea\u60f3\u9650\u5236\u5c1d\u8bd5\u603b\u65f6\u95f4\u800c\u4e0d\u9650\u5236\u5c1d\u8bd5\u6b21\u6570\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">--max-tries=0</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"option\">--max-tries</code>\u4e3a 1\uff0c\u51fa\u73b0\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROTOCOL\"><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5728<code class=\"literal\">prepared</code>\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pgbench</span> \u4ece\u7b2c\u4e8c\u6b21\u67e5\u8be2\u8fed\u4ee3\u5f00\u59cb\u590d\u7528\u89e3\u6790\u5206\u6790\u7ed3\u679c\uff0c\u56e0\u6b64<span class=\"application\">pgbench</span> \u6bd4\u5176\u4ed6\u6a21\u5f0f\u8fd0\u884c\u5f97\u66f4\u5feb\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u503c\u662f\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/devel/protocol.html\" title=\"\u7b2c\u00a054\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a054\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-RUN\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SKIP-SOME-UPDATES\"><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS\"><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528<code class=\"option\">--max-tries</code>\u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-REPORT-LATENCIES\"><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-per-command</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RATE\"><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-RUN\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SELECT-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TRANSACTIONS\"><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TIME\"><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VACUUM-ALL\"><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-AGGREGATE-INTERVAL\"><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CONTINUE-ON-ERROR\"><span class=\"term\"><code class=\"option\">--continue-on-error</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5373\u4f7f SQL \u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u4ee5\u5916\u7684\u9519\u8bef\u5931\u8d25\uff0c\u4e5f\u5141\u8bb8\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5ba2\u6237\u7aef\u4f1a\u5728\u8fd9\u7c7b\u9519\u8bef\u540e\u4e2d\u6b62\uff1b\u542f\u7528\u6b64\u9009\u9879\u540e\uff0c\u5b83\u4eec\u4f1a\u8f6c\u5230\u4e0b\u4e00\u4e2a\u4e8b\u52a1\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u9519\u8bef\u5bfc\u81f4\u8fde\u63a5\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4ecd\u7136\u4f1a\u4e2d\u6b62\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n<p lang=\"zh\">\u5f53\u81ea\u5b9a\u4e49\u811a\u672c\u53ef\u80fd\u5f15\u53d1\u552f\u4e00\u7ea6\u675f\u8fdd\u80cc\u7b49\u9519\u8bef\uff0c\u4f46\u4f60\u5e0c\u671b\u57fa\u51c6\u6d4b\u8bd5\u5728\u4e2a\u522b\u8bed\u53e5\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u65f6\uff0c\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u5931\u8d25\u7684\u4e8b\u52a1\u4f1a\u5355\u72ec\u62a5\u544a\uff0c\u4f46\u4e0d\u8ba1\u5165\u5b9e\u9645\u5904\u7406\u7684\u4e8b\u52a1\u6570\uff1b\u5931\u8d25\u4e8b\u52a1\u8017\u8d39\u7684\u65f6\u95f4\u4ecd\u8ba1\u5165\u57fa\u51c6\u6d4b\u8bd5\u603b\u65f6\u957f\uff0c\u56e0\u6b64\u8fd9\u7c7b\u5931\u8d25\u53ef\u80fd\u964d\u4f4e\u62a5\u544a\u7684 TPS\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-EXIT-ON-ABORT\"><span class=\"term\"><code class=\"option\">--exit-on-abort</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53\u4efb\u4e00\u5ba2\u6237\u7aef\u56e0\u9519\u8bef\u88ab\u4e2d\u6b62\u65f6\uff0c\u7acb\u5373\u9000\u51fa\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u5373\u4f7f\u67d0\u4e2a\u5ba2\u6237\u7aef\u88ab\u4e2d\u6b62\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4ecd\u53ef\u6309<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u7684\u8bbe\u5b9a\u7ee7\u7eed\u8fd0\u884c\uff0c\u6b64\u65f6<span class=\"application\">pgbench</span>\u4f1a\u8f93\u51fa\u4e0d\u5b8c\u6574\u7684\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4e32\u884c\u5316\u5931\u8d25\u6216\u6b7b\u9501\u5931\u8d25\u4e0d\u4f1a\u4e2d\u6b62\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u4e0d\u53d7\u8be5\u9009\u9879\u5f71\u54cd\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FAILURES-DETAILED\"><span class=\"term\"><code class=\"option\">--failures-detailed</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e32\u884c\u5316\u5931\u8d25\uff1b</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u6b7b\u9501\u5931\u8d25\uff1b</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5176\u4ed6\u5931\u8d25\uff1b</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG-PREFIX\"><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-MAX-TRIES\"><span class=\"term\"><code class=\"option\">--max-tries=<em class=\"replaceable\"><code>number_of_tries</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS-TIMESTAMP\"><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RANDOM-SEED\"><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>seed</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>seed</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>seed</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SAMPLING-RATE\"><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SHOW-SCRIPT\"><span class=\"term\"><code class=\"option\">--show-script=</code><em class=\"replaceable\"><code>scriptname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5185\u7f6e\u811a\u672c<em class=\"replaceable\"><code>scriptname</code></em>\u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERBOSE-ERRORS\"><span class=\"term\"><code class=\"option\">--verbose-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u8fd8\u63a5\u53d7\u4ee5\u4e0b\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u53ca\u5176\u4ed6\u901a\u7528\u8bbe\u7f6e\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HOST\"><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u6210\u529f\u8fd0\u884c\u65f6\u9000\u51fa\u72b6\u6001\u4e3a 0\u3002\u9000\u51fa\u72b6\u6001 1 \u8868\u793a\u9759\u6001\u95ee\u9898\uff0c\u4f8b\u5982\u65e0\u6548\u7684\u547d\u4ee4\u884c\u9009\u9879\uff0c\u6216\u8005\u672c\u4e0d\u5e94\u53d1\u751f\u7684\u5185\u90e8\u9519\u8bef\u3002\u57fa\u51c6\u6d4b\u8bd5\u542f\u52a8\u9636\u6bb5\u7684\u65e9\u671f\u9519\u8bef\uff0c\u4f8b\u5982\u521d\u59cb\u8fde\u63a5\u5931\u8d25\uff0c\u4e5f\u4f1a\u4ee5\u72b6\u6001 1 \u9000\u51fa\u3002\u8fd0\u884c\u671f\u95f4\u7684\u9519\u8bef\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u9519\u8bef\u6216\u811a\u672c\u95ee\u9898\uff0c\u4f1a\u5bfc\u81f4\u9000\u51fa\u72b6\u6001\u4e3a 2\u3002\u5728\u540e\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u6ca1\u6709\u6307\u5b9a --exit-on-abort \u9009\u9879\uff0cpgbench \u4f1a\u6253\u5370\u90e8\u5206\u7ed3\u679c\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.8\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-envars.html\" title=\"32.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.14\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.9\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"TRANSACTIONS-AND-SCRIPTS\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n<p lang=\"zh\">\u5047\u5b9a<span class=\"application\">pgbench</span>\u811a\u672c\u4e0d\u5305\u542b\u4e0d\u5b8c\u6574\u7684 SQL \u4e8b\u52a1\u5757\u3002\u5982\u679c\u5728\u8fd0\u884c\u65f6\u5ba2\u6237\u7aef\u5728\u5c1a\u672a\u5b8c\u6210\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5757\u65f6\u5c31\u5230\u8fbe\u811a\u672c\u672b\u5c3e\uff0c\u8be5\u5ba2\u6237\u7aef\u5c06\u88ab\u4e2d\u6b62\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u673a\u5236\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5e76\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u5982\u4e0a\u6240\u8ff0\uff0c\u53d8\u91cf\u53ef\u4ee5\u7528\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e0b\u6587\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u901a\u8fc7<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u5148\u8bbe\u7f6e\u7684\u53d8\u91cf\u4e4b\u5916\uff0c\u8fd8\u6709\u5c11\u91cf\u53d8\u91cf\u4f1a\u88ab\u81ea\u52a8\u9884\u8bbe\uff0c\u5217\u5728<a class=\"xref\" href=\"/docs/devel/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0314.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0314</a>\u4e2d\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u503c\uff0c\u5219\u4f1a\u8986\u76d6\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u4e00\u65e6\u8bbe\u7f6e\u597d\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u5728 SQL \u547d\u4ee4\u4e2d\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u6765\u63d2\u5165\u5176\u503c\u3002\u5f53\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u53d8\u91cf\u96c6\u5408\u3002<span class=\"application\">pgbench</span>\u5728\u5355\u6761\u8bed\u53e5\u4e2d\u6700\u591a\u652f\u6301 255 \u6b21\u53d8\u91cf\u4f7f\u7528\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0314.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u548c\u4f2a\u968f\u673a\u7f6e\u6362\u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [<em class=\"replaceable\"><code>prefix</code></em>]</code><br/></span><span class=\"term\"><code class=\"literal\">\\aset [<em class=\"replaceable\"><code>prefix</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e9b\u547d\u4ee4\u53ef\u7528\u4e8e\u7ed3\u675f SQL \u67e5\u8be2\uff0c\u4ee5\u4ee3\u66ff\u7ed3\u5c3e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\gset</code>\u547d\u4ee4\u65f6\uff0c\u524d\u9762\u7684 SQL \u67e5\u8be2\u9884\u671f\u8fd4\u56de\u4e00\u884c\uff0c\u5176\u5404\u5217\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u96f6\u884c\u6216\u591a\u884c\uff0c\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\aset</code>\u547d\u4ee4\u65f6\uff0c\u6240\u6709\u7ec4\u5408 SQL \u67e5\u8be2\uff08\u7531<code class=\"literal\">\\;</code>\u5206\u9694\uff09\u7684\u5217\u90fd\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\u4e2d\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u4e0d\u8fd4\u56de\u4efb\u4f55\u884c\uff0c\u5219\u4e0d\u4f1a\u8fdb\u884c\u8d4b\u503c\u3002\u53ef\u4ee5\u5148\u628a\u53d8\u91cf\u521d\u59cb\u5316\u4e3a\u4e00\u4e2a\u67e5\u8be2\u4e0d\u53ef\u80fd\u8fd4\u56de\u7684\u503c\uff0c\u518d\u68c0\u67e5\u5b83\u662f\u5426\u53d1\u751f\u53d8\u5316\uff0c\u4ee5\u68c0\u6d4b\u8fd9\u79cd\u60c5\u51b5\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u591a\u884c\uff0c\u5219\u4fdd\u7559\u6700\u540e\u4e00\u4e2a\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\gset</code> \u548c <code class=\"literal\">\\aset</code> \u4e0d\u80fd\u7528\u5728\u7ba1\u9053\u6a21\u5f0f\uff0c\u56e0\u4e3a\u5728\u547d\u4ee4\u9700\u8981\u5b83\u4eec\u7684\u65f6\u5019\uff0c\u67e5\u8be2\u7ed3\u679c\u8fd8\u4e0d\u53ef\u7528\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u7684\u793a\u4f8b\u5c06\u7b2c\u4e00\u4e2a\u67e5\u8be2\u4e2d\u7684\u6700\u7ec8\u8d26\u6237\u4f59\u989d\u653e\u5165\u53d8\u91cf<em class=\"replaceable\"><code>abalance</code></em>\uff0c\u5e76\u7528\u7b2c\u4e09\u4e2a\u67e5\u8be2\u4e2d\u7684\u6574\u6570\u586b\u5145\u53d8\u91cf<em class=\"replaceable\"><code>p_two</code></em>\u548c<em class=\"replaceable\"><code>p_three</code></em>\u3002\u7b2c\u4e8c\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002\u6700\u540e\u4e24\u4e2a\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u5b58\u5165\u53d8\u91cf<em class=\"replaceable\"><code>four</code></em>\u548c<em class=\"replaceable\"><code>five</code></em>\u3002</p>\n<pre class=\"programlisting\">UPDATE pgbench_accounts\n  SET abalance = abalance + :delta\n  WHERE aid = :aid\n  RETURNING abalance \\gset\n-- compound of two queries\nSELECT 1 \\;\nSELECT 2 AS two, 3 AS three \\gset p_\nSELECT 4 AS four \\; SELECT 5 AS five \\aset\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-IF-ELSE\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/devel/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/devel/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/devel/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.19.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u8fc7\u5927\u6216\u8fc7\u5c0f\u7684\u6574\u6570\u548c\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff0c\u4ee5\u53ca\u6574\u6570\u7b97\u672f\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u548c<code class=\"literal\">/</code>\uff09\u90fd\u4f1a\u5728\u6ea2\u51fa\u65f6\u5f15\u53d1\u9519\u8bef\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SLEEP\"><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SETSHELL\"><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SHELL\"><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\syncpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u7ec4\u547d\u4ee4\u7528\u4e8e\u5b9e\u73b0 SQL \u8bed\u53e5\u7684\u7ba1\u9053\u6267\u884c\u3002\u7ba1\u9053\u5fc5\u987b\u4ee5<code class=\"command\">\\startpipeline</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endpipeline</code>\u7ed3\u675f\uff1b\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u51fa\u73b0\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\syncpipeline</code>\uff0c\u5b83\u4f1a\u53d1\u9001\u4e00\u4e2a<a class=\"link\" href=\"/docs/devel/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3.\u00a0\u6269\u5c55\u67e5\u8be2\">sync \u6d88\u606f</a>\uff0c\u65e2\u4e0d\u4f1a\u7ed3\u675f\u5f53\u524d\u7ba1\u9053\uff0c\u4e5f\u4e0d\u4f1a\u5237\u65b0\u53d1\u9001\u7f13\u51b2\u533a\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u4e00\u6761\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-pipeline-mode.html\" title=\"32.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a032.5\u00a0\u8282</a>\u3002\u7ba1\u9053\u6a21\u5f0f\u8981\u6c42\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/devel/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0315.\u00a0pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0315</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/devel/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002\u8fd9\u4e9b\u64cd\u4f5c\u7b26\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u5217\u51fa\u3002\u9664\u975e\u53e6\u6709\u8bf4\u660e\uff0c\u63a5\u53d7\u4e24\u4e2a\u6570\u5b57\u8f93\u5165\u7684\u64cd\u4f5c\u7b26\u53ea\u8981\u4efb\u4e00\u8f93\u5165\u4e3a\u53cc\u7cbe\u5ea6\uff0c\u5c31\u4f1a\u4ea7\u751f\u53cc\u7cbe\u5ea6\u7ed3\u679c\uff1b\u5426\u5219\u4ea7\u751f\u6574\u6570\u7ed3\u679c\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0315.\u00a0pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u64cd\u4f5c\u7b26</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">OR</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u6216</p>\n<p><code class=\"literal\">5 or 0</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">AND</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u4e0e</p>\n<p><code class=\"literal\">3 and 0</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">NOT</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u975e</p>\n<p><code class=\"literal\">not false</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5e03\u5c14\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 is null</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>value</code></em> <code class=\"literal\">ISNULL|NOTNULL</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7a7a\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 notnull</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 = 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;&gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">!=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 != 5</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e</p>\n<p><code class=\"literal\">5 &lt; 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;= 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e</p>\n<p><code class=\"literal\">5 &gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &gt;= 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">|</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u6216</p>\n<p><code class=\"literal\">1 | 2</code> \u2192 <code class=\"returnvalue\">3</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">#</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5f02\u6216</p>\n<p><code class=\"literal\">1 # 3</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&amp;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u4e0e</p>\n<p><code class=\"literal\">1 &amp; 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">~</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u975e</p>\n<p><code class=\"literal\">~ 1</code> \u2192 <code class=\"returnvalue\">-2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&lt;&lt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5de6\u79fb</p>\n<p><code class=\"literal\">1 &lt;&lt; 2</code> \u2192 <code class=\"returnvalue\">4</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&gt;&gt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u53f3\u79fb</p>\n<p><code class=\"literal\">8 &gt;&gt; 2</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">+</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u52a0\u6cd5</p>\n<p><code class=\"literal\">5 + 4</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u51cf\u6cd5</p>\n<p><code class=\"literal\">3 - 2.0</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">*</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u4e58\u6cd5</p>\n<p><code class=\"literal\">5 * 4</code> \u2192 <code class=\"returnvalue\">20</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">/</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u9664\u6cd5\uff08\u5982\u679c\u4e24\u4e2a\u8f93\u5165\u90fd\u662f\u6574\u6570\uff0c\u5219\u5c06\u7ed3\u679c\u5411\u96f6\u622a\u65ad\uff09</p>\n<p><code class=\"literal\">5 / 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">%</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">3 % 2</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u53d6\u76f8\u53cd\u6570</p>\n<p><code class=\"literal\">- 2.0</code> \u2192 <code class=\"returnvalue\">-2.0</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/devel/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0316.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0316</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/devel/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0316.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u51fd\u6570</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">abs</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u7edd\u5bf9\u503c</p>\n<p><code class=\"literal\">abs(-17)</code> \u2192 <code class=\"returnvalue\">17</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">debug</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u5c06\u53c2\u6570\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de\u53c2\u6570\u3002</p>\n<p><code class=\"literal\">debug(5432.1)</code> \u2192 <code class=\"returnvalue\">5432.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">double</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u8f6c\u6362\u4e3a double\u3002</p>\n<p><code class=\"literal\">double(5432)</code> \u2192 <code class=\"returnvalue\">5432.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">exp</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u6307\u6570\u51fd\u6570\uff08<code class=\"literal\">e</code> \u7684\u7ed9\u5b9a\u6b21\u5e42\uff09</p>\n<p><code class=\"literal\">exp(1.0)</code> \u2192 <code class=\"returnvalue\">2.718281828459045</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">greatest</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c\u3002</p>\n<p><code class=\"literal\">greatest(5, 4, 3, 2)</code> \u2192 <code class=\"returnvalue\">5</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8fd9\u662f <code class=\"function\">hash_murmur2</code> \u7684\u522b\u540d\u3002</p>\n<p><code class=\"literal\">hash(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_fnv1a</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\" target=\"_top\">FNV-1a hash</a>\u3002</p>\n<p><code class=\"literal\">hash_fnv1a(10, 5432)</code> \u2192 <code class=\"returnvalue\">-7793829335365542153</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_murmur2</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/MurmurHash\" target=\"_top\">MurmurHash2 hash</a>\u3002</p>\n<p><code class=\"literal\">hash_murmur2(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">int</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8f6c\u6362\u4e3a integer\u3002</p>\n<p><code class=\"literal\">int(5.4 + 3.8)</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">least</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c\u3002</p>\n<p><code class=\"literal\">least(5, 4, 3, 2.1)</code> \u2192 <code class=\"returnvalue\">2.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">ln</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u81ea\u7136\u5bf9\u6570</p>\n<p><code class=\"literal\">ln(2.718281828459045)</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">mod</code> ( <em class=\"replaceable\"><code>integer</code></em>, <em class=\"replaceable\"><code>integer</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">mod(54, 32)</code> \u2192 <code class=\"returnvalue\">22</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">permute</code> ( <em class=\"parameter\"><code>i</code></em>, <em class=\"parameter\"><code>size</code></em> [, <em class=\"parameter\"><code>seed</code></em> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\"><em class=\"parameter\"><code>i</code></em>\u7684\u7f6e\u6362\u503c\uff0c\u8303\u56f4\u5728<code class=\"literal\">[0, size)</code>\u5185\u3002\u5b83\u8868\u793a<em class=\"parameter\"><code>i</code></em>\uff08\u6a21<em class=\"parameter\"><code>size</code></em>\uff09\u5728\u6574\u6570<code class=\"literal\">0...size-1</code>\u7684\u4f2a\u968f\u673a\u7f6e\u6362\u4e2d\u7684\u65b0\u4f4d\u7f6e\uff1b\u8be5\u7f6e\u6362\u7531<em class=\"parameter\"><code>seed</code></em>\u53c2\u6570\u5316\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">permute(0, 4)</code> \u2192 <code class=\"returnvalue\">an integer between 0 and 3</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pi</code> () \u2192 <code class=\"returnvalue\">double</code></p>\n<p><span class=\"symbol_font\">\u03c0</span>\u7684\u8fd1\u4f3c\u503c</p>\n<p><code class=\"literal\">pi()</code> \u2192 <code class=\"returnvalue\">3.14159265358979323846</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pow</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p class=\"func_signature\"><code class=\"function\">power</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p><em class=\"parameter\"><code>x</code></em> \u7684 <em class=\"parameter\"><code>y</code></em> \u6b21\u5e42</p>\n<p><code class=\"literal\">pow(2.0, 10)</code> \u2192 <code class=\"returnvalue\">1024.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u5747\u5300\u5206\u5e03\u968f\u673a\u6574\u6570\u3002</p>\n<p><code class=\"literal\">random(1, 10)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_exponential</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u6307\u6570\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_exponential(1, 10, 3.0)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_gaussian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u9ad8\u65af\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_gaussian(1, 10, 2.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_zipfian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684 Zipfian \u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_zipfian(1, 10, 1.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">sqrt</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u5e73\u65b9\u6839</p>\n<p><code class=\"literal\">sqrt(2.0)</code> \u2192 <code class=\"returnvalue\">1.414213562</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002parameter \u5141\u8bb8\u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n<p lang=\"zh\">pgbench \u7684\u5b9e\u73b0\u57fa\u4e8e Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002\u7531\u4e8e\u8be5\u7b97\u6cd5\u7684\u9650\u5236\uff0cparameter \u7684\u53d6\u503c\u9650\u5236\u5728 [1.001, 1000] \u8303\u56f4\u5185\u3002</p>\n</li>\n</ul>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u8bbe\u8ba1\u4ee5\u975e\u5747\u5300\u65b9\u5f0f\u9009\u62e9\u884c\u7684\u57fa\u51c6\u6d4b\u8bd5\u65f6\uff0c\u8981\u6ce8\u610f\u88ab\u9009\u4e2d\u7684\u884c\u53ef\u80fd\u4e0e\u5176\u4ed6\u6570\u636e\u76f8\u5173\uff0c\u4f8b\u5982\u4e0e\u5e8f\u5217\u751f\u6210\u7684 ID \u6216\u7269\u7406\u884c\u987a\u5e8f\u76f8\u5173\uff0c\u8fd9\u53ef\u80fd\u4f1a\u626d\u66f2\u6027\u80fd\u6d4b\u91cf\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u4e3a\u907f\u514d\u8fd9\u4e00\u70b9\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"function\">permute</code>\u51fd\u6570\uff0c\u6216\u91c7\u7528\u5176\u4ed6\u5177\u6709\u7c7b\u4f3c\u6548\u679c\u7684\u989d\u5916\u6b65\u9aa4\uff0c\u5bf9\u9009\u4e2d\u7684\u884c\u8fdb\u884c\u6253\u4e71\u5e76\u79fb\u9664\u6b64\u7c7b\u76f8\u5173\u6027\u3002</p>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570<code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code>\u548c<code class=\"literal\">hash_fnv1a</code>\u90fd\u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f1a\u4f7f\u7528<code class=\"literal\">:default_seed</code>\u7684\u503c\uff1b\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c<code class=\"literal\">-D</code>\u9009\u9879\u8986\u76d6\uff0c\u5426\u5219\u8be5\u503c\u4f1a\u88ab\u968f\u673a\u521d\u59cb\u5316\u3002</p>\n<p lang=\"zh\">permute \u63a5\u53d7\u8f93\u5165\u503c\u3001\u5927\u5c0f\u548c\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5b83\u5728 [0, size) \u8303\u56f4\u5185\u751f\u6210\u6574\u6570\u7684\u4f2a\u968f\u673a\u6392\u5217\uff0c\u5e76\u8fd4\u56de\u8f93\u5165\u503c\u5728\u6392\u5217\u4e2d\u7684\u7d22\u5f15\u3002\u6240\u9009\u6392\u5217\u7531\u79cd\u5b50\u51b3\u5b9a\uff0c\u672a\u6307\u5b9a\u79cd\u5b50\u65f6\u9ed8\u8ba4\u4f7f\u7528 :default_seed\u3002\u4e0e\u54c8\u5e0c\u51fd\u6570\u4e0d\u540c\uff0cpermute \u4fdd\u8bc1\u8f93\u51fa\u503c\u65e2\u65e0\u51b2\u7a81\u4e5f\u65e0\u7a7a\u7f3a\u3002\u533a\u95f4\u5916\u7684\u8f93\u5165\u503c\u4f1a\u5bf9 size \u53d6\u6a21\u3002\u5982\u679c size \u4e0d\u662f\u6b63\u6570\uff0c\u51fd\u6570\u4f1a\u62a5\u9519\u3002permute \u53ef\u7528\u4e8e\u6253\u6563 random_zipfian \u6216 random_exponential \u7b49\u975e\u5747\u5300\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f7f\u66f4\u9891\u7e41\u62bd\u53d6\u7684\u503c\u4e0d\u4f1a\u5b58\u5728\u7b80\u5355\u7684\u5173\u8054\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e0a\u53ef\u80fd\u51fa\u73b0\u7684\u4e00\u7c7b\u5178\u578b\u5b9e\u9645\u8d1f\u8f7d\uff1a\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u8fc7\u91cf\u8d1f\u8f7d\u3002</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, :size, 1.07)\n\\set k 1 + permute(:r, :size)\n</pre>\n<p lang=\"zh\">\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u82e5\u5e72\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u53ef\u9009\u79cd\u5b50\u53c2\u6570\u5c31\u5f88\u6709\u7528\uff1a</p>\n<pre class=\"programlisting\">\\set k1 1 + permute(:r, :size, :default_seed + 123)\n\\set k2 1 + permute(:r, :size, :default_seed + 321)\n</pre>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u7528<code class=\"function\">hash</code>\u8fd1\u4f3c\u5b9e\u73b0\u7c7b\u4f3c\u7684\u884c\u4e3a\uff1a</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, 100 * :size, 1.07)\n\\set k 1 + abs(hash(:r)) % :size\n</pre>\n<p lang=\"zh\">\u4f46\u662f\uff0c\u7531\u4e8e<code class=\"function\">hash</code>\u4f1a\u4ea7\u751f\u51b2\u7a81\uff0c\u6709\u4e9b\u503c\u5c06\u6c38\u8fdc\u4e0d\u53ef\u8fbe\uff0c\u800c\u53e6\u4e00\u4e9b\u503c\u5219\u4f1a\u6bd4\u539f\u59cb\u5206\u5e03\u6240\u9884\u671f\u7684\u66f4\u5e38\u51fa\u73b0\u3002</p>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u6587\u4ef6\u7684\u6bcf\u4e00\u884c\u63cf\u8ff0\u4e00\u4e2a\u4e8b\u52a1\u3002\u5b83\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>client_id</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8fd0\u884c\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>transaction_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edf\u8ba1\u8be5\u4f1a\u8bdd\u5df2\u6267\u884c\u7684\u4e8b\u52a1\u6570\u91cf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u8017\u65f6\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>script_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8be5\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5f53\u901a\u8fc7<code class=\"option\">-f</code>\u6216<code class=\"option\">-b</code>\u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_epoch</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_us</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\u7684\u5c0f\u6570\u79d2\u90e8\u5206\uff0c\u4ee5\u5fae\u79d2\u4e3a\u5355\u4f4d</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>schedule_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff0c\u5373\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff08\u4ec5\u5728\u6307\u5b9a<code class=\"option\">--rate</code>\u65f6\u51fa\u73b0\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4e8b\u52a1\u6267\u884c\u671f\u95f4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08\u4ec5\u5f53 --max-tries \u4e0d\u7b49\u4e8e\u4e00\u65f6\u51fa\u73b0\uff09</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5f53\u540c\u65f6\u4f7f\u7528<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\u65f6\uff0c\u8df3\u8fc7\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">skipped</code>\u3002\u5982\u679c\u4e8b\u52a1\u4ee5\u5931\u8d25\u7ed3\u675f\uff0c\u5176<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">failed</code>\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u4f1a\u6839\u636e\u5931\u8d25\u7c7b\u578b\u62a5\u544a\u4e3a<code class=\"literal\">serialization</code>\u3001<code class=\"literal\">deadlock</code>\u6216<code class=\"literal\">other</code>\uff08\u8be6\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5305\u542b\u5931\u8d25\u4e0e\u91cd\u8bd5\u7684\u65e5\u5fd7\u7247\u6bb5\uff0c\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u8bbe\u4e3a 10\uff08\u6ce8\u610f\u989d\u5916\u7684 retries \u5217\uff09\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 failed 0 1499414498 84905 9\n2 0 failed 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u7684\u7c7b\u578b\u5c06\u5728<em class=\"replaceable\"><code>time</code></em>\u4e2d\u62a5\u544a\uff0c\u5982\u4e0b\u6240\u793a\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 serialization 0 1499414498 84905 9\n2 0 serialization 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--aggregate-interval</code>\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u4f1a\u91c7\u7528\u4e0d\u540c\u7684\u683c\u5f0f\u3002\u6bcf\u4e00\u884c\u65e5\u5fd7\u63cf\u8ff0\u4e00\u4e2a\u805a\u5408\u65f6\u95f4\u95f4\u9694\uff0c\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>interval_start</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u7684\u8d77\u59cb\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>num_transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u5185\u7684\u4e8b\u52a1\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u603b\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>skipped</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56e0\u4e3a\u542f\u52a8\u65f6\u95f4\u4f1a\u592a\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retried</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>serialization_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u4e32\u884c\u5316\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>deadlock_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u6b7b\u9501\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>other_sql_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f SQL \u9519\u8bef\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u540c\u65f6\u6307\u5b9a<code class=\"option\">--failures-detailed</code>\u548c<code class=\"option\">--continue-on-error</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4f7f\u7528\u8be5\u9009\u9879\u751f\u6210\u7684\u793a\u4f8b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\"><strong class=\"userinput\"><code>pgbench --aggregate-interval=10 --time=20 --client=10 --log --rate=1000 --latency-limit=10 --failures-detailed --max-tries=10 test</code></strong>\n\n1650260552 5178 26171317 177284491527 1136 44462 2647617 7321113867 0 9866 64 7564 28340 4148 0 0\n1650260562 4808 25573984 220121792172 1171 62083 3037380 9666800914 0 9998 598 7392 26621 4527 0 0\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u62a5\u544a</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\uff0c<span class=\"application\">pgbench</span>\u4e3a\u6bcf\u4e2a\u8bed\u53e5\u6536\u96c6\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">latency</code> \u2014 \u6bcf\u6761\u8bed\u53e5\u7684\u8017\u65f6\u3002<span class=\"application\">pgbench</span>\u62a5\u544a\u8be5\u8bed\u53e5\u6240\u6709\u6210\u529f\u6267\u884c\u7684\u5e73\u5747\u503c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u7684\u5931\u8d25\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u53d1\u751f\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u62a5\u544a\u4ec5\u5728<code class=\"option\">--max-tries</code>\u9009\u9879\u4e0d\u7b49\u4e8e1\u65f6\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6240\u6709\u6570\u503c\u90fd\u662f\u9488\u5bf9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u8ba1\u7b97\u7684\uff0c\u5e76\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u5c06\u7c7b\u4f3c\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nnumber of transactions above the 50.0 ms latency limit: 1311/10000 (13.110 %)\nlatency average = 28.488 ms\nlatency stddev = 21.009 ms\ninitial connection time = 69.068 ms\ntps = 346.224794 (without initial connection time)\nstatement latencies in milliseconds and failures:\n   0.012  0  \\set aid random(1, 100000 * :scale)\n   0.002  0  \\set bid random(1, 1 * :scale)\n   0.002  0  \\set tid random(1, 10 * :scale)\n   0.002  0  \\set delta random(-5000, 5000)\n   0.319  0  BEGIN;\n   0.834  0  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n   0.641  0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  11.126  0  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  12.961  0  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n   0.634  0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n   1.957  0  END;\n</pre>\n<p lang=\"zh\">\u4f7f\u7528\u53ef\u4e32\u884c\u5316\u9ed8\u8ba4\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\u7684\u9ed8\u8ba4\u811a\u672c\u7684\u53e6\u4e00\u4e2a\u8f93\u51fa\u793a\u4f8b\uff08<code class=\"command\">PGOPTIONS='-c default_transaction_isolation=serializable' pgbench ...</code>\uff09\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 10\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 6317/10000\nnumber of failed transactions: 3683 (36.830%)\nnumber of transactions retried: 7667 (76.670%)\ntotal number of retries: 45339\nnumber of transactions above the 50.0 ms latency limit: 106/6317 (1.678 %)\nlatency average = 17.016 ms\nlatency stddev = 13.283 ms\ninitial connection time = 45.017 ms\ntps = 186.792667 (without initial connection time)\nstatement latencies in milliseconds, failures and retries:\n  0.006     0      0  \\set aid random(1, 100000 * :scale)\n  0.001     0      0  \\set bid random(1, 1 * :scale)\n  0.001     0      0  \\set tid random(1, 10 * :scale)\n  0.001     0      0  \\set delta random(-5000, 5000)\n  0.385     0      0  BEGIN;\n  0.773     0      1  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n  0.624     0      0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  1.098   320   3762  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  0.582  3363  41576  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n  0.465     0      0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n  1.933     0      0  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"FAILURES-AND-RETRIES\">\n<h3 lang=\"zh\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</h3>\n<p lang=\"zh\">\u5728\u6267\u884c<span class=\"application\">pgbench</span>\u65f6\uff0c\u6709\u4e09\u79cd\u4e3b\u8981\u7c7b\u578b\u7684\u9519\u8bef\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e3b\u7a0b\u5e8f\u9519\u8bef\u3002\u5b83\u4eec\u6700\u4e3a\u4e25\u91cd\uff0c\u603b\u662f\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\uff0c\u5e76\u663e\u793a\u76f8\u5e94\u7684\u9519\u8bef\u6d88\u606f\u3002\u5b83\u4eec\u5305\u62ec\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\" style=\"list-style-type: circle;\">\n<li class=\"listitem\">\n<p><span class=\"application\">pgbench</span>\u5f00\u59cb\u6267\u884c\u65f6\u7684\u9519\u8bef\uff08\u4f8b\u5982\u9009\u9879\u503c\u65e0\u6548\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u521d\u59cb\u5316\u6a21\u5f0f\u4e2d\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u7528\u4e8e\u521b\u5efa\u5185\u7f6e\u811a\u672c\u6240\u9700\u8868\u7684\u67e5\u8be2\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5728\u7ebf\u7a0b\u542f\u52a8\u4e4b\u524d\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\u65e0\u6cd5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3001\u5143\u547d\u4ee4\u4e2d\u6709\u8bed\u6cd5\u9519\u8bef\u3001\u7ebf\u7a0b\u521b\u5efa\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u6c38\u8fdc\u4e0d\u8be5\u53d1\u751f\u2026\u2026\uff09\u3002</p>\n</li>\n</ul>\n</div>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u7ebf\u7a0b\u5728\u7ba1\u7406\u5176\u5ba2\u6237\u7aef\u65f6\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u5ba2\u6237\u7aef\u65e0\u6cd5\u5f00\u59cb\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u6216\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\u6240\u7528\u7684\u5957\u63a5\u5b57\u5df2\u7ecf\u5931\u6548\uff09\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8be5\u7ebf\u7a0b\u7684\u6240\u6709\u5ba2\u6237\u7aef\u90fd\u4f1a\u505c\u6b62\uff0c\u800c\u5176\u4ed6\u7ebf\u7a0b\u7ee7\u7eed\u5de5\u4f5c\uff1b\u4f46\u662f\uff0c\u5982\u679c\u6307\u5b9a\u4e86<code class=\"option\">--exit-on-abort</code>\uff0c\u5219\u6240\u6709\u7ebf\u7a0b\u90fd\u4f1a\u7acb\u5373\u505c\u6b62\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\u3002\u5728\u53d1\u751f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u4e0d\u5e94\u53d1\u751f\uff09\u6216\u6307\u5b9a\u4e86<code class=\"option\">--exit-on-abort</code>\u65f6\uff0c\u5b83\u4eec\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\u5e76\u663e\u793a\u76f8\u5e94\u9519\u8bef\u6d88\u606f\u3002\u5426\u5219\uff0c\u6700\u574f\u60c5\u51b5\u4e0b\u53ea\u4f1a\u4e2d\u6b62\u5931\u8d25\u7684\u5ba2\u6237\u7aef\uff0c\u800c\u5176\u4ed6\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\uff08\u4f46\u67d0\u4e9b\u5ba2\u6237\u7aef\u9519\u8bef\u4f1a\u5728\u4e0d\u4e2d\u6b62\u5ba2\u6237\u7aef\u7684\u60c5\u51b5\u4e0b\u5904\u7406\u5e76\u5355\u72ec\u62a5\u544a\uff0c\u89c1\u4e0b\u6587\uff09\u3002\u672c\u8282\u540e\u7eed\u9ed8\u8ba4\u8ba8\u8bba\u7684\u90fd\u662f\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\uff0c\u800c\u4e0d\u662f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5ba2\u6237\u7aef\u5728\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u65f6\u4f1a\u4e2d\u6b62\u8fd0\u884c\uff1b\u4f8b\u5982\uff0c\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e22\u5931\uff0c\u6216\u8005\u811a\u672c\u5728\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5c1a\u672a\u5b8c\u6210\u65f6\u5c31\u7ed3\u675f\u4e86\u3002\u5ba2\u6237\u7aef\u4e5f\u4f1a\u5728\u5143\u547d\u4ee4\u5931\u8d25\u65f6\u4e2d\u6b62\uff1b\u5982\u679c SQL \u547d\u4ee4\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u4e4b\u5916\u7684\u9519\u8bef\u5931\u8d25\uff0c\u4e14\u672a\u6307\u5b9a <code class=\"option\">--continue-on-error</code>\uff0c\u5ba2\u6237\u7aef\u540c\u6837\u4f1a\u4e2d\u6b62\u3002\u542f\u7528 <code class=\"option\">--continue-on-error</code> \u65f6\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u56e0\u8fd9\u7c7b SQL \u9519\u8bef\u4e2d\u6b62\uff0c\u800c\u662f\u8f6c\u5230\u4e0b\u4e00\u4e2a\u4e8b\u52a1\u3002\u8fd9\u4e9b\u60c5\u51b5\u4f1a\u5728\u8f93\u51fa\u4e2d\u62a5\u544a\u4e3a <code class=\"literal\">other failures</code>\u3002\u4e0d\u8fc7\uff0c\u5982\u679c\u9519\u8bef\u53d1\u751f\u5728\u5143\u547d\u4ee4\u4e2d\uff0c\u5373\u4f7f\u6307\u5b9a\u4e86\u8be5\u9009\u9879\uff0c\u5ba2\u6237\u7aef\u4ecd\u7136\u4f1a\u4e2d\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c SQL \u547d\u4ee4\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\uff0c\u4e0d\u8bba\u662f\u5426\u4f7f\u7528 <code class=\"option\">--continue-on-error</code>\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5f53\u524d\u4e8b\u52a1\u4f1a\u56de\u6eda\uff0c\u4e5f\u5305\u62ec\u5c06\u5ba2\u6237\u7aef\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u6b64\u4e8b\u52a1\u8fd0\u884c\u4e4b\u524d\u7684\u72b6\u6001\uff08\u5047\u8bbe\u4e00\u4e2a\u4e8b\u52a1\u811a\u672c\u53ea\u5305\u542b\u4e00\u4e2a\u4e8b\u52a1\uff1b\u8be6\u89c1<a class=\"xref\" href=\"/docs/devel/pgbench.html#TRANSACTIONS-AND-SCRIPTS\" title=\"\u5728pgbench\u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f\">\u5728 pgbench \u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f</a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff09\u3002\u53d1\u751f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4f1a\u5728\u56de\u6eda\u540e\u91cd\u65b0\u6267\u884c\uff0c\u76f4\u5230\u6210\u529f\u5b8c\u6210\uff0c\u6216\u8005\u8fbe\u5230\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u7531<code class=\"option\">--max-tries</code>\u6307\u5b9a\uff09\u3001\u8fbe\u5230\u6700\u5927\u91cd\u8bd5\u65f6\u95f4\uff08\u7531<code class=\"option\">--latency-limit</code>\u6307\u5b9a\uff09\uff0c\u6216\u8005\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\uff08\u7531<code class=\"option\">--time</code>\u6307\u5b9a\uff09\u3002\u5982\u679c\u6700\u540e\u4e00\u6b21\u5c1d\u8bd5\u4ecd\u7136\u5931\u8d25\uff0c\u8be5\u4e8b\u52a1\u4f1a\u88ab\u62a5\u544a\u4e3a\u5931\u8d25\uff0c\u4f46\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\uff0c\u800c\u662f\u7ee7\u7eed\u5de5\u4f5c\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a --max-tries \u9009\u9879\uff0c\u4e8b\u52a1\u5728\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u4e0d\u4f1a\u91cd\u8bd5\uff0c\u56e0\u4e3a\u5176\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u53ef\u4ee5\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u5e76\u914d\u5408 --latency-limit\uff0c\u4ec5\u9650\u5236\u5c1d\u8bd5\u7684\u6700\u957f\u603b\u8017\u65f6\u3002\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\u65f6\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 --time \u9650\u5236\u57fa\u51c6\u6d4b\u8bd5\u65f6\u957f\u3002</p>\n<p lang=\"zh\">\u5728\u91cd\u590d\u5305\u542b\u591a\u4e2a\u4e8b\u52a1\u7684\u811a\u672c\u65f6\u8981\u5c0f\u5fc3\uff1a\u811a\u672c\u603b\u662f\u5b8c\u5168\u91cd\u8bd5\uff0c\u56e0\u6b64\u6210\u529f\u7684\u4e8b\u52a1\u53ef\u80fd\u4f1a\u6267\u884c\u591a\u6b21\u3002</p>\n<p lang=\"zh\">\u91cd\u8bd5\u5305\u542b shell \u547d\u4ee4\u7684\u4e8b\u52a1\u65f6\u8981\u5c0f\u5fc3\u3002\u4e0e SQL \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u540c\uff0cshell \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u4f1a\u56de\u6eda\uff0c\u552f\u4e00\u7684\u4f8b\u5916\u662f<code class=\"command\">\\setshell</code>\u547d\u4ee4\u8bbe\u7f6e\u7684\u53d8\u91cf\u503c\u3002</p>\n</div>\n<p lang=\"zh\">\u6210\u529f\u4e8b\u52a1\u7684\u5ef6\u8fdf\u5305\u62ec\u4e8b\u52a1\u6267\u884c\u7684\u6574\u4e2a\u65f6\u95f4\uff0c\u5305\u62ec\u56de\u6eda\u548c\u91cd\u8bd5\u3002\u5728\u4e3b\u62a5\u544a\u4e2d\uff0c\u5982\u679c\u672a\u6307\u5b9a<code class=\"option\">--progress</code>\u3001<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\u4e2d\u7684\u4efb\u4f55\u4e00\u4e2a\uff0c<code class=\"literal\">latency average</code>\u6309\u57fa\u51c6\u6d4b\u8bd5\u603b\u65f6\u957f\u9664\u4ee5\u6210\u529f\u4e0e\u5931\u8d25\u4e8b\u52a1\u7684\u603b\u6570\u8ba1\u7b97\uff0c\u56e0\u6b64\u5305\u542b\u5931\u8d25\u4e8b\u52a1\u3002\u5426\u5219\uff0c\u4e3b\u62a5\u544a\u4e2d\u7684<code class=\"literal\">latency average</code>\u548c<code class=\"literal\">latency stddev</code>\u4ec5\u5bf9\u6210\u529f\u4e8b\u52a1\u6d4b\u91cf\u3002\u8be6\u7ec6\u5ef6\u8fdf\u7edf\u8ba1\uff08\u5305\u62ec\u6309\u811a\u672c\u548c\u6309\u547d\u4ee4\u7684\u62a5\u544a\uff09\u4e5f\u53ea\u9488\u5bf9\u6210\u529f\u7684\u4e8b\u52a1\u548c\u547d\u4ee4\u6d4b\u91cf\uff0c\u4e0d\u9488\u5bf9\u5931\u8d25\u7684\u4e8b\u52a1\u6216\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u4e3b\u62a5\u544a\u5305\u542b\u5931\u8d25\u4e8b\u52a1\u7684\u6570\u91cf\u3002\u5982\u679c --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1\uff0c\u4e3b\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u91cd\u8bd5\u76f8\u5173\u7edf\u8ba1\uff1a\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u603b\u6570\u548c\u91cd\u8bd5\u603b\u6b21\u6570\u3002\u6bcf\u811a\u672c\u62a5\u544a\u7ee7\u627f\u4e3b\u62a5\u544a\u7684\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u6bcf\u8bed\u53e5\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5e0c\u671b\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\u6309\u57fa\u672c\u7c7b\u578b\u5bf9\u5931\u8d25\u8fdb\u884c\u5206\u7ec4\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\u3002\u5982\u679c\u8fd8\u5e0c\u671b\u6309\u7c7b\u578b\u533a\u5206\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u4e86\u591a\u5c11\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--verbose-errors</code>\u9009\u9879\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.10\">\n<h3 lang=\"zh\">\u8868\u8bbf\u95ee\u65b9\u6cd5</h3>\n<p lang=\"zh\">\u53ef\u4ee5\u4e3a pgbench \u8868\u6307\u5b9a<a class=\"link\" href=\"/docs/devel/tableam.html\" title=\"\u7b2c\u00a062\u00a0\u7ae0\u00a0\u8868\u8bbf\u95ee\u65b9\u6cd5\u63a5\u53e3\u5b9a\u4e49\">\u8868\u8bbf\u95ee\u65b9\u6cd5</a>\u3002\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGOPTIONS</code>\u7528\u4e8e\u6307\u5b9a\u901a\u8fc7\u547d\u4ee4\u884c\u4f20\u9012\u7ed9 PostgreSQL \u7684\u6570\u636e\u5e93\u914d\u7f6e\u9009\u9879\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/config-setting.html#CONFIG-SETTING-SHELL\" title=\"19.1.4.\u00a0\u901a\u8fc7 Shell \u5f71\u54cd\u53c2\u6570\">\u7b2c\u00a019.1.4\u00a0\u8282</a>\uff09\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u7528\u5982\u4e0b\u65b9\u5f0f\u4e3a pgbench \u521b\u5efa\u7684\u8868\u6307\u5b9a\u4e00\u4e2a\u540d\u4e3a<code class=\"literal\">wuzza</code>\u7684\u5047\u60f3\u9ed8\u8ba4\u8868\u8bbf\u95ee\u65b9\u6cd5\uff1a</p>\n<pre class=\"programlisting\">PGOPTIONS='-c default_table_access_method=wuzza'\n</pre>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.11\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.12\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/devel/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.11.7.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/devel/pgbench.html", "method": "same-major semantic node", "sha256": "8af56dd98f4b5caa354c5f1c107777ebf15bbb08e67fe7928bde10da0a1ac432", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[4]/a[0]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[47]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[55]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[55]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[57]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[59]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/h2[0]", "#PGBENCH/div[7]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[7]/h2[0]", "#PGBENCH/div[7]/p[2]", "#PGBENCH/div[7]/p[3]", "#PGBENCH/div[8]/div[10]/h3[0]", "#PGBENCH/div[8]/div[10]/p[1]", "#PGBENCH/div[8]/div[10]/p[2]", "#PGBENCH/div[8]/div[10]/p[4]", "#PGBENCH/div[8]/div[10]/p[5]", "#PGBENCH/div[8]/div[11]/h3[0]", "#PGBENCH/div[8]/div[11]/p[1]", "#PGBENCH/div[8]/div[1]/h3[0]", "#PGBENCH/div[8]/div[1]/h3[0]/span[1]", "#PGBENCH/div[8]/div[1]/p[1]", "#PGBENCH/div[8]/div[1]/p[2]", "#PGBENCH/div[8]/div[1]/p[4]", "#PGBENCH/div[8]/div[1]/p[5]", "#PGBENCH/div[8]/div[2]/div[3]/h3[0]", "#PGBENCH/div[8]/div[2]/div[3]/p[1]", "#PGBENCH/div[8]/div[2]/div[3]/p[2]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[4]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[5]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[1]", "#PGBENCH/div[8]/div[2]/h3[0]", "#PGBENCH/div[8]/div[2]/p[1]", "#PGBENCH/div[8]/div[2]/p[2]", "#PGBENCH/div[8]/div[2]/p[4]", "#PGBENCH/div[8]/div[2]/p[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[3]/div[2]/p[0]", "#PGBENCH/div[8]/div[3]/h3[0]", "#PGBENCH/div[8]/div[3]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[18]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[4]/div[2]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[8]/div[4]/div[6]/p[1]", "#PGBENCH/div[8]/div[4]/div[6]/p[2]", "#PGBENCH/div[8]/div[4]/h3[0]", "#PGBENCH/div[8]/div[4]/p[10]", "#PGBENCH/div[8]/div[4]/p[12]", "#PGBENCH/div[8]/div[4]/p[14]", "#PGBENCH/div[8]/div[4]/p[15]", "#PGBENCH/div[8]/div[4]/p[17]", "#PGBENCH/div[8]/div[4]/p[1]", "#PGBENCH/div[8]/div[4]/p[4]", "#PGBENCH/div[8]/div[4]/p[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[5]/h3[0]", "#PGBENCH/div[8]/div[5]/p[12]", "#PGBENCH/div[8]/div[5]/p[14]", "#PGBENCH/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[5]/p[4]", "#PGBENCH/div[8]/div[5]/p[5]", "#PGBENCH/div[8]/div[5]/p[7]", "#PGBENCH/div[8]/div[5]/p[9]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[6]/h3[0]", "#PGBENCH/div[8]/div[6]/p[1]", "#PGBENCH/div[8]/div[6]/p[3]", "#PGBENCH/div[8]/div[6]/p[5]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[7]/h3[0]", "#PGBENCH/div[8]/div[7]/p[10]", "#PGBENCH/div[8]/div[7]/p[1]", "#PGBENCH/div[8]/div[7]/p[3]", "#PGBENCH/div[8]/div[7]/p[4]", "#PGBENCH/div[8]/div[7]/p[5]", "#PGBENCH/div[8]/div[7]/p[7]", "#PGBENCH/div[8]/div[7]/p[9]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[8]/div[5]/p[3]", "#PGBENCH/div[8]/div[8]/p[1]", "#PGBENCH/div[8]/div[8]/p[3]", "#PGBENCH/div[8]/div[8]/p[4]", "#PGBENCH/div[8]/div[8]/p[6]", "#PGBENCH/div[8]/div[8]/p[8]", "#PGBENCH/div[8]/div[9]/h3[0]", "#PGBENCH/div[8]/div[9]/p[1]", "#PGBENCH/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/summary": "pgbench \u2014 run a benchmark test on PostgreSQL", "/category": "Client applications", "/versions/20/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/20/facts/0/label": "Documented executable", "/versions/20/facts/0/value": "pgbench", "/versions/20/facts/1/label": "Executable version", "/versions/20/facts/2/label": "Reference inventory", "/versions/20/facts/2/value": "Client applications", "/versions/20/facts/3/label": "Option definition groups", "/versions/20/tables/0/title": "Documented options", "/versions/20/tables/1/title": "Environment variables", "/versions/20/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/20/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/20/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/20/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/20/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/20/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/20/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/20/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/20/tables/0/rows/8/summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "/versions/20/tables/0/rows/9/summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "/versions/20/tables/0/columns/0/label": "Option and arguments", "/versions/20/tables/0/columns/1/label": "Description", "/versions/20/tables/0/rows/10/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/20/tables/0/rows/11/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/20/tables/0/rows/12/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/20/tables/0/rows/13/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/20/tables/0/rows/14/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/20/tables/0/rows/15/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/20/tables/0/rows/16/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/20/tables/0/rows/17/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/20/tables/0/rows/18/summary": "Write information about each transaction to a log file. See below for details.", "/versions/20/tables/0/rows/19/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/20/tables/0/rows/20/summary": "Protocol to use for submitting queries to the server:", "/versions/20/tables/0/rows/21/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/20/tables/0/rows/22/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/20/tables/0/rows/23/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "/versions/20/tables/0/rows/24/summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "/versions/20/tables/0/rows/25/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/20/tables/0/rows/26/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/20/tables/0/rows/27/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/20/tables/0/rows/28/summary": "Number of transactions each client runs. Default is 10.", "/versions/20/tables/0/rows/29/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/20/tables/0/rows/30/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/20/tables/0/rows/31/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/20/tables/0/rows/32/summary": "Allows clients to continue running even if an SQL statement fails due to errors other than serialization or deadlock. By default, clients abort after such errors, but with this option enabled, they proceed to the next transaction instead. Note that clients still abort even with this option if an error causes the connection to fail. See Failures and Serialization/Deadlock Retries for more information.", "/versions/20/tables/0/rows/33/summary": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case.", "/versions/20/tables/0/rows/34/summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "/versions/20/tables/0/rows/35/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/20/tables/0/rows/36/summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "/versions/20/tables/0/rows/37/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/20/tables/0/rows/38/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/20/tables/0/rows/39/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/20/tables/0/rows/40/summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "/versions/20/tables/0/rows/41/summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "/versions/20/tables/0/rows/42/summary": "Print debugging output.", "/versions/20/tables/0/rows/43/summary": "The database server's host name", "/versions/20/tables/0/rows/44/summary": "The database server's port number", "/versions/20/tables/0/rows/45/summary": "The user name to connect as", "/versions/20/tables/0/rows/46/summary": "Print the pgbench version and exit.", "/versions/20/tables/0/rows/47/summary": "Show help about pgbench command line arguments, and exit.", "/versions/20/tables/1/columns/0/label": "Variable", "/versions/20/tables/1/columns/1/label": "Meaning", "/versions/20/tables/1/rows/0/description": "Default connection parameters."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "b89d321511bb371efdb3174ae48c206550a85c65cd0dd07bf5a6692f44ce0b62"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option to load data into ordinary (non-partition) tables with version 14 or later of PostgreSQL to speed up subsequent VACUUM . Using g causes logging to print one message every 100,000 rows while generating data for all tables. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "signature": "--partition-method= NAME", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "signature": "--partitions= NUM", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 54 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "signature": "-r --report-per-command", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--continue-on-error"], "signature": "--continue-on-error", "description": "Allows clients to continue running even if an SQL statement fails due to errors other than serialization or deadlock. By default, clients abort after such errors, but with this option enabled, they proceed to the next transaction instead. Note that clients still abort even with this option if an error causes the connection to fail. See Failures and Serialization/Deadlock Retries for more information. This option is useful when your custom script may raise errors such as unique constraint violations, but you want the benchmark to continue despite individual statement failures. Failed transactions are reported separately, but are not counted as transactions actually processed; time spent on failed transactions remains part of the benchmark duration, so such failures can lower the reported TPS."}, {"names": ["--exit-on-abort"], "signature": "--exit-on-abort", "description": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case. Note that serialization failures or deadlock failures do not abort the client, so they are not affected by this option. See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--failures-detailed"], "signature": "--failures-detailed", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; other failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "signature": "--max-tries= number_of_tries", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= seed", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "signature": "--show-script= scriptname", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "signature": "--verbose-errors", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--debug"], "signature": "--debug", "description": "Print debugging output."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}]}, "comparison_hash": "5bb7e2ae519396dc20b55cd4d1d13760bc016dfbe24274fdb39d42d217aa4f23", "manual_language": "zh"}}}, "snapshot": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "\u201c \u4e8b\u52a1 \u201d"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "47"}], "tables": [{"key": "options", "rows": [{"summary": "\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-INITIALIZE", "text": "-i --initialize"}}, {"summary": "\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002 init_steps \u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a dtgvp \u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "text": "-I init_steps --init-steps= init_steps"}}, {"summary": "\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "text": "-F fillfactor --fillfactor= fillfactor"}}, {"summary": "\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "text": "-n --no-vacuum"}}, {"summary": "\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b f \u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "text": "--foreign-keys"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "text": "--index-tablespace= index_tablespace"}}, {"summary": "\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "text": "--partition-method= NAME"}}, {"summary": "\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PARTITIONS", "text": "--partitions= NUM"}}, {"summary": "\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-TABLESPACE", "text": "--tablespace= tablespace"}}, {"summary": "\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "text": "--unlogged-tables"}}, {"summary": "\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a tpcb-like \u3001 simple-update \u548c select-only \u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0 list \u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-BUILTIN", "text": "-b scriptname[@weight] --builtin = scriptname[@weight]"}}, {"summary": "\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-CLIENT", "text": "-c clients --client= clients"}}, {"summary": "\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-CONNECT", "text": "-C --connect"}}, {"summary": "\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a -D \u9009\u9879\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-DEFINE", "text": "-D varname = value --define= varname = value"}}, {"summary": "\u5c06\u4ece filename \u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-FILE", "text": "-f filename[@weight] --file= filename[@weight]"}}, {"summary": "pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-JOBS", "text": "-j threads --jobs= threads"}}, {"summary": "\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-LOG", "text": "-l --log"}}, {"summary": "\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7 limit \u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a late \u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "text": "-L limit --latency-limit= limit"}}, {"summary": "\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROTOCOL", "text": "-M querymode --protocol= querymode"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868 pgbench_accounts \u3001 pgbench_branches \u3001 pgbench_history \u548c pgbench_tellers \u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f \u5fc5\u9700\u7684 \u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "text": "-n --no-vacuum"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f -b simple-update \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "text": "-N --skip-some-updates"}}, {"summary": "\u6bcf sec \u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08 -R \uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528 --max-tries \u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROGRESS", "text": "-P sec --progress= sec"}}, {"summary": "\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "text": "-r --report-per-command"}}, {"summary": "\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-RATE", "text": "-R rate --rate= rate"}}, {"summary": "\u5728 pgbench \u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1 pgbench_branches \u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08 -f \u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "text": "-s scale_factor --scale= scale_factor"}}, {"summary": "\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f -b select-only \u7684\u7b80\u5199\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "text": "-S --select-only"}}, {"summary": "\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "text": "-t transactions --transactions= transactions"}}, {"summary": "\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002 -t \u548c -T \u662f\u4e92\u65a5\u7684\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-TIME", "text": "-T seconds --time= seconds"}}, {"summary": "\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528 -n \u4e5f\u4e0d\u4f7f\u7528 -v \uff0c pgbench \u4f1a\u5bf9 pgbench_tellers \u548c pgbench_branches \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad pgbench_history \u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "text": "-v --vacuum-all"}}, {"summary": "\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e -l \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "text": "--aggregate-interval= seconds"}}, {"summary": "\u5f53\u4efb\u4e00\u5ba2\u6237\u7aef\u56e0\u9519\u8bef\u88ab\u4e2d\u6b62\u65f6\uff0c\u7acb\u5373\u9000\u51fa\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u5373\u4f7f\u67d0\u4e2a\u5ba2\u6237\u7aef\u88ab\u4e2d\u6b62\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4ecd\u53ef\u6309 -t \u6216 -T \u7684\u8bbe\u5b9a\u7ee7\u7eed\u8fd0\u884c\uff0c\u6b64\u65f6 pgbench \u4f1a\u8f93\u51fa\u4e0d\u5b8c\u6574\u7684\u7ed3\u679c\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-EXIT-ON-ABORT", "text": "--exit-on-abort"}}, {"summary": "\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "text": "--failures-detailed"}}, {"summary": "\u8bbe\u7f6e\u7531 --log \u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a pgbench_log \u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "text": "--log-prefix= prefix"}}, {"summary": "\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "text": "--max-tries= number_of_tries"}}, {"summary": "\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879 -P \uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "text": "--progress-timestamp"}}, {"summary": "\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002 seed \u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a time \uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c rand \uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08 random... \u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 --rate \u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684 seed \u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf PGBENCH_RANDOM_SEED \u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "text": "--random-seed= seed"}}, {"summary": "\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "text": "--sampling-rate= rate"}}, {"summary": "\u5c06\u5185\u7f6e\u811a\u672c scriptname \u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "text": "--show-script= scriptname"}}, {"summary": "\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1 \u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5 \u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "text": "--verbose-errors"}}, {"summary": "\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-DEBUG", "text": "--debug"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-USERNAME", "text": "-U login --username= login"}}, {"summary": "\u6253\u5370 pgbench \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a pgbench \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/pgbench.html#PGBENCH-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-i", "--initialize"], "summary": "Required to invoke initialization mode.", "signature": "-i --initialize", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-INITIALIZE", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "signature": "-I init_steps --init-steps= init_steps", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-INIT-STEPS", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option to load data into ordinary (non-partition) tables with version 14 or later of PostgreSQL to speed up subsequent VACUUM . Using g causes logging to print one message every 100,000 rows while generating data for all tables. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "signature": "-F fillfactor --fillfactor= fillfactor", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-FILLFACTOR", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "signature": "-n --no-vacuum", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-NO-VACUUM-INIT", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "signature": "-q --quiet", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-QUIET", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SCALE-INIT", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "signature": "--foreign-keys", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-FOREIGN-KEYS", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "signature": "--index-tablespace= index_tablespace", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-INDEX-TABLESPACE", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "signature": "--partition-method= NAME", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PARTITION-METHOD", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "signature": "--partitions= NUM", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PARTITIONS", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "summary": "Create tables in the specified tablespace, rather than the default tablespace.", "signature": "--tablespace= tablespace", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-TABLESPACE", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "summary": "Create all tables as unlogged tables, rather than permanent tables.", "signature": "--unlogged-tables", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-UNLOGGED-TABLES", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-BUILTIN", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "signature": "-c clients --client= clients", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-CLIENT", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "signature": "-C --connect", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-CONNECT", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-D", "--define="], "summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "signature": "-D varname = value --define= varname = value", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-DEFINE", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "summary": "Add a transaction script read from filename to the list of scripts to be executed.", "signature": "-f filename[@weight] --file= filename[@weight]", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-FILE", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "signature": "-j threads --jobs= threads", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-JOBS", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "summary": "Write information about each transaction to a log file. See below for details.", "signature": "-l --log", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-LOG", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "signature": "-L limit --latency-limit= limit", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-LATENCY-LIMIT", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "summary": "Protocol to use for submitting queries to the server:", "signature": "-M querymode --protocol= querymode", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROTOCOL", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 54 for more information.)"}, {"names": ["-n", "--no-vacuum"], "summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "signature": "-n --no-vacuum", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-NO-VACUUM-RUN", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "signature": "-N --skip-some-updates", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SKIP-SOME-UPDATES", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "signature": "-P sec --progress= sec", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROGRESS", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "signature": "-r --report-per-command", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-REPORT-LATENCIES", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "signature": "-R rate --rate= rate", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-RATE", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "signature": "-s scale_factor --scale= scale_factor", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SCALE-RUN", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "summary": "Run built-in select-only script. Shorthand for -b select-only .", "signature": "-S --select-only", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SELECT-ONLY", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "summary": "Number of transactions each client runs. Default is 10.", "signature": "-t transactions --transactions= transactions", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-TRANSACTIONS", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "signature": "-T seconds --time= seconds", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-TIME", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "signature": "-v --vacuum-all", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-VACUUM-ALL", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "signature": "--aggregate-interval= seconds", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-AGGREGATE-INTERVAL", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--exit-on-abort"], "summary": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case.", "signature": "--exit-on-abort", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-EXIT-ON-ABORT", "description": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case. Note that serialization failures or deadlock failures do not abort the client, so they are not affected by this option. See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--failures-detailed"], "summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "signature": "--failures-detailed", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-FAILURES-DETAILED", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "signature": "--log-prefix= prefix", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-LOG-PREFIX", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "signature": "--max-tries= number_of_tries", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-MAX-TRIES", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "signature": "--progress-timestamp", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PROGRESS-TIMESTAMP", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "signature": "--random-seed= seed", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-RANDOM-SEED", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "signature": "--sampling-rate= rate", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SAMPLING-RATE", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "signature": "--show-script= scriptname", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-SHOW-SCRIPT", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "signature": "--verbose-errors", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-VERBOSE-ERRORS", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--debug"], "summary": "Print debugging output.", "signature": "--debug", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-DEBUG", "description": "Print debugging output."}, {"names": ["-h", "--host="], "summary": "The database server's host name", "signature": "-h hostname --host= hostname", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-HOST", "description": "The database server's host name"}, {"names": ["-p", "--port="], "summary": "The database server's port number", "signature": "-p port --port= port", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-PORT", "description": "The database server's port number"}, {"names": ["-U", "--username="], "summary": "The user name to connect as", "signature": "-U login --username= login", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-USERNAME", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "summary": "Print the pgbench version and exit.", "signature": "-V --version", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-VERSION", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about pgbench command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/18/pgbench.html#PGBENCH-OPTION-HELP", "description": "Show help about pgbench command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "https://pg.center/docs/18/pgbench.html", "file": "pgbench.html", "label": "18.6 English manual \u00b7 pgbench.html", "anchor": "", "sha256": "b9c9e5f08998320a7ecce6cb615b5eeddc7ef3d0cb5e6c4e3422f3d44c089004", "language": "en", "original_url": "/docs/18/pgbench.html"}, {"url": "https://pg.center/docs/18/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0", "language": "en", "original_url": "/docs/18/reference-client.html"}], "sections": [], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "signature": "pgbench -i [ option ...] [ dbname ]\npgbench [ option ...] [ dbname ]", "description": ["pgbench \u2014 \u8fd0\u884c PostgreSQL \u57fa\u51c6\u6d4b\u8bd5"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}], "manual_html": "<div><div class=\"refentry\" id=\"PGBENCH\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2 lang=\"zh\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</h2>\n<p lang=\"zh\">pgbench \u2014 \u8fd0\u884c <span class=\"productname\">PostgreSQL</span> \u57fa\u51c6\u6d4b\u8bd5</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.1\"><code class=\"command\">pgbench</code> <code class=\"option\">-i</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.11.4.2\"><code class=\"command\">pgbench</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u662f\u4e00\u4e2a\u7528\u4e8e\u5bf9<span class=\"productname\">PostgreSQL</span>\u6267\u884c\u57fa\u51c6\u6d4b\u8bd5\u7684\u7b80\u5355\u7a0b\u5e8f\u3002\u5b83\u4f1a\u53cd\u590d\u6267\u884c\u540c\u4e00\u7ec4 SQL \u547d\u4ee4\uff0c\u4e5f\u53ef\u5728\u591a\u4e2a\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u4e2d\u8fd0\u884c\uff0c\u7136\u540e\u8ba1\u7b97\u5e73\u5747\u4e8b\u52a1\u901f\u7387\uff08\u6bcf\u79d2\u4e8b\u52a1\u6570\uff09\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pgbench</span>\u6d4b\u8bd5\u7684\u662f\u4e00\u4e2a\u5927\u4f53\u4e0a\u57fa\u4e8e TPC-B \u7684\u573a\u666f\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u5305\u542b\u4e94\u6761<code class=\"command\">SELECT</code>\u3001<code class=\"command\">UPDATE</code>\u548c<code class=\"command\">INSERT</code>\u547d\u4ee4\u3002\u4e0d\u8fc7\uff0c\u901a\u8fc7\u7f16\u5199\u81ea\u5df1\u7684\u4e8b\u52a1\u811a\u672c\u6587\u4ef6\uff0c\u4e5f\u5f88\u5bb9\u6613\u6d4b\u8bd5\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u5178\u578b\u7684<span class=\"application\">pgbench</span>\u8f93\u51fa\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">transaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 10\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nlatency average = 11.013 ms\nlatency stddev = 7.351 ms\ninitial connection time = 45.758 ms\ntps = 896.967014 (without initial connection time)\n</pre>\n<p lang=\"zh\">\u524d\u4e03\u884c\u7ed9\u51fa\u4e86\u82e5\u5e72\u6700\u91cd\u8981\u7684\u53c2\u6570\u8bbe\u7f6e\u3002\u7b2c\u516d\u884c\u62a5\u544a\u4e86\u51fa\u73b0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u65f6\u4e8b\u52a1\u5141\u8bb8\u7684\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u7b2c\u516b\u884c\u62a5\u544a\u5b9e\u9645\u5b8c\u6210\u7684\u4e8b\u52a1\u6570\u548c\u9884\u671f\u4e8b\u52a1\u6570\uff08\u540e\u8005\u4ec5\u4e3a\u5ba2\u6237\u7aef\u6570\u91cf\u4e0e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4e8b\u52a1\u6570\u7684\u4e58\u79ef\uff09\uff1b\u9664\u975e\u8fd0\u884c\u5728\u5b8c\u6210\u524d\u5931\u8d25\uff0c\u6216\u8005\u67d0\u4e9b SQL \u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u5426\u5219\u4e24\u8005\u5e94\u5f53\u76f8\u7b49\u3002\uff08\u5728<code class=\"option\">-T</code>\u6a21\u5f0f\u4e0b\uff0c\u53ea\u6253\u5370\u5b9e\u9645\u4e8b\u52a1\u6570\u3002\uff09\u4e0b\u4e00\u884c\u62a5\u544a\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\u7684\u4e8b\u52a1\u6570\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002\u6700\u540e\u4e00\u884c\u62a5\u544a\u6bcf\u79d2\u4e8b\u52a1\u6570\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u7c7b TPC-B \u4e8b\u52a1\u6d4b\u8bd5\u8981\u6c42\u9884\u5148\u5efa\u7acb\u7279\u5b9a\u7684\u8868\u3002\u5e94\u4f7f\u7528<code class=\"option\">-i</code>\uff08\u521d\u59cb\u5316\uff09\u9009\u9879\u8c03\u7528<span class=\"application\">pgbench</span>\u6765\u521b\u5efa\u5e76\u586b\u5145\u8fd9\u4e9b\u8868\u3002\uff08\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u811a\u672c\u65f6\u4e0d\u9700\u8981\u8fd9\u4e00\u6b65\uff0c\u4f46\u9700\u8981\u81ea\u884c\u5b8c\u6210\u6d4b\u8bd5\u6240\u9700\u7684\u51c6\u5907\u5de5\u4f5c\u3002\uff09\u521d\u59cb\u5316\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<pre class=\"programlisting\">pgbench -i [<span class=\"optional\"> <em class=\"replaceable\"><code>other-options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u5176\u4e2d<em class=\"replaceable\"><code>dbname</code></em>\u662f\u5df2\u521b\u5efa\u597d\u7684\u3001\u7528\u4e8e\u6267\u884c\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\uff08\u53ef\u80fd\u8fd8\u9700\u8981\u4f7f\u7528<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code>\u548c/\u6216<code class=\"option\">-U</code>\u9009\u9879\u6765\u6307\u5b9a\u5982\u4f55\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\uff09</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">pgbench -i</code>\u4f1a\u521b\u5efa\u56db\u4e2a\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c<code class=\"structname\">pgbench_tellers</code>\uff0c\u5e76\u9500\u6bc1\u4efb\u4f55\u5df2\u5b58\u5728\u7684\u540c\u540d\u8868\u3002\u5982\u679c\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e9b\u540d\u79f0\u7684\u8868\uff0c\u8bf7\u52a1\u5fc5\u6539\u7528\u5176\u4ed6\u6570\u636e\u5e93\uff01</p>\n</div>\n<p lang=\"zh\">\u5728\u9ed8\u8ba4\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6bd4\u4f8b\u56e0\u5b50</span>\u201d</span> 1 \u4e0b\uff0c\u8fd9\u4e9b\u8868\u6700\u521d\u5305\u542b\u5982\u4e0b\u884c\u6570\uff1a</p>\n<pre class=\"screen\">table                   # of rows\n---------------------------------\npgbench_branches        1\npgbench_tellers         10\npgbench_accounts        100000\npgbench_history         0\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">-s</code>\uff08\u6bd4\u4f8b\u56e0\u5b50\uff09\u9009\u9879\u6765\u589e\u52a0\u884c\u6570\uff0c\u800c\u4e14\u5728\u5927\u591a\u6570\u573a\u666f\u4e0b\u901a\u5e38\u4e5f\u5e94\u8be5\u8fd9\u6837\u505a\u3002\u6b64\u65f6\u8fd8\u53ef\u4ee5\u914d\u5408\u4f7f\u7528<code class=\"option\">-F</code>\uff08fillfactor\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5b8c\u6210\u5fc5\u8981\u7684\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0d\u5e26<code class=\"option\">-i</code>\u7684\u547d\u4ee4\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff0c\u4e5f\u5c31\u662f\uff1a</p>\n<pre class=\"programlisting\">pgbench [<span class=\"optional\"> <em class=\"replaceable\"><code>options</code></em> </span>] <em class=\"replaceable\"><code>dbname</code></em>\n</pre>\n<p lang=\"zh\">\u51e0\u4e4e\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u90fd\u9700\u8981\u9644\u52a0\u4e00\u4e9b\u9009\u9879\u624d\u80fd\u5f97\u5230\u6709\u610f\u4e49\u7684\u6d4b\u8bd5\u3002\u6700\u91cd\u8981\u7684\u9009\u9879\u662f<code class=\"option\">-c</code>\uff08\u5ba2\u6237\u7aef\u6570\uff09\u3001<code class=\"option\">-t</code>\uff08\u4e8b\u52a1\u6570\uff09\u3001<code class=\"option\">-T</code>\uff08\u65f6\u95f4\u9650\u5236\uff09\u4ee5\u53ca<code class=\"option\">-f</code>\uff08\u6307\u5b9a\u81ea\u5b9a\u4e49\u811a\u672c\u6587\u4ef6\uff09\u3002\u5b8c\u6574\u5217\u8868\u89c1\u4e0b\u6587\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\">\u4ee5\u4e0b\u5185\u5bb9\u5206\u4e3a\u4e09\u4e2a\u5c0f\u8282\u3002\u6570\u636e\u5e93\u521d\u59cb\u5316\u548c\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u4f46\u6709\u4e9b\u9009\u9879\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u90fd\u9002\u7528\u3002</p>\n<div class=\"refsect2\" id=\"PGBENCH-INIT-OPTIONS\">\n<h3 lang=\"zh\">\u521d\u59cb\u5316\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u521d\u59cb\u5316\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">[<span class=\"optional\">-d</span>] <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">[<span class=\"optional\">--dbname=</span>]<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6d4b\u8bd5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u5219\u4f7f\u7528\u8fde\u63a5\u6307\u5b9a\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INITIALIZE\"><span class=\"term\"><code class=\"option\">-i</code><br/></span><span class=\"term\"><code class=\"option\">--initialize</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fdb\u5165\u521d\u59cb\u5316\u6a21\u5f0f\u6240\u5fc5\u9700\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS\"><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>init_steps</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--init-steps=<em class=\"replaceable\"><code>init_steps</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6267\u884c\u6b63\u5e38\u521d\u59cb\u5316\u6b65\u9aa4\u4e2d\u7684\u9009\u5b9a\u90e8\u5206\u3002<em class=\"replaceable\"><code>init_steps</code></em>\u6307\u5b9a\u8981\u6267\u884c\u7684\u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u7528\u4e00\u4e2a\u5b57\u7b26\u8868\u793a\u3002\u5404\u6b65\u9aa4\u4f1a\u6309\u7167\u6307\u5b9a\u987a\u5e8f\u8c03\u7528\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">dtgvp</code>\u3002\u53ef\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-D\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">d</code>\uff08\u5220\u9664\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5220\u9664\u4efb\u4f55\u73b0\u6709\u7684<span class=\"application\">pgbench</span>\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-T\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">t</code>\uff08\u521b\u5efa\u8868\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u521b\u5efa\u6807\u51c6<span class=\"application\">pgbench</span>\u573a\u666f\u4f7f\u7528\u7684\u8868\uff0c\u5373 <code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-G\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">g</code>\u6216<code class=\"literal\">G</code>\uff08\u5728\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u751f\u6210\u6570\u636e\u5e76\u5c06\u5176\u88c5\u8f7d\u5230\u6807\u51c6\u8868\u4e2d\uff0c\u66ff\u6362\u5176\u4e2d\u4efb\u4f55\u5df2\u6709\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">g</code>\uff08\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c\u6570\u636e\u7531<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u751f\u6210\uff0c\u518d\u901a\u8fc7<code class=\"command\">COPY</code>\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4f1a\u5927\u91cf\u5360\u7528\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u5e26\u5bbd\u3002\u5bf9\u4e8e 14 \u53ca\u4ee5\u4e0a\u7248\u672c\u7684<span class=\"productname\">PostgreSQL</span>\uff0c<code class=\"command\">pgbench</code>\u4f1a\u5728\u666e\u901a\uff08\u975e\u5206\u533a\uff09\u8868\u4e0a\u4f7f\u7528<code class=\"option\">FREEZE</code>\u9009\u9879\u88c5\u8f7d\u6570\u636e\uff0c\u4ee5\u52a0\u5feb\u540e\u7eed\u7684<code class=\"command\">VACUUM</code>\u3002\u4f7f\u7528<code class=\"literal\">g</code>\u65f6\uff0c\u5728\u4e3a\u6240\u6709\u8868\u751f\u6210\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6bcf\u751f\u6210 100,000 \u884c\u4f1a\u8f93\u51fa\u4e00\u6761\u65e5\u5fd7\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">G</code>\uff08\u670d\u52a1\u5668\u7aef\u751f\u6210\u6570\u636e\uff09\u65f6\uff0c<code class=\"command\">pgbench</code>\u5ba2\u6237\u7aef\u53ea\u53d1\u9001\u8f83\u5c0f\u7684\u67e5\u8be2\uff0c\u968f\u540e\u5b9e\u9645\u6570\u636e\u5728\u670d\u52a1\u5668\u7aef\u751f\u6210\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u9700\u8981\u5927\u91cf\u5e26\u5bbd\uff0c\u4f46\u670d\u52a1\u5668\u4f1a\u627f\u62c5\u66f4\u591a\u5de5\u4f5c\u3002\u4f7f\u7528<code class=\"literal\">G</code>\u65f6\uff0c\u751f\u6210\u6570\u636e\u671f\u95f4\u4e0d\u4f1a\u6253\u5370\u4efb\u4f55\u8fdb\u5ea6\u6d88\u606f\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u521d\u59cb\u5316\u884c\u4e3a\u4f7f\u7528\u5ba2\u6237\u7aef\u751f\u6210\u6570\u636e\uff08\u7b49\u540c\u4e8e<code class=\"literal\">g</code>\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-V\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">v</code>\uff08\u6e05\u7406\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u8c03\u7528<code class=\"command\">VACUUM</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-P\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">p</code>\uff08\u521b\u5efa\u4e3b\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e0a\u521b\u5efa\u4e3b\u952e\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INIT-STEPS-F\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">f</code>\uff08\u521b\u5efa\u5916\u952e\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u6267\u884c\u6b64\u6b65\u9aa4\u3002\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILLFACTOR\"><span class=\"term\"><code class=\"option\">-F</code> <em class=\"replaceable\"><code>fillfactor</code></em><br/></span><span class=\"term\"><code class=\"option\">--fillfactor=</code><em class=\"replaceable\"><code>fillfactor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684 fillfactor \u521b\u5efa pgbench_accounts\u3001pgbench_tellers \u548c pgbench_branches \u8868\u3002\u9ed8\u8ba4\u503c\u4e3a 100\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-INIT\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u521d\u59cb\u5316\u671f\u95f4\u4e0d\u6267\u884c\u6e05\u7406\u3002\uff08\u6b64\u9009\u9879\u4f1a\u6291\u5236 v \u521d\u59cb\u5316\u6b65\u9aa4\uff0c\u5373\u4f7f -I \u4e2d\u5df2\u6307\u5b9a\u8be5\u6b65\u9aa4\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u65e5\u5fd7\u5207\u6362\u4e3a\u9759\u9ed8\u6a21\u5f0f\uff0c\u6bcf 5 \u79d2\u53ea\u8f93\u51fa\u4e00\u6761\u8fdb\u5ea6\u6d88\u606f\u3002\u9ed8\u8ba4\u65e5\u5fd7\u6bcf\u751f\u6210 100,000 \u884c\u8f93\u51fa\u4e00\u6761\u6d88\u606f\uff0c\u56e0\u800c\u5f80\u5f80\u4f1a\u5728\u6bcf\u79d2\u8f93\u51fa\u591a\u884c\uff08\u5c24\u5176\u662f\u5728\u8f83\u597d\u7684\u786c\u4ef6\u4e0a\uff09\u3002</p>\n<p lang=\"zh\">\u5982\u679c -I \u4e2d\u6307\u5b9a\u4e86 G\uff0c\u6b64\u8bbe\u7f6e\u4e0d\u751f\u6548\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-INIT\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u751f\u6210\u7684\u884c\u6570\u4e58\u4ee5\u89c4\u6a21\u56e0\u5b50\u3002\u4f8b\u5982\uff0c-s 100 \u4f1a\u5728 pgbench_accounts \u8868\u4e2d\u521b\u5efa 10,000,000 \u884c\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u5f53\u89c4\u6a21\u56e0\u5b50\u8fbe\u5230 20,000 \u6216\u66f4\u5927\u65f6\uff0c\u5b58\u653e\u8d26\u6237\u6807\u8bc6\u7b26\u7684\u5217\uff08aid \u5217\uff09\u4f1a\u6539\u7528\u66f4\u5927\u7684\u6574\u6570\u7c7b\u578b\uff08bigint\uff09\uff0c\u4ee5\u5bb9\u7eb3\u6240\u9700\u7684\u8d26\u6237\u6807\u8bc6\u7b26\u8303\u56f4\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FOREIGN-KEYS\"><span class=\"term\"><code class=\"option\">--foreign-keys</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6807\u51c6\u8868\u4e4b\u95f4\u521b\u5efa\u5916\u952e\u7ea6\u675f\u3002\uff08\u5982\u679c\u521d\u59cb\u5316\u6b65\u9aa4\u5e8f\u5217\u4e2d\u5c1a\u672a\u5305\u542b<code class=\"literal\">f</code>\u6b65\u9aa4\uff0c\u5219\u6b64\u9009\u9879\u4f1a\u628a\u5b83\u52a0\u5165\u8fdb\u53bb\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-INDEX-TABLESPACE\"><span class=\"term\"><code class=\"option\">--index-tablespace=<em class=\"replaceable\"><code>index_tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u7d22\u5f15\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITION-METHOD\"><span class=\"term\"><code class=\"option\">--partition-method=<em class=\"replaceable\"><code>NAME</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 NAME \u65b9\u6cd5\u521b\u5efa\u5206\u533a\u7684 pgbench_accounts \u8868\u3002\u53ef\u9009\u503c\u4e3a range \u6216 hash\u3002\u6b64\u9009\u9879\u8981\u6c42 --partitions \u4e3a\u975e\u96f6\u503c\u3002\u672a\u6307\u5b9a\u65f6\u9ed8\u8ba4\u4e3a range\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PARTITIONS\"><span class=\"term\"><code class=\"option\">--partitions=<em class=\"replaceable\"><code>NUM</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u6309\u89c4\u6a21\u56e0\u5b50\u786e\u5b9a\u7684\u8d26\u6237\u6570\u91cf\u521b\u5efa\u5177\u6709 NUM \u4e2a\u5206\u533a\u7684 pgbench_accounts \u8868\uff0c\u5404\u5206\u533a\u5927\u5c0f\u5927\u81f4\u76f8\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3a 0\uff0c\u8868\u793a\u4e0d\u5206\u533a\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TABLESPACE\"><span class=\"term\"><code class=\"option\">--tablespace=<em class=\"replaceable\"><code>tablespace</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6307\u5b9a\u7684\u8868\u7a7a\u95f4\u4e2d\u521b\u5efa\u8868\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-UNLOGGED-TABLES\"><span class=\"term\"><code class=\"option\">--unlogged-tables</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6240\u6709\u8868\u521b\u5efa\u4e3a\u4e0d\u8bb0\u5f55 WAL \u7684\u8868\uff0c\u800c\u4e0d\u662f\u6c38\u4e45\u8868\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-RUN-OPTIONS\">\n<h3 lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u63a5\u53d7\u4ee5\u4e0b\u547d\u4ee4\u884c\u57fa\u51c6\u6d4b\u8bd5\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-BUILTIN\"><span class=\"term\"><code class=\"option\">-b</code> <em class=\"replaceable\"><code>scriptname[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--builtin</code>=<em class=\"replaceable\"><code>scriptname[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\u6dfb\u52a0\u5230\u5f85\u6267\u884c\u811a\u672c\u5217\u8868\u4e2d\u3002\u53ef\u7528\u7684\u5185\u7f6e\u811a\u672c\u5305\u62ec\uff1a<code class=\"literal\">tpcb-like</code>\u3001<code class=\"literal\">simple-update</code>\u548c<code class=\"literal\">select-only</code>\u3002\u4e5f\u63a5\u53d7\u5185\u7f6e\u540d\u79f0\u7684\u65e0\u6b67\u4e49\u524d\u7f00\u3002\u4f7f\u7528\u7279\u6b8a\u540d\u79f0<code class=\"literal\">list</code>\u65f6\uff0c\u4f1a\u663e\u793a\u5185\u7f6e\u811a\u672c\u5217\u8868\u5e76\u7acb\u5373\u9000\u51fa\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CLIENT\"><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>clients</code></em><br/></span><span class=\"term\"><code class=\"option\">--client=</code><em class=\"replaceable\"><code>clients</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6a21\u62df\u7684\u5ba2\u6237\u7aef\u6570\u91cf\uff0c\u5373\u5e76\u53d1\u6570\u636e\u5e93\u4f1a\u8bdd\u6570\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-CONNECT\"><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--connect</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e3a\u6bcf\u4e2a\u4e8b\u52a1\u5efa\u7acb\u4e00\u4e2a\u65b0\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4ec5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u4e2d\u6267\u884c\u4e00\u6b21\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u91cf\u8fde\u63a5\u5f00\u9500\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-DEFINE\"><span class=\"term\"><code class=\"option\">-D</code> <em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em><br/></span><span class=\"term\"><code class=\"option\">--define=</code><em class=\"replaceable\"><code>varname</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f9b\u81ea\u5b9a\u4e49\u811a\u672c\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002\u5141\u8bb8\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-D</code>\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f</code> <em class=\"replaceable\"><code>filename[@weight]</code></em><br/></span><span class=\"term\"><code class=\"option\">--file=</code><em class=\"replaceable\"><code>filename[@weight]</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u4ece<em class=\"replaceable\"><code>filename</code></em>\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\u6dfb\u52a0\u5230\u8981\u6267\u884c\u7684\u811a\u672c\u5217\u8868\u4e2d\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u5728 @ \u540e\u5199\u5165\u6574\u6570\u6743\u91cd\uff0c\u4ee5\u8c03\u6574\u9009\u62e9\u6b64\u811a\u672c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u811a\u672c\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a 1\u3002\uff08\u5982\u679c\u811a\u672c\u6587\u4ef6\u540d\u5305\u542b @ \u5b57\u7b26\uff0c\u8bf7\u8ffd\u52a0\u6743\u91cd\u4ee5\u6d88\u9664\u6b67\u4e49\uff0c\u4f8b\u5982 filen@me@1\u3002\uff09\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-JOBS\"><span class=\"term\"><code class=\"option\">-j</code> <em class=\"replaceable\"><code>threads</code></em><br/></span><span class=\"term\"><code class=\"option\">--jobs=</code><em class=\"replaceable\"><code>threads</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">pgbench \u5185\u90e8\u7684\u5de5\u4f5c\u7ebf\u7a0b\u6570\u3002\u5728\u591a CPU \u673a\u5668\u4e0a\uff0c\u4f7f\u7528\u591a\u4e2a\u7ebf\u7a0b\u53ef\u80fd\u6709\u5e2e\u52a9\u3002\u5ba2\u6237\u7aef\u4f1a\u5c3d\u53ef\u80fd\u5747\u5300\u5730\u5206\u914d\u5230\u53ef\u7528\u7ebf\u7a0b\u4e2d\u3002\u9ed8\u8ba4\u503c\u4e3a 1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--log</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u8be6\u60c5\u89c1\u4e0b\u6587\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LATENCY-LIMIT\"><span class=\"term\"><code class=\"option\">-L</code> <em class=\"replaceable\"><code>limit</code></em><br/></span><span class=\"term\"><code class=\"option\">--latency-limit=</code><em class=\"replaceable\"><code>limit</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u6301\u7eed\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\u7684\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u548c\u62a5\u544a\uff0c\u79f0\u4e3a<em class=\"firstterm\">late</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">--rate=...</code>\uff09\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u843d\u540e\u4e8e\u8ba1\u5212\u65f6\u95f4\u8d85\u8fc7<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u4ece\u800c\u5df2\u7ecf\u4e0d\u53ef\u80fd\u6ee1\u8db3\u5ef6\u8fdf\u9650\u5236\uff0c\u5219\u5b83\u6839\u672c\u4e0d\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u6b64\u7c7b\u4e8b\u52a1\u4f1a\u88ab\u5355\u72ec\u8ba1\u6570\u5e76\u62a5\u544a\u4e3a<em class=\"firstterm\">skipped</em>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--max-tries</code>\u9009\u9879\u65f6\uff0c\u82e5\u67d0\u4e2a\u4e8b\u52a1\u56e0\u4e32\u884c\u5316\u5f02\u5e38\u6216\u6b7b\u9501\u800c\u5931\u8d25\uff0c\u4e14\u5176\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\u5927\u4e8e<em class=\"replaceable\"><code>limit</code></em>\u6beb\u79d2\uff0c\u5219\u4e0d\u4f1a\u518d\u91cd\u8bd5\u3002\u82e5\u53ea\u60f3\u9650\u5236\u5c1d\u8bd5\u603b\u65f6\u95f4\u800c\u4e0d\u9650\u5236\u5c1d\u8bd5\u6b21\u6570\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">--max-tries=0</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"option\">--max-tries</code>\u4e3a 1\uff0c\u51fa\u73b0\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROTOCOL\"><span class=\"term\"><code class=\"option\">-M</code> <em class=\"replaceable\"><code>querymode</code></em><br/></span><span class=\"term\"><code class=\"option\">--protocol=</code><em class=\"replaceable\"><code>querymode</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5411\u670d\u52a1\u5668\u63d0\u4ea4\u67e5\u8be2\u7684\u534f\u8bae\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">simple</code>\uff1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">extended</code>\uff1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">prepared</code>\uff1a\u4f7f\u7528\u5e26\u6709\u9884\u5907\u8bed\u53e5\u7684\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5728<code class=\"literal\">prepared</code>\u6a21\u5f0f\u4e0b\uff0c<span class=\"application\">pgbench</span> \u4ece\u7b2c\u4e8c\u6b21\u67e5\u8be2\u8fed\u4ee3\u5f00\u59cb\u590d\u7528\u89e3\u6790\u5206\u6790\u7ed3\u679c\uff0c\u56e0\u6b64<span class=\"application\">pgbench</span> \u6bd4\u5176\u4ed6\u6a21\u5f0f\u8fd0\u884c\u5f97\u66f4\u5feb\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u503c\u662f\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\uff08\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/protocol.html\" title=\"\u7b2c\u00a054\u00a0\u7ae0\u00a0\u524d\u7aef/\u540e\u7aef\u534f\u8bae\">\u7b2c\u00a054\u00a0\u7ae0</a>\u3002\uff09</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-NO-VACUUM-RUN\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-vacuum</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u524d\u4e0d\u6267\u884c\u4efb\u4f55\u6e05\u7406\u3002\u5982\u679c\u8fd0\u884c\u7684\u662f\u4e0d\u5305\u542b\u6807\u51c6\u8868<code class=\"structname\">pgbench_accounts</code>\u3001<code class=\"structname\">pgbench_branches</code>\u3001<code class=\"structname\">pgbench_history</code>\u548c <code class=\"structname\">pgbench_tellers</code>\u7684\u81ea\u5b9a\u4e49\u6d4b\u8bd5\u573a\u666f\uff0c\u5219\u6b64\u9009\u9879\u662f<span class=\"emphasis\"><em>\u5fc5\u9700\u7684</em></span>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SKIP-SOME-UPDATES\"><span class=\"term\"><code class=\"option\">-N</code><br/></span><span class=\"term\"><code class=\"option\">--skip-some-updates</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 simple-update \u811a\u672c\u3002\u662f<code class=\"option\">-b simple-update</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS\"><span class=\"term\"><code class=\"option\">-P</code> <em class=\"replaceable\"><code>sec</code></em><br/></span><span class=\"term\"><code class=\"option\">--progress=</code><em class=\"replaceable\"><code>sec</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf<em class=\"replaceable\"><code>sec</code></em>\u79d2\u663e\u793a\u4e00\u6b21\u8fdb\u5ea6\u62a5\u544a\u3002\u62a5\u544a\u5305\u62ec\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u65f6\u95f4\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u7684 TPS\u3001\u81ea\u4e0a\u6b21\u62a5\u544a\u4ee5\u6765\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u4ee5\u53ca\u5931\u8d25\u4e8b\u52a1\u6570\u3002\u4f7f\u7528\u9650\u6d41\uff08<code class=\"option\">-R</code>\uff09\u65f6\uff0c\u5ef6\u8fdf\u662f\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\uff0c\u56e0\u6b64\u5176\u4e2d\u4e5f\u5305\u542b\u5e73\u5747\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002\u5f53\u4f7f\u7528<code class=\"option\">--max-tries</code>\u542f\u7528\u4e8b\u52a1\u5728\u4e32\u884c\u5316/\u6b7b\u9501\u9519\u8bef\u540e\u7684\u91cd\u8bd5\u65f6\uff0c\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u53d1\u751f\u8fc7\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\u4ee5\u53ca\u603b\u91cd\u8bd5\u6b21\u6570\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-REPORT-LATENCIES\"><span class=\"term\"><code class=\"option\">-r</code><br/></span><span class=\"term\"><code class=\"option\">--report-per-command</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\u540e\uff0c\u4e3a\u6bcf\u6761\u547d\u4ee4\u62a5\u544a\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a\u6bcf\u6761\u8bed\u53e5\u7684\u5e73\u5747\u5ef6\u8fdf\uff08\u4ece\u5ba2\u6237\u7aef\u89d2\u5ea6\u8861\u91cf\u7684\u6267\u884c\u65f6\u95f4\uff09\u3001\u5931\u8d25\u6b21\u6570\uff0c\u4ee5\u53ca\u8be5\u547d\u4ee4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RATE\"><span class=\"term\"><code class=\"option\">-R</code> <em class=\"replaceable\"><code>rate</code></em><br/></span><span class=\"term\"><code class=\"option\">--rate=</code><em class=\"replaceable\"><code>rate</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ee5\u6307\u5b9a\u901f\u7387\u6267\u884c\u4e8b\u52a1\uff0c\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u884c\u4e3a\u90a3\u6837\u5c3d\u53ef\u80fd\u5feb\u5730\u8fd0\u884c\u3002\u901f\u7387\u4ee5\u6bcf\u79d2\u4e8b\u52a1\u6570\u8868\u793a\u3002\u5982\u679c\u76ee\u6807\u901f\u7387\u9ad8\u4e8e\u53ef\u8fbe\u5230\u7684\u6700\u5927\u901f\u7387\uff0c\u5219\u901f\u7387\u9650\u5236\u4e0d\u4f1a\u5f71\u54cd\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8be5\u901f\u7387\u901a\u8fc7\u8ba9\u4e8b\u52a1\u6cbf\u7740\u4e00\u6761\u7b26\u5408\u6cca\u677e\u5206\u5e03\u7684\u65f6\u95f4\u7ebf\u542f\u52a8\u6765\u5b9e\u73b0\u3002\u9884\u671f\u5f00\u59cb\u65f6\u95f4\u8868\u662f\u6839\u636e\u5ba2\u6237\u7aef\u9996\u6b21\u542f\u52a8\u7684\u65f6\u95f4\u5411\u524d\u63a8\u8fdb\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5f53\u67d0\u4e9b\u4e8b\u52a1\u8d85\u8fc7\u5176\u539f\u5b9a\u7ed3\u675f\u65f6\u95f4\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4ecd\u6709\u53ef\u80fd\u91cd\u65b0\u8d76\u4e0a\u8ba1\u5212\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u9650\u6d41\u540e\uff0c\u8fd0\u884c\u7ed3\u675f\u65f6\u62a5\u544a\u7684\u4e8b\u52a1\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\uff0c\u56e0\u6b64\u5b83\u5305\u542b\u6bcf\u4e2a\u4e8b\u52a1\u7b49\u5f85\u524d\u4e00\u4e2a\u4e8b\u52a1\u5b8c\u6210\u7684\u65f6\u95f4\u3002\u8fd9\u6bb5\u7b49\u5f85\u65f6\u95f4\u79f0\u4e3a\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\uff0c\u5176\u5e73\u5747\u503c\u548c\u6700\u5927\u503c\u4e5f\u4f1a\u5355\u72ec\u62a5\u544a\u3002\u82e5\u8981\u5f97\u5230\u76f8\u5bf9\u4e8e\u4e8b\u52a1\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u7684\u5ef6\u8fdf\uff0c\u4e5f\u5c31\u662f\u4e8b\u52a1\u5728\u6570\u636e\u5e93\u4e2d\u5b9e\u9645\u6267\u884c\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u62a5\u544a\u4e2d\u7684\u5ef6\u8fdf\u51cf\u53bb\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u540c\u65f6\u4f7f\u7528<code class=\"option\">--latency-limit</code>\u548c<code class=\"option\">--rate</code>\uff0c\u4e00\u4e2a\u4e8b\u52a1\u53ef\u80fd\u4f1a\u843d\u540e\u592a\u591a\uff0c\u4ee5\u81f3\u4e8e\u5728\u524d\u4e00\u4e2a\u4e8b\u52a1\u7ed3\u675f\u65f6\u5df2\u7ecf\u8d85\u8fc7\u4e86\u5ef6\u8fdf\u9650\u5236\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u662f\u4ece\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u8ba1\u7b97\u7684\u3002\u8fd9\u6837\u7684\u4e8b\u52a1\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u5b8c\u5168\u8df3\u8fc7\u5e76\u5355\u72ec\u8ba1\u6570\u3002</p>\n<p lang=\"zh\">\u8f83\u9ad8\u7684\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u8868\u660e\uff0c\u5728\u6240\u9009\u5ba2\u6237\u7aef\u6570\u548c\u7ebf\u7a0b\u6570\u4e0b\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4ee5\u6307\u5b9a\u901f\u7387\u5904\u7406\u4e8b\u52a1\u3002\u5f53\u5e73\u5747\u4e8b\u52a1\u6267\u884c\u65f6\u95f4\u957f\u4e8e\u4e8b\u52a1\u4e4b\u95f4\u7684\u8ba1\u5212\u95f4\u9694\u65f6\uff0c\u540e\u7eed\u4e8b\u52a1\u4f1a\u4e0d\u65ad\u8fdb\u4e00\u6b65\u843d\u540e\uff0c\u800c\u8ba1\u5212\u6ede\u540e\u65f6\u95f4\u4e5f\u4f1a\u968f\u7740\u6d4b\u8bd5\u6301\u7eed\u65f6\u95f4\u589e\u52a0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u964d\u4f4e\u6307\u5b9a\u7684\u4e8b\u52a1\u901f\u7387\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SCALE-RUN\"><span class=\"term\"><code class=\"option\">-s</code> <em class=\"replaceable\"><code>scale_factor</code></em><br/></span><span class=\"term\"><code class=\"option\">--scale=</code><em class=\"replaceable\"><code>scale_factor</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728<span class=\"application\">pgbench</span>\u8f93\u51fa\u4e2d\u62a5\u544a\u6307\u5b9a\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u5bf9\u4e8e\u5185\u7f6e\u6d4b\u8bd5\uff0c\u8fd9\u6ca1\u6709\u5fc5\u8981\uff1b\u7cfb\u7edf\u4f1a\u901a\u8fc7\u7edf\u8ba1<code class=\"structname\">pgbench_branches</code>\u8868\u4e2d\u7684\u884c\u6570\u6765\u68c0\u6d4b\u6b63\u786e\u7684\u6bd4\u4f8b\u56e0\u5b50\u3002\u4f46\u5728\u53ea\u6d4b\u8bd5\u81ea\u5b9a\u4e49\u57fa\u51c6\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u65f6\uff0c\u9664\u975e\u4f7f\u7528\u6b64\u9009\u9879\uff0c\u5426\u5219\u6bd4\u4f8b\u56e0\u5b50\u4f1a\u88ab\u62a5\u544a\u4e3a 1\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SELECT-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--select-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5185\u7f6e\u7684 select-only \u811a\u672c\u3002\u662f<code class=\"option\">-b select-only</code>\u7684\u7b80\u5199\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TRANSACTIONS\"><span class=\"term\"><code class=\"option\">-t</code> <em class=\"replaceable\"><code>transactions</code></em><br/></span><span class=\"term\"><code class=\"option\">--transactions=</code><em class=\"replaceable\"><code>transactions</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u7684\u4e8b\u52a1\u6570\u91cf\u3002\u9ed8\u8ba4\u503c\u4e3a10\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-TIME\"><span class=\"term\"><code class=\"option\">-T</code> <em class=\"replaceable\"><code>seconds</code></em><br/></span><span class=\"term\"><code class=\"option\">--time=</code><em class=\"replaceable\"><code>seconds</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8ba9\u6d4b\u8bd5\u8fd0\u884c\u6307\u5b9a\u7684\u79d2\u6570\uff0c\u800c\u4e0d\u662f\u8ba9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u4e8b\u52a1\u3002<code class=\"option\">-t</code> \u548c <code class=\"option\">-T</code> \u662f\u4e92\u65a5\u7684\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VACUUM-ALL\"><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--vacuum-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd0\u884c\u6d4b\u8bd5\u4e4b\u524d\uff0c\u5bf9\u56db\u4e2a\u6807\u51c6\u8868\u5168\u90e8\u6267\u884c\u6e05\u7406\u3002\u5982\u679c\u65e2\u4e0d\u4f7f\u7528<code class=\"option\">-n</code>\u4e5f\u4e0d\u4f7f\u7528<code class=\"option\">-v</code>\uff0c<span class=\"application\">pgbench</span>\u4f1a\u5bf9 <code class=\"structname\">pgbench_tellers</code>\u548c<code class=\"structname\">pgbench_branches</code> \u8868\u8fdb\u884c\u6e05\u7406\uff0c\u5e76\u622a\u65ad<code class=\"structname\">pgbench_history</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-AGGREGATE-INTERVAL\"><span class=\"term\"><code class=\"option\">--aggregate-interval=<em class=\"replaceable\"><code>seconds</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u805a\u5408\u95f4\u9694\u7684\u957f\u5ea6\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u53ea\u80fd\u4e0e<code class=\"option\">-l</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u5305\u542b\u6bcf\u4e2a\u95f4\u9694\u7684\u6458\u8981\u6570\u636e\uff0c\u5982\u4e0b\u6240\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-EXIT-ON-ABORT\"><span class=\"term\"><code class=\"option\">--exit-on-abort</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53\u4efb\u4e00\u5ba2\u6237\u7aef\u56e0\u9519\u8bef\u88ab\u4e2d\u6b62\u65f6\uff0c\u7acb\u5373\u9000\u51fa\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u5373\u4f7f\u67d0\u4e2a\u5ba2\u6237\u7aef\u88ab\u4e2d\u6b62\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4ecd\u53ef\u6309<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u7684\u8bbe\u5b9a\u7ee7\u7eed\u8fd0\u884c\uff0c\u6b64\u65f6<span class=\"application\">pgbench</span>\u4f1a\u8f93\u51fa\u4e0d\u5b8c\u6574\u7684\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u4e32\u884c\u5316\u5931\u8d25\u6216\u6b7b\u9501\u5931\u8d25\u4e0d\u4f1a\u4e2d\u6b62\u5ba2\u6237\u7aef\uff0c\u56e0\u6b64\u4e0d\u53d7\u8be5\u9009\u9879\u5f71\u54cd\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-FAILURES-DETAILED\"><span class=\"term\"><code class=\"option\">--failures-detailed</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\uff0c\u6309\u4ee5\u4e0b\u7c7b\u578b\u5206\u7ec4\u62a5\u544a\u5931\u8d25\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e32\u884c\u5316\u5931\u8d25\uff1b</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u6b7b\u9501\u5931\u8d25\uff1b</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-LOG-PREFIX\"><span class=\"term\"><code class=\"option\">--log-prefix=<em class=\"replaceable\"><code>prefix</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7531<code class=\"option\">--log</code>\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u524d\u7f00\u3002\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">pgbench_log</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-MAX-TRIES\"><span class=\"term\"><code class=\"option\">--max-tries=<em class=\"replaceable\"><code>number_of_tries</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u542f\u7528\u91cd\u8bd5\uff0c\u5e76\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e --latency-limit \u4e00\u8d77\u4f7f\u7528\uff0c\u540e\u8005\u9650\u5236\u540c\u4e00\u4e8b\u52a1\u6240\u6709\u5c1d\u8bd5\u7684\u603b\u8017\u65f6\uff1b\u6b64\u5916\uff0c\u53ea\u6709\u6307\u5b9a --latency-limit \u6216 --time\uff0c\u624d\u5141\u8bb8\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a 1\uff0c\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u7684\u4e8b\u52a1\u4e0d\u4f1a\u91cd\u8bd5\u3002\u6709\u5173\u6b64\u7c7b\u4e8b\u52a1\u91cd\u8bd5\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53c2\u89c1\u201c\u5931\u8d25\u4e0e\u5e8f\u5217\u5316\uff0f\u6b7b\u9501\u91cd\u8bd5\u201d\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PROGRESS-TIMESTAMP\"><span class=\"term\"><code class=\"option\">--progress-timestamp</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u8fdb\u5ea6\uff08\u9009\u9879<code class=\"option\">-P</code>\uff09\u65f6\uff0c\u4f7f\u7528\u65f6\u95f4\u6233\uff08Unix \u7eaa\u5143\uff09\u800c\u4e0d\u662f\u81ea\u8fd0\u884c\u5f00\u59cb\u4ee5\u6765\u7684\u79d2\u6570\u3002\u5355\u4f4d\u4e3a\u79d2\uff0c\u5c0f\u6570\u70b9\u540e\u7cbe\u786e\u5230\u6beb\u79d2\u3002\u8fd9\u6709\u52a9\u4e8e\u6bd4\u8f83\u5404\u79cd\u5de5\u5177\u751f\u6210\u7684\u65e5\u5fd7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-RANDOM-SEED\"><span class=\"term\"><code class=\"option\">--random-seed=</code><em class=\"replaceable\"><code>seed</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u3002\u5b83\u4f1a\u5148\u4e3a\u7cfb\u7edf\u968f\u673a\u6570\u751f\u6210\u5668\u8bbe\u79cd\uff0c\u518d\u751f\u6210\u4e00\u7cfb\u5217\u521d\u59cb\u751f\u6210\u5668\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4e00\u4e2a\u3002<em class=\"replaceable\"><code>seed</code></em>\u7684\u53d6\u503c\u53ef\u4ee5\u662f\uff1a<code class=\"literal\">time</code>\uff08\u9ed8\u8ba4\u503c\uff0c\u79cd\u5b50\u57fa\u4e8e\u5f53\u524d\u65f6\u95f4\uff09\uff0c<code class=\"literal\">rand</code>\uff08\u4f7f\u7528\u5f3a\u968f\u673a\u6e90\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u5219\u5931\u8d25\uff09\uff0c\u6216\u8005\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u968f\u673a\u751f\u6210\u5668\u65e2\u53ef\u4ee5\u5728 pgbench \u811a\u672c\u4e2d\u663e\u5f0f\u8c03\u7528\uff08<code class=\"literal\">random...</code>\u51fd\u6570\uff09\uff0c\u4e5f\u53ef\u4ee5\u9690\u5f0f\u8c03\u7528\uff08\u4f8b\u5982\u9009\u9879 <code class=\"option\">--rate</code>\u7528\u4e8e\u8c03\u5ea6\u4e8b\u52a1\uff09\u3002\u663e\u5f0f\u8bbe\u7f6e\u65f6\uff0c\u5b9e\u9645\u7528\u4e8e\u8bbe\u79cd\u7684\u503c\u4f1a\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002\u4efb\u4f55\u5141\u8bb8\u7684<em class=\"replaceable\"><code>seed</code></em>\u503c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf <code class=\"literal\">PGBENCH_RANDOM_SEED</code>\u63d0\u4f9b\u3002\u4e3a\u786e\u4fdd\u63d0\u4f9b\u7684\u79cd\u5b50\u5f71\u54cd\u6240\u6709\u53ef\u80fd\u7684\u7528\u9014\uff0c\u5c06\u6b64\u9009\u9879\u653e\u5728\u7b2c\u4e00\u4f4d\u6216\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u663e\u5f0f\u8bbe\u7f6e\u79cd\u5b50\u53ef\u4ee5\u5728\u968f\u673a\u6570\u5c42\u9762\u7cbe\u786e\u590d\u73b0\u4e00\u6b21<code class=\"command\">pgbench</code>\u8fd0\u884c\u3002\u7531\u4e8e\u968f\u673a\u72b6\u6001\u6309\u7ebf\u7a0b\u7ba1\u7406\uff0c\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u76f8\u540c\u7684\u8c03\u7528\uff0c\u5982\u679c\u6bcf\u4e2a\u7ebf\u7a0b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u4e14\u4e0d\u5b58\u5728\u5916\u90e8\u4f9d\u8d56\u6216\u6570\u636e\u4f9d\u8d56\uff0c\u90a3\u4e48<code class=\"command\">pgbench</code>\u8fd0\u884c\u53ef\u4ee5\u5b8c\u5168\u4e00\u81f4\u3002\u4ece\u7edf\u8ba1\u89d2\u5ea6\u770b\uff0c\u7cbe\u786e\u590d\u73b0\u5b9e\u9a8c\u5e76\u4e0d\u662f\u597d\u4e3b\u610f\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u63a9\u76d6\u6027\u80fd\u6ce2\u52a8\uff0c\u751a\u81f3\u4e0d\u6070\u5f53\u5730\u63d0\u9ad8\u6027\u80fd\uff0c\u4f8b\u5982\u53cd\u590d\u547d\u4e2d\u4e0e\u524d\u4e00\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u9875\u9762\u3002\u4e0d\u8fc7\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u4e5f\u53ef\u80fd\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u4f8b\u5982\u91cd\u73b0\u4f1a\u89e6\u53d1\u9519\u8bef\u7684\u68d8\u624b\u6848\u4f8b\u3002\u8bf7\u8c28\u614e\u4f7f\u7528\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SAMPLING-RATE\"><span class=\"term\"><code class=\"option\">--sampling-rate=<em class=\"replaceable\"><code>rate</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5199\u5165\u65e5\u5fd7\u65f6\u4f7f\u7528\u7684\u91c7\u6837\u7387\uff0c\u7528\u4e8e\u51cf\u5c11\u751f\u6210\u7684\u65e5\u5fd7\u91cf\u3002\u5982\u679c\u7ed9\u5b9a\u6b64\u9009\u9879\uff0c\u5219\u53ea\u8bb0\u5f55\u6307\u5b9a\u6bd4\u4f8b\u7684\u4e8b\u52a1\u30021.0 \u8868\u793a\u8bb0\u5f55\u5168\u90e8\u4e8b\u52a1\uff0c0.05 \u8868\u793a\u53ea\u8bb0\u5f55 5% \u7684\u4e8b\u52a1\u3002</p>\n<p lang=\"zh\">\u5904\u7406\u65e5\u5fd7\u6587\u4ef6\u65f6\uff0c\u8bb0\u5f97\u628a\u91c7\u6837\u7387\u8003\u8651\u8fdb\u53bb\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97 TPS \u503c\u65f6\uff0c\u9700\u8981\u6309\u91c7\u6837\u7387\u5bf9\u6570\u5b57\u8fdb\u884c\u76f8\u5e94\u6362\u7b97\uff08\u4f8b\u5982\u91c7\u6837\u7387\u4e3a 0.01 \u65f6\uff0c\u53ea\u80fd\u5f97\u5230\u5b9e\u9645 TPS \u7684 1/100\uff09\u3002</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-SHOW-SCRIPT\"><span class=\"term\"><code class=\"option\">--show-script=</code><em class=\"replaceable\"><code>scriptname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5185\u7f6e\u811a\u672c<em class=\"replaceable\"><code>scriptname</code></em>\u7684\u5b9e\u9645\u4ee3\u7801\u8f93\u51fa\u5230 stderr\uff0c\u7136\u540e\u7acb\u5373\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERBOSE-ERRORS\"><span class=\"term\"><code class=\"option\">--verbose-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u5173\u4e8e\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\u7684\u6d88\u606f\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u5bf9\u4e8e\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u7684\u5e45\u5ea6\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8f93\u51fa\u91cf\u53ef\u80fd\u4f1a\u663e\u8457\u589e\u52a0\u3002\uff09\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-COMMON-OPTIONS\">\n<h3 lang=\"zh\">\u516c\u5171\u9009\u9879</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span> \u8fd8\u63a5\u53d7\u4ee5\u4e0b\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u53ca\u5176\u4ed6\u901a\u7528\u8bbe\u7f6e\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370\u8c03\u8bd5\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HOST\"><span class=\"term\"><code class=\"option\">-h</code> <em class=\"replaceable\"><code>hostname</code></em><br/></span><span class=\"term\"><code class=\"option\">--host=</code><em class=\"replaceable\"><code>hostname</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p</code> <em class=\"replaceable\"><code>port</code></em><br/></span><span class=\"term\"><code class=\"option\">--port=</code><em class=\"replaceable\"><code>port</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U</code> <em class=\"replaceable\"><code>login</code></em><br/></span><span class=\"term\"><code class=\"option\">--username=</code><em class=\"replaceable\"><code>login</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">pgbench</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"application\">pgbench</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u6210\u529f\u8fd0\u884c\u65f6\u9000\u51fa\u72b6\u6001\u4e3a 0\u3002\u9000\u51fa\u72b6\u6001 1 \u8868\u793a\u9759\u6001\u95ee\u9898\uff0c\u4f8b\u5982\u65e0\u6548\u7684\u547d\u4ee4\u884c\u9009\u9879\uff0c\u6216\u8005\u672c\u4e0d\u5e94\u53d1\u751f\u7684\u5185\u90e8\u9519\u8bef\u3002\u57fa\u51c6\u6d4b\u8bd5\u542f\u52a8\u9636\u6bb5\u7684\u65e9\u671f\u9519\u8bef\uff0c\u4f8b\u5982\u521d\u59cb\u8fde\u63a5\u5931\u8d25\uff0c\u4e5f\u4f1a\u4ee5\u72b6\u6001 1 \u9000\u51fa\u3002\u8fd0\u884c\u671f\u95f4\u7684\u9519\u8bef\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u9519\u8bef\u6216\u811a\u672c\u95ee\u9898\uff0c\u4f1a\u5bfc\u81f4\u9000\u51fa\u72b6\u6001\u4e3a 2\u3002\u5728\u540e\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u6ca1\u6709\u6307\u5b9a --exit-on-abort \u9009\u9879\uff0cpgbench \u4f1a\u6253\u5370\u90e8\u5206\u7ed3\u679c\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.8\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n<p lang=\"zh\">\u73af\u5883\u53d8\u91cf<code class=\"envar\">PG_COLOR</code>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.11.9\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"refsect2\" id=\"TRANSACTIONS-AND-SCRIPTS\">\n<h3 lang=\"zh\">\u5728<span class=\"application\">pgbench</span>\u4e2d\u5b9e\u9645\u6267\u884c\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u662f\u4ec0\u4e48\uff1f</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u4f1a\u4ece\u6307\u5b9a\u5217\u8868\u4e2d\u968f\u673a\u9009\u53d6\u6d4b\u8bd5\u811a\u672c\u6765\u6267\u884c\u3002\u8fd9\u4e9b\u811a\u672c\u65e2\u53ef\u4ee5\u662f\u7528<code class=\"option\">-b</code>\u6307\u5b9a\u7684\u5185\u7f6e\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u7528<code class=\"option\">-f</code>\u6307\u5b9a\u7684\u7528\u6237\u811a\u672c\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u53ef\u4ee5\u5728\u5176\u540e\u52a0\u4e0a\u4e00\u4e2a\u4ee5<code class=\"literal\">@</code>\u5f15\u51fa\u7684\u76f8\u5bf9\u6743\u91cd\uff0c\u4ee5\u6539\u53d8\u5176\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u9ed8\u8ba4\u6743\u91cd\u4e3a<code class=\"literal\">1</code>\u3002\u6743\u91cd\u4e3a<code class=\"literal\">0</code>\u7684\u811a\u672c\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u7684\u5185\u7f6e\u4e8b\u52a1\u811a\u672c\uff08\u4e5f\u53ef\u901a\u8fc7<code class=\"option\">-b tpcb-like</code>\u8c03\u7528\uff09\u4f1a\u9488\u5bf9\u968f\u673a\u9009\u53d6\u7684<code class=\"literal\">aid</code>\u3001<code class=\"literal\">tid</code>\u3001<code class=\"literal\">bid</code>\u548c<code class=\"literal\">delta</code>\u5728\u6bcf\u4e2a\u4e8b\u52a1\u4e2d\u53d1\u51fa\u4e03\u6761\u547d\u4ee4\u3002\u8be5\u573a\u666f\u53d7 TPC-B \u57fa\u51c6\u542f\u53d1\uff0c\u4f46\u5e76\u4e0d\u662f\u771f\u6b63\u7684 TPC-B\uff0c\u56e0\u6b64\u624d\u53d6\u4e86\u8fd9\u4e2a\u540d\u5b57\u3002</p>\n<div class=\"orderedlist\">\n<ol class=\"orderedlist\">\n<li class=\"listitem\">\n<p><code class=\"literal\">BEGIN;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">SELECT abalance FROM pgbench_accounts WHERE aid = :aid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);</code></p>\n</li>\n<li class=\"listitem\">\n<p><code class=\"literal\">END;</code></p>\n</li>\n</ol>\n</div>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">simple-update</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-N</code>\uff09\uff0c\u4e8b\u52a1\u4e2d\u5c06\u4e0d\u5305\u542b\u7b2c 4 \u6b65\u548c\u7b2c 5 \u6b65\u3002\u8fd9\u4f1a\u907f\u514d\u5728\u8fd9\u4e9b\u8868\u4e0a\u53d1\u751f\u66f4\u65b0\u4e89\u7528\uff0c\u4f46\u4e5f\u4f1a\u8ba9\u8be5\u6d4b\u8bd5\u573a\u666f\u66f4\u4e0d\u50cf TPC-B\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u9009\u62e9<code class=\"literal\">select-only</code>\u5185\u7f6e\u811a\u672c\uff08\u4e5f\u5c31\u662f<code class=\"option\">-S</code>\uff09\uff0c\u5219\u53ea\u6267\u884c<code class=\"command\">SELECT</code>\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.3\">\n<h3 lang=\"zh\">\u81ea\u5b9a\u4e49\u811a\u672c</h3>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u652f\u6301\u81ea\u5b9a\u4e49\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\uff1a\u53ea\u9700\u7528\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7684\u4e8b\u52a1\u811a\u672c\uff08<code class=\"option\">-f</code>\u9009\u9879\uff09\u66ff\u6362\u9ed8\u8ba4\u4e8b\u52a1\u811a\u672c\uff08\u89c1\u4e0a\u6587\uff09\u5373\u53ef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e8b\u52a1</span>\u201d</span>\u5c31\u8868\u793a\u811a\u672c\u6587\u4ef6\u7684\u4e00\u6b21\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4ee5\u5206\u53f7\u7ed3\u675f\u7684 SQL \u547d\u4ee4\u3002\u7a7a\u884c\u4ee5\u53ca\u4ee5<code class=\"literal\">--</code>\u5f00\u5934\u7684\u884c\u4f1a\u88ab\u5ffd\u7565\u3002\u811a\u672c\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5305\u542b<span class=\"quote\">\u201c<span class=\"quote\">\u5143\u547d\u4ee4</span>\u201d</span>\uff0c\u5b83\u4eec\u7531<span class=\"application\">pgbench</span>\u81ea\u8eab\u89e3\u91ca\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728<span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c\u811a\u672c\u6587\u4ef6\u4e2d\u7684 SQL \u547d\u4ee4\u4ee5\u6362\u884c\u7ed3\u675f\uff0c\u56e0\u6b64\u4e0d\u80fd\u8de8\u884c\u3002\u73b0\u5728\u8fde\u7eed SQL \u547d\u4ee4\u4e4b\u95f4<span class=\"emphasis\"><em>\u5fc5\u987b</em></span>\u7528\u5206\u53f7\u5206\u9694\uff08\u5982\u679c SQL \u547d\u4ee4\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u5143\u547d\u4ee4\uff0c\u5219\u4e0d\u9700\u8981\u5206\u53f7\uff09\u3002\u5982\u679c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65e2\u80fd\u5728\u65e7\u7248\u4e5f\u80fd\u5728\u65b0\u7248<span class=\"application\">pgbench</span>\u4e0b\u5de5\u4f5c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u52a1\u5fc5\u5c06\u6bcf\u4e2a SQL \u547d\u4ee4\u5199\u5728\u5355\u72ec\u4e00\u884c\uff0c\u5e76\u4ee5\u5206\u53f7\u7ed3\u675f\u3002</p>\n<p lang=\"zh\">\u5047\u5b9a<span class=\"application\">pgbench</span>\u811a\u672c\u4e0d\u5305\u542b\u4e0d\u5b8c\u6574\u7684 SQL \u4e8b\u52a1\u5757\u3002\u5982\u679c\u5728\u8fd0\u884c\u65f6\u5ba2\u6237\u7aef\u5728\u5c1a\u672a\u5b8c\u6210\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5757\u65f6\u5c31\u5230\u8fbe\u811a\u672c\u672b\u5c3e\uff0c\u8be5\u5ba2\u6237\u7aef\u5c06\u88ab\u4e2d\u6b62\u3002</p>\n</div>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u7684\u53d8\u91cf\u66ff\u6362\u673a\u5236\u3002\u53d8\u91cf\u540d\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5e76\u4e14\u9996\u5b57\u7b26\u4e0d\u80fd\u662f\u6570\u5b57\u3002\u5982\u4e0a\u6240\u8ff0\uff0c\u53d8\u91cf\u53ef\u4ee5\u7528\u547d\u4ee4\u884c<code class=\"option\">-D</code>\u9009\u9879\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e0b\u6587\u4ecb\u7ecd\u7684\u5143\u547d\u4ee4\u8bbe\u7f6e\u3002\u9664\u4e86\u901a\u8fc7<code class=\"option\">-D</code>\u547d\u4ee4\u884c\u9009\u9879\u9884\u5148\u8bbe\u7f6e\u7684\u53d8\u91cf\u4e4b\u5916\uff0c\u8fd8\u6709\u5c11\u91cf\u53d8\u91cf\u4f1a\u88ab\u81ea\u52a8\u9884\u8bbe\uff0c\u5217\u5728<a class=\"xref\" href=\"/docs/18/pgbench.html#PGBENCH-AUTOMATIC-VARIABLES\" title=\"\u8868\u00a0301.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf\">\u8868\u00a0301</a>\u4e2d\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">-D</code>\u4e3a\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a\u503c\uff0c\u5219\u4f1a\u8986\u76d6\u81ea\u52a8\u9884\u8bbe\u503c\u3002\u4e00\u65e6\u8bbe\u7f6e\u597d\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u5728 SQL \u547d\u4ee4\u4e2d\u5199<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u6765\u63d2\u5165\u5176\u503c\u3002\u5f53\u8fd0\u884c\u591a\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u6bcf\u4e2a\u4f1a\u8bdd\u90fd\u6709\u81ea\u5df1\u7684\u53d8\u91cf\u96c6\u5408\u3002<span class=\"application\">pgbench</span>\u5728\u5355\u6761\u8bed\u53e5\u4e2d\u6700\u591a\u652f\u6301 255 \u6b21\u53d8\u91cf\u4f7f\u7528\u3002</p>\n<div class=\"table\" id=\"PGBENCH-AUTOMATIC-VARIABLES\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0301.\u00a0pgbench \u81ea\u52a8\u53d8\u91cf</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th lang=\"zh\">\u53d8\u91cf</th>\n<th lang=\"zh\">\u8bf4\u660e</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"literal\">client_id</code></td>\n<td lang=\"zh\">\u6807\u8bc6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7684\u552f\u4e00\u7f16\u53f7\uff08\u4ece\u96f6\u5f00\u59cb\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">default_seed</code></td>\n<td lang=\"zh\">\u9ed8\u8ba4\u5728 hash \u548c\u4f2a\u968f\u673a\u7f6e\u6362\u51fd\u6570\u4e2d\u4f7f\u7528\u7684\u79cd\u5b50</td>\n</tr>\n<tr>\n<td><code class=\"literal\">random_seed</code></td>\n<td lang=\"zh\">\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\uff08\u9664\u975e\u88ab<code class=\"option\">-D</code>\u8986\u76d6\uff09</td>\n</tr>\n<tr>\n<td><code class=\"literal\">scale</code></td>\n<td lang=\"zh\">\u5f53\u524d\u6bd4\u4f8b\u56e0\u5b50</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\">\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u5143\u547d\u4ee4\u4ee5\u53cd\u659c\u7ebf\uff08<code class=\"literal\">\\</code>\uff09\u5f00\u5934\uff0c\u901a\u5e38\u5ef6\u4f38\u5230\u884c\u5c3e\uff0c\u4e0d\u8fc7\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5199\u53cd\u659c\u7ebf\u6362\u884c\u7ee7\u7eed\u5230\u540e\u7eed\u884c\u3002\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4ee5\u7a7a\u767d\u5206\u9694\u3002\u652f\u6301\u7684\u5143\u547d\u4ee4\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"PGBENCH-METACOMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [<em class=\"replaceable\"><code>prefix</code></em>]</code> <code class=\"literal\">\\aset [<em class=\"replaceable\"><code>prefix</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e9b\u547d\u4ee4\u53ef\u7528\u4e8e\u7ed3\u675f SQL \u67e5\u8be2\uff0c\u4ee5\u4ee3\u66ff\u7ed3\u5c3e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\gset</code>\u547d\u4ee4\u65f6\uff0c\u524d\u9762\u7684 SQL \u67e5\u8be2\u9884\u671f\u8fd4\u56de\u4e00\u884c\uff0c\u5176\u5404\u5217\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"literal\">\\aset</code>\u547d\u4ee4\u65f6\uff0c\u6240\u6709\u7ec4\u5408 SQL \u67e5\u8be2\uff08\u7531<code class=\"literal\">\\;</code>\u5206\u9694\uff09\u7684\u5217\u90fd\u4f1a\u88ab\u5b58\u5165\u4ee5\u5217\u540d\u547d\u540d\u7684\u53d8\u91cf\u4e2d\uff1b\u5982\u679c\u63d0\u4f9b\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u52a0\u4e0a\u8be5\u524d\u7f00\u3002\u5982\u679c\u67e5\u8be2\u4e0d\u8fd4\u56de\u4efb\u4f55\u884c\uff0c\u5219\u4e0d\u4f1a\u8fdb\u884c\u8d4b\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u6765\u68c0\u6d4b\u8fd9\u79cd\u60c5\u51b5\u3002\u5982\u679c\u67e5\u8be2\u8fd4\u56de\u591a\u884c\uff0c\u5219\u4fdd\u7559\u6700\u540e\u4e00\u4e2a\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\gset</code> \u548c <code class=\"literal\">\\aset</code> \u4e0d\u80fd\u7528\u5728\u7ba1\u9053\u6a21\u5f0f\uff0c\u56e0\u4e3a\u5728\u547d\u4ee4\u9700\u8981\u5b83\u4eec\u7684\u65f6\u5019\uff0c\u67e5\u8be2\u7ed3\u679c\u8fd8\u4e0d\u53ef\u7528\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u7684\u793a\u4f8b\u5c06\u7b2c\u4e00\u4e2a\u67e5\u8be2\u4e2d\u7684\u6700\u7ec8\u8d26\u6237\u4f59\u989d\u653e\u5165\u53d8\u91cf<em class=\"replaceable\"><code>abalance</code></em>\uff0c\u5e76\u7528\u7b2c\u4e09\u4e2a\u67e5\u8be2\u4e2d\u7684\u6574\u6570\u586b\u5145\u53d8\u91cf<em class=\"replaceable\"><code>p_two</code></em>\u548c<em class=\"replaceable\"><code>p_three</code></em>\u3002\u7b2c\u4e8c\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002\u6700\u540e\u4e24\u4e2a\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u88ab\u5b58\u5165\u53d8\u91cf<em class=\"replaceable\"><code>four</code></em>\u548c<em class=\"replaceable\"><code>five</code></em>\u3002</p>\n<pre class=\"programlisting\">UPDATE pgbench_accounts\n  SET abalance = abalance + :delta\n  WHERE aid = :aid\n  RETURNING abalance \\gset\n-- compound of two queries\nSELECT 1 \\;\nSELECT 2 AS two, 3 AS three \\gset p_\nSELECT 4 AS four \\; SELECT 5 AS five \\aset\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-IF-ELSE\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e00\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\uff0c\u7c7b\u4f3c\u4e8e<code class=\"literal\">psql</code>\u4e2d\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#PSQL-METACOMMAND-IF\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em></a>\u3002\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0e<code class=\"literal\">\\set</code>\u4e2d\u7684\u8868\u8fbe\u5f0f\u76f8\u540c\uff0c\u975e\u96f6\u503c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u771f\u3002</p>\n</p>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>expression</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a\u6839\u636e<em class=\"replaceable\"><code>expression</code></em>\u8ba1\u7b97\u51fa\u7684\u503c\u3002\u8be5\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b<code class=\"literal\">NULL</code>\u5e38\u91cf\u3001\u5e03\u5c14\u5e38\u91cf<code class=\"literal\">TRUE</code>\u548c<code class=\"literal\">FALSE</code>\u3001<code class=\"literal\">5432</code>\u8fd9\u6837\u7684\u6574\u6570\u5e38\u91cf\u3001<code class=\"literal\">3.14159</code>\u8fd9\u6837\u7684\u53cc\u7cbe\u5ea6\u5e38\u91cf\u3001\u5bf9\u53d8\u91cf\u7684\u5f15\u7528<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3001<a class=\"link\" href=\"/docs/18/pgbench.html#PGBENCH-BUILTIN-OPERATORS\" title=\"\u5185\u7f6e\u64cd\u4f5c\u7b26\">\u64cd\u4f5c\u7b26</a>\uff08\u4fdd\u7559\u5176\u901a\u5e38\u7684 SQL \u4f18\u5148\u7ea7\u548c\u7ed3\u5408\u6027\uff09\u3001<a class=\"link\" href=\"/docs/18/pgbench.html#PGBENCH-BUILTIN-FUNCTIONS\" title=\"\u5185\u7f6e\u51fd\u6570\">\u51fd\u6570\u8c03\u7528</a>\u3001SQL <a class=\"link\" href=\"/docs/18/functions-conditional.html#FUNCTIONS-CASE\" title=\"9.18.1.\u00a0CASE\"><code class=\"token\">CASE</code>\u901a\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f</a>\u4ee5\u53ca\u62ec\u53f7\u3002</p>\n<p lang=\"zh\">\u51fd\u6570\u548c\u5927\u90e8\u5206\u64cd\u4f5c\u7b26\u5728<code class=\"literal\">NULL</code>\u8f93\u5165\u4e0a\u4f1a\u8fd4\u56de<code class=\"literal\">NULL</code>\u3002</p>\n<p lang=\"zh\">\u5c31\u6761\u4ef6\u5224\u65ad\u800c\u8a00\uff0c\u975e\u96f6\u6570\u503c\u4e3a<code class=\"literal\">TRUE</code>\uff0c\u96f6\u503c\u548c<code class=\"literal\">NULL</code>\u4e3a<code class=\"literal\">FALSE</code>\u3002</p>\n<p lang=\"zh\">\u8fc7\u5927\u6216\u8fc7\u5c0f\u7684\u6574\u6570\u548c\u53cc\u7cbe\u5ea6\u5e38\u91cf\uff0c\u4ee5\u53ca\u6574\u6570\u7b97\u672f\u64cd\u4f5c\u7b26\uff08<code class=\"literal\">+</code>\u3001<code class=\"literal\">-</code>\u3001<code class=\"literal\">*</code>\u548c<code class=\"literal\">/</code>\uff09\u90fd\u4f1a\u5728\u6ea2\u51fa\u65f6\u5f15\u53d1\u9519\u8bef\u3002</p>\n<p lang=\"zh\">\u5982\u679c CASE \u6ca1\u6709\u6700\u540e\u7684 ELSE \u5b50\u53e5\uff0c\u5219\u9ed8\u8ba4\u503c\u4e3a NULL\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\set ntellers 10 * :scale\n\\set aid (1021 * random(1, 100000 * :scale)) % \\\n           (100000 * :scale) + 1\n\\set divx CASE WHEN :x &lt;&gt; 0 THEN :y/:x ELSE NULL END\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SLEEP\"><span class=\"term\"><code class=\"literal\">\\sleep <em class=\"replaceable\"><code>number</code></em> [ us | ms | s ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8ba9\u811a\u672c\u6267\u884c\u4f11\u7720\u6307\u5b9a\u65f6\u957f\uff0c\u5355\u4f4d\u53ef\u4ee5\u662f\u5fae\u79d2\uff08<code class=\"literal\">us</code>\uff09\u3001\u6beb\u79d2\uff08<code class=\"literal\">ms</code>\uff09\u6216\u79d2\uff08<code class=\"literal\">s</code>\uff09\u3002\u5982\u679c\u7701\u7565\u5355\u4f4d\uff0c\u5219\u9ed8\u8ba4\u4e3a\u79d2\u3002<em class=\"replaceable\"><code>number</code></em>\u53ef\u4ee5\u662f\u6574\u6570\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u4e86\u6574\u6570\u503c\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\sleep 10 ms\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SETSHELL\"><span class=\"term\"><code class=\"literal\">\\setshell <em class=\"replaceable\"><code>varname</code></em> <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53d8\u91cf<em class=\"replaceable\"><code>varname</code></em>\u8bbe\u7f6e\u4e3a shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>argument</code></em>\u53c2\u6570\u4e0b\u7684\u7ed3\u679c\u3002\u8be5\u547d\u4ee4\u5fc5\u987b\u901a\u8fc7\u6807\u51c6\u8f93\u51fa\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u548c\u6bcf\u4e2a<em class=\"replaceable\"><code>argument</code></em>\u90fd\u53ef\u4ee5\u662f\u6587\u672c\u5e38\u91cf\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f15\u7528\u67d0\u4e2a\u53d8\u91cf\u7684<code class=\"literal\">:</code><em class=\"replaceable\"><code>variablename</code></em>\u3002\u5982\u679c\u8981\u4f7f\u7528\u4ee5\u5192\u53f7\u5f00\u5934\u7684<em class=\"replaceable\"><code>argument</code></em>\uff0c\u8bf7\u5728<em class=\"replaceable\"><code>argument</code></em>\u5f00\u5934\u518d\u5199\u4e00\u4e2a\u5192\u53f7\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-SHELL\"><span class=\"term\"><code class=\"literal\">\\shell <em class=\"replaceable\"><code>command</code></em> [ <em class=\"replaceable\"><code>argument</code></em> ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0e<code class=\"literal\">\\setshell</code>\u76f8\u540c\uff0c\u4f46\u547d\u4ee4\u7ed3\u679c\u4f1a\u88ab\u4e22\u5f03\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\shell command literal_argument :variable ::literal_starting_with_colon\n</pre>\n</dd>\n<dt id=\"PGBENCH-METACOMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\syncpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u7ec4\u547d\u4ee4\u7528\u4e8e\u5b9e\u73b0 SQL \u8bed\u53e5\u7684\u7ba1\u9053\u6267\u884c\u3002\u7ba1\u9053\u5fc5\u987b\u4ee5<code class=\"command\">\\startpipeline</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endpipeline</code>\u7ed3\u675f\uff1b\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u51fa\u73b0\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\syncpipeline</code>\uff0c\u5b83\u4f1a\u53d1\u9001\u4e00\u4e2a<a class=\"link\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3.\u00a0\u6269\u5c55\u67e5\u8be2\">sync \u6d88\u606f</a>\uff0c\u65e2\u4e0d\u4f1a\u7ed3\u675f\u5f53\u524d\u7ba1\u9053\uff0c\u4e5f\u4e0d\u4f1a\u5237\u65b0\u53d1\u9001\u7f13\u51b2\u533a\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u4e00\u6761\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/libpq-pipeline-mode.html\" title=\"32.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a032.5\u00a0\u8282</a>\u3002\u7ba1\u9053\u6a21\u5f0f\u8981\u6c42\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-OPERATORS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u64cd\u4f5c\u7b26</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/18/pgbench.html#PGBENCH-OPERATORS\" title=\"\u8868\u00a0302.\u00a0pgbench \u64cd\u4f5c\u7b26\">\u8868\u00a0302</a>\u4e2d\u5217\u51fa\u7684\u7b97\u672f\u3001\u6309\u4f4d\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u64cd\u4f5c\u7b26\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\u4e2d\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/18/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002\u8fd9\u4e9b\u64cd\u4f5c\u7b26\u6309\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u5217\u51fa\u3002\u9664\u975e\u53e6\u6709\u8bf4\u660e\uff0c\u63a5\u53d7\u4e24\u4e2a\u6570\u5b57\u8f93\u5165\u7684\u64cd\u4f5c\u7b26\u53ea\u8981\u4efb\u4e00\u8f93\u5165\u4e3a\u53cc\u7cbe\u5ea6\uff0c\u5c31\u4f1a\u4ea7\u751f\u53cc\u7cbe\u5ea6\u7ed3\u679c\uff1b\u5426\u5219\u4ea7\u751f\u6574\u6570\u7ed3\u679c\u3002</p>\n<div class=\"table\" id=\"PGBENCH-OPERATORS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0302.\u00a0pgbench \u64cd\u4f5c\u7b26</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u64cd\u4f5c\u7b26</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">OR</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u6216</p>\n<p><code class=\"literal\">5 or 0</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">AND</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u4e0e</p>\n<p><code class=\"literal\">3 and 0</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">NOT</code> <em class=\"replaceable\"><code>boolean</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u903b\u8f91\u975e</p>\n<p><code class=\"literal\">not false</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>boolean</code></em> <code class=\"literal\">IS [NOT] (NULL|TRUE|FALSE)</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5e03\u5c14\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 is null</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>value</code></em> <code class=\"literal\">ISNULL|NOTNULL</code> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7a7a\u503c\u6d4b\u8bd5</p>\n<p><code class=\"literal\">1 notnull</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 = 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;&gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">!=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u4e0d\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 != 5</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e</p>\n<p><code class=\"literal\">5 &lt; 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&lt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5c0f\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &lt;= 4</code> \u2192 <code class=\"returnvalue\">FALSE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e</p>\n<p><code class=\"literal\">5 &gt; 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">&gt;=</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>boolean</code></em></code></p>\n<p>\u5927\u4e8e\u7b49\u4e8e</p>\n<p><code class=\"literal\">5 &gt;= 4</code> \u2192 <code class=\"returnvalue\">TRUE</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">|</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u6216</p>\n<p><code class=\"literal\">1 | 2</code> \u2192 <code class=\"returnvalue\">3</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">#</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5f02\u6216</p>\n<p><code class=\"literal\">1 # 3</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&amp;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u4e0e</p>\n<p><code class=\"literal\">1 &amp; 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">~</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u975e</p>\n<p><code class=\"literal\">~ 1</code> \u2192 <code class=\"returnvalue\">-2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&lt;&lt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u5de6\u79fb</p>\n<p><code class=\"literal\">1 &lt;&lt; 2</code> \u2192 <code class=\"returnvalue\">4</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">&gt;&gt;</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6309\u4f4d\u53f3\u79fb</p>\n<p><code class=\"literal\">8 &gt;&gt; 2</code> \u2192 <code class=\"returnvalue\">2</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">+</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u52a0\u6cd5</p>\n<p><code class=\"literal\">5 + 4</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u51cf\u6cd5</p>\n<p><code class=\"literal\">3 - 2.0</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">*</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u4e58\u6cd5</p>\n<p><code class=\"literal\">5 * 4</code> \u2192 <code class=\"returnvalue\">20</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>number</code></em> <code class=\"literal\">/</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u9664\u6cd5\uff08\u5982\u679c\u4e24\u4e2a\u8f93\u5165\u90fd\u662f\u6574\u6570\uff0c\u5219\u5c06\u7ed3\u679c\u5411\u96f6\u622a\u65ad\uff09</p>\n<p><code class=\"literal\">5 / 3</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><em class=\"replaceable\"><code>integer</code></em> <code class=\"literal\">%</code> <em class=\"replaceable\"><code>integer</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>integer</code></em></code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">3 % 2</code> \u2192 <code class=\"returnvalue\">1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"literal\">-</code> <em class=\"replaceable\"><code>number</code></em> \u2192 <code class=\"returnvalue\"><em class=\"replaceable\"><code>number</code></em></code></p>\n<p>\u53d6\u76f8\u53cd\u6570</p>\n<p><code class=\"literal\">- 2.0</code> \u2192 <code class=\"returnvalue\">-2.0</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n</div>\n<div class=\"refsect2\" id=\"PGBENCH-BUILTIN-FUNCTIONS\">\n<h3 lang=\"zh\">\u5185\u7f6e\u51fd\u6570</h3>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/18/pgbench.html#PGBENCH-FUNCTIONS\" title=\"\u8868\u00a0303.\u00a0pgbench \u51fd\u6570\">\u8868\u00a0303</a>\u4e2d\u5217\u51fa\u7684\u51fd\u6570\u90fd\u5185\u7f6e\u4e8e<span class=\"application\">pgbench</span>\uff0c\u53ef\u7528\u4e8e<a class=\"link\" href=\"/docs/18/pgbench.html#PGBENCH-METACOMMAND-SET\"><code class=\"literal\">\\set</code></a>\u4e2d\u7684\u8868\u8fbe\u5f0f\u3002</p>\n<div class=\"table\" id=\"PGBENCH-FUNCTIONS\">\n<p class=\"title\" lang=\"zh\"><strong>\u8868\u00a0303.\u00a0pgbench \u51fd\u6570</strong></p>\n<div class=\"table-contents\">\n<table class=\"table\">\n<thead>\n<tr>\n<th class=\"func_table_entry\" lang=\"zh\">\n<tr>\n<th class=\"func_table_entry\">\n<p class=\"func_signature\">\u51fd\u6570</p>\n<p>\u63cf\u8ff0</p>\n<p>\u793a\u4f8b</p>\n</th>\n</tr>\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">abs</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u7edd\u5bf9\u503c</p>\n<p><code class=\"literal\">abs(-17)</code> \u2192 <code class=\"returnvalue\">17</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">debug</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 \u4e0e\u8f93\u5165\u7c7b\u578b\u76f8\u540c</p>\n<p>\u5c06\u53c2\u6570\u6253\u5370\u5230<span class=\"systemitem\">stderr</span>\uff0c\u5e76\u8fd4\u56de\u53c2\u6570\u3002</p>\n<p><code class=\"literal\">debug(5432.1)</code> \u2192 <code class=\"returnvalue\">5432.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">double</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u8f6c\u6362\u4e3a double\u3002</p>\n<p><code class=\"literal\">double(5432)</code> \u2192 <code class=\"returnvalue\">5432.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">exp</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u6307\u6570\u51fd\u6570\uff08<code class=\"literal\">e</code> \u7684\u7ed9\u5b9a\u6b21\u5e42\uff09</p>\n<p><code class=\"literal\">exp(1.0)</code> \u2192 <code class=\"returnvalue\">2.718281828459045</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">greatest</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5927\u503c\u3002</p>\n<p><code class=\"literal\">greatest(5, 4, 3, 2)</code> \u2192 <code class=\"returnvalue\">5</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8fd9\u662f <code class=\"function\">hash_murmur2</code> \u7684\u522b\u540d\u3002</p>\n<p><code class=\"literal\">hash(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_fnv1a</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\" target=\"_top\">FNV-1a hash</a>\u3002</p>\n<p><code class=\"literal\">hash_fnv1a(10, 5432)</code> \u2192 <code class=\"returnvalue\">-7793829335365542153</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">hash_murmur2</code> ( <em class=\"parameter\"><code>value</code></em> [<span class=\"optional\">, <em class=\"parameter\"><code>seed</code></em></span> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8ba1\u7b97 <a class=\"ulink\" href=\"https://en.wikipedia.org/wiki/MurmurHash\" target=\"_top\">MurmurHash2 hash</a>\u3002</p>\n<p><code class=\"literal\">hash_murmur2(10, 5432)</code> \u2192 <code class=\"returnvalue\">-5817877081768721676</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">int</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u8f6c\u6362\u4e3a integer\u3002</p>\n<p><code class=\"literal\">int(5.4 + 3.8)</code> \u2192 <code class=\"returnvalue\">9</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">least</code> ( <em class=\"replaceable\"><code>number</code></em> [<span class=\"optional\">, <code class=\"literal\">...</code></span> ] ) \u2192 \u82e5\u4efb\u4e00\u53c2\u6570\u4e3a double\uff0c\u5219\u4e3a <code class=\"type\">double</code>\uff0c\u5426\u5219\u4e3a <code class=\"type\">integer</code></p>\n<p>\u9009\u62e9\u53c2\u6570\u4e2d\u7684\u6700\u5c0f\u503c\u3002</p>\n<p><code class=\"literal\">least(5, 4, 3, 2.1)</code> \u2192 <code class=\"returnvalue\">2.1</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">ln</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u81ea\u7136\u5bf9\u6570</p>\n<p><code class=\"literal\">ln(2.718281828459045)</code> \u2192 <code class=\"returnvalue\">1.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">mod</code> ( <em class=\"replaceable\"><code>integer</code></em>, <em class=\"replaceable\"><code>integer</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p>\u6a21\uff08\u4f59\u6570\uff09</p>\n<p><code class=\"literal\">mod(54, 32)</code> \u2192 <code class=\"returnvalue\">22</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">permute</code> ( <em class=\"parameter\"><code>i</code></em>, <em class=\"parameter\"><code>size</code></em> [, <em class=\"parameter\"><code>seed</code></em> ] ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\"><em class=\"parameter\"><code>i</code></em>\u7684\u7f6e\u6362\u503c\uff0c\u8303\u56f4\u5728<code class=\"literal\">[0, size)</code>\u5185\u3002\u5b83\u8868\u793a<em class=\"parameter\"><code>i</code></em>\uff08\u6a21<em class=\"parameter\"><code>size</code></em>\uff09\u5728\u6574\u6570<code class=\"literal\">0...size-1</code>\u7684\u4f2a\u968f\u673a\u7f6e\u6362\u4e2d\u7684\u65b0\u4f4d\u7f6e\uff1b\u8be5\u7f6e\u6362\u7531<em class=\"parameter\"><code>seed</code></em>\u53c2\u6570\u5316\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">permute(0, 4)</code> \u2192 <code class=\"returnvalue\">an integer between 0 and 3</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pi</code> () \u2192 <code class=\"returnvalue\">double</code></p>\n<p><span class=\"symbol_font\">\u03c0</span>\u7684\u8fd1\u4f3c\u503c</p>\n<p><code class=\"literal\">pi()</code> \u2192 <code class=\"returnvalue\">3.14159265358979323846</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">pow</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p class=\"func_signature\"><code class=\"function\">power</code> ( <em class=\"parameter\"><code>x</code></em>, <em class=\"parameter\"><code>y</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p><em class=\"parameter\"><code>x</code></em> \u7684 <em class=\"parameter\"><code>y</code></em> \u6b21\u5e42</p>\n<p><code class=\"literal\">pow(2.0, 10)</code> \u2192 <code class=\"returnvalue\">1024.0</code></p>\n</td>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u5747\u5300\u5206\u5e03\u968f\u673a\u6574\u6570\u3002</p>\n<p><code class=\"literal\">random(1, 10)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_exponential</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u6307\u6570\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_exponential(1, 10, 3.0)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_gaussian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684\u9ad8\u65af\u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_gaussian(1, 10, 2.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">random_zipfian</code> ( <em class=\"parameter\"><code>lb</code></em>, <em class=\"parameter\"><code>ub</code></em>, <em class=\"parameter\"><code>parameter</code></em> ) \u2192 <code class=\"returnvalue\">integer</code></p>\n<p lang=\"zh\">\u8ba1\u7b97<code class=\"literal\">[lb, ub]</code>\u4e2d\u7684 Zipfian \u5206\u5e03\u968f\u673a\u6574\u6570\uff0c\u8be6\u89c1\u4e0b\u6587\u3002</p>\n<p><code class=\"literal\">random_zipfian(1, 10, 1.5)</code> \u2192 <code class=\"returnvalue\">an integer between 1 and 10</code></p>\n</td>\n</tr>\n<tr>\n<td class=\"func_table_entry\" lang=\"zh\">\n<td class=\"func_table_entry\">\n<p class=\"func_signature\"><code class=\"function\">sqrt</code> ( <em class=\"replaceable\"><code>number</code></em> ) \u2192 <code class=\"returnvalue\">double</code></p>\n<p>\u5e73\u65b9\u6839</p>\n<p><code class=\"literal\">sqrt(2.0)</code> \u2192 <code class=\"returnvalue\">1.414213562</code></p>\n</td>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div><br class=\"table-break\"/>\n<p lang=\"zh\"><code class=\"literal\">random</code>\u51fd\u6570\u4f7f\u7528\u5747\u5300\u5206\u5e03\u751f\u6210\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u8303\u56f4\u5185\u7684\u6240\u6709\u503c\u90fd\u4ee5\u76f8\u540c\u6982\u7387\u88ab\u62bd\u53d6\u3002<code class=\"literal\">random_exponential</code>\u3001<code class=\"literal\">random_gaussian</code>\u548c<code class=\"literal\">random_zipfian</code>\u51fd\u6570\u5219\u9700\u8981\u989d\u5916\u63d0\u4f9b\u4e00\u4e2a double \u53c2\u6570\uff0c\u7528\u6765\u786e\u5b9a\u5206\u5e03\u7684\u7cbe\u786e\u5f62\u72b6\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u6307\u6570\u5206\u5e03\uff0c<em class=\"replaceable\"><code>parameter</code></em>\u901a\u8fc7\u5728<em class=\"replaceable\"><code>parameter</code></em>\u5904\u622a\u65ad\u4e00\u4e2a\u5feb\u901f\u8870\u51cf\u7684\u6307\u6570\u5206\u5e03\uff0c\u518d\u5c06\u5176\u6295\u5f71\u5230\u8fb9\u754c\u4e4b\u95f4\u7684\u6574\u6570\u4e0a\uff0c\u4ece\u800c\u63a7\u5236\u5206\u5e03\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u4ee4</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0exp(-parameter\u00a0*\u00a0(x\u00a0-\u00a0min)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/\u00a0(1\u00a0-\u00a0exp(-parameter))<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i) - f(i + 1) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002</p>\n<p lang=\"zh\">\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u8bbf\u95ee\u63a5\u8fd1 min \u7684\u503c\uff0c\u800c\u8d8a\u5c11\u8bbf\u95ee\u63a5\u8fd1 max \u7684\u503c\u3002parameter \u8d8a\u63a5\u8fd1 0\uff0c\u8bbf\u95ee\u5206\u5e03\u5c31\u8d8a\u5e73\u5766\uff08\u66f4\u5747\u5300\uff09\u3002\u5bf9\u6b64\u5206\u5e03\u7684\u7c97\u7565\u8fd1\u4f3c\u662f\uff1a\u8303\u56f4\u5185\u6700\u5e38\u8bbf\u95ee\u3001\u63a5\u8fd1 min \u7684 1% \u7684\u503c\uff0c\u5360 parameter% \u7684\u62bd\u53d6\u6b21\u6570\u3002parameter \u5fc5\u987b\u4e25\u683c\u4e3a\u6b63\u503c\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">\u5bf9\u4e8e\u9ad8\u65af\u5206\u5e03\uff0c\u8be5\u533a\u95f4\u4f1a\u6620\u5c04\u5230\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03\uff08\u7ecf\u5178\u949f\u5f62\u9ad8\u65af\u66f2\u7ebf\uff09\uff0c\u5e76\u5728\u5de6\u4fa7<code class=\"literal\">-parameter</code>\u548c\u53f3\u4fa7<code class=\"literal\">+parameter</code>\u5904\u622a\u65ad\u3002\u533a\u95f4\u4e2d\u90e8\u7684\u503c\u66f4\u5bb9\u6613\u88ab\u62bd\u5230\u3002\u51c6\u786e\u5730\u8bf4\uff0c\u5982\u679c<code class=\"literal\">PHI(x)</code>\u662f\u6807\u51c6\u6b63\u6001\u5206\u5e03\u7684\u7d2f\u79ef\u5206\u5e03\u51fd\u6570\uff0c\u5747\u503c<code class=\"literal\">mu</code>\u5b9a\u4e49\u4e3a<code class=\"literal\">(max + min) / 2.0</code>\uff0c\u5219\u6709</p>\n<div class=\"literallayout\">\n<p><br/>\n              f(x)\u00a0=\u00a0PHI(2.0\u00a0*\u00a0parameter\u00a0*\u00a0(x\u00a0-\u00a0mu)\u00a0/\u00a0(max\u00a0-\u00a0min\u00a0+\u00a01))\u00a0/<br/>\n              \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(2.0\u00a0*\u00a0PHI(parameter)\u00a0-\u00a01)<br/></p>\n</div>\n<p lang=\"zh\">\u7136\u540e\uff0c\u4ee5 f(i + 0.5) - f(i - 0.5) \u7684\u6982\u7387\u62bd\u53d6 min \u5230 max \u8303\u56f4\u5185\uff08\u542b\u4e24\u7aef\uff09\u7684\u503c i\u3002\u76f4\u89c2\u5730\u8bf4\uff0cparameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u4e2d\u90e8\u7684\u503c\uff0c\u800c\u8d8a\u5c11\u62bd\u53d6\u63a5\u8fd1 min \u548c max \u8fb9\u754c\u7684\u503c\u3002\u5927\u7ea6 67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684 1.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 0.5 / parameter \u7684\u8303\u56f4\uff1b95% \u7684\u503c\u53d6\u81ea\u4e2d\u90e8\u7684 2.0 / parameter \u90e8\u5206\uff0c\u5373\u5747\u503c\u4e24\u4fa7\u5404\u5360\u76f8\u5bf9\u5bbd\u5ea6 1.0 / parameter \u7684\u8303\u56f4\u3002\u4f8b\u5982\uff0cparameter \u4e3a 4.0 \u65f6\uff0c67% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u56db\u5206\u4e4b\u4e00\uff081.0 / 4.0\uff09\uff0c\u5373\u4ece 3.0 / 8.0 \u5230 5.0 / 8.0\uff1b95% \u7684\u503c\u53d6\u81ea\u533a\u95f4\u4e2d\u90e8\u7684\u4e00\u534a\uff082.0 / 4.0\uff09\uff0c\u5373\u7b2c\u4e8c\u548c\u7b2c\u4e09\u56db\u5206\u4f4d\u533a\u95f4\u3002parameter \u5141\u8bb8\u7684\u6700\u5c0f\u503c\u4e3a 2.0\u3002</p>\n</li>\n<li class=\"listitem\">\n<p lang=\"zh\">random_zipfian \u751f\u6210\u6709\u754c\u9f50\u666e\u592b\u5206\u5e03\u3002parameter \u5b9a\u4e49\u5206\u5e03\u7684\u504f\u659c\u7a0b\u5ea6\u3002parameter \u8d8a\u5927\uff0c\u8d8a\u9891\u7e41\u5730\u62bd\u53d6\u63a5\u8fd1\u533a\u95f4\u8d77\u70b9\u7684\u503c\u3002\u6b64\u5206\u5e03\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\uff1a\u5047\u8bbe\u8303\u56f4\u4ece 1 \u5f00\u59cb\uff0c\u62bd\u53d6 k \u4e0e\u62bd\u53d6 k+1 \u7684\u6982\u7387\u4e4b\u6bd4\u4e3a ((k+1)/k)**parameter\u3002\u4f8b\u5982\uff0crandom_zipfian(1, ..., 2.5) \u751f\u6210\u503c 1 \u7684\u9891\u7387\u7ea6\u4e3a\u751f\u6210\u503c 2 \u7684 (2/1)**2.5 = 5.66 \u500d\uff0c\u800c\u540e\u8005\u7684\u751f\u6210\u9891\u7387\u53c8\u7ea6\u4e3a\u751f\u6210\u503c 3 \u7684 (3/2)**2.5 = 2.76 \u500d\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002</p>\n<p lang=\"zh\">pgbench \u7684\u5b9e\u73b0\u57fa\u4e8e Luc Devroye \u7684\u300aNon-Uniform Random Variate Generation\u300b\uff0c\u7b2c 550\u2013551 \u9875\uff0cSpringer\uff0c1986 \u5e74\u3002\u7531\u4e8e\u8be5\u7b97\u6cd5\u7684\u9650\u5236\uff0cparameter \u7684\u53d6\u503c\u9650\u5236\u5728 [1.001, 1000] \u8303\u56f4\u5185\u3002</p>\n</li>\n</ul>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u8bbe\u8ba1\u4ee5\u975e\u5747\u5300\u65b9\u5f0f\u9009\u62e9\u884c\u7684\u57fa\u51c6\u6d4b\u8bd5\u65f6\uff0c\u8981\u6ce8\u610f\u88ab\u9009\u4e2d\u7684\u884c\u53ef\u80fd\u4e0e\u5176\u4ed6\u6570\u636e\u76f8\u5173\uff0c\u4f8b\u5982\u4e0e\u5e8f\u5217\u751f\u6210\u7684 ID \u6216\u7269\u7406\u884c\u987a\u5e8f\u76f8\u5173\uff0c\u8fd9\u53ef\u80fd\u4f1a\u626d\u66f2\u6027\u80fd\u6d4b\u91cf\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u4e3a\u907f\u514d\u8fd9\u4e00\u70b9\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"function\">permute</code>\u51fd\u6570\uff0c\u6216\u91c7\u7528\u5176\u4ed6\u5177\u6709\u7c7b\u4f3c\u6548\u679c\u7684\u989d\u5916\u6b65\u9aa4\uff0c\u5bf9\u9009\u4e2d\u7684\u884c\u8fdb\u884c\u6253\u4e71\u5e76\u79fb\u9664\u6b64\u7c7b\u76f8\u5173\u6027\u3002</p>\n</div>\n<p lang=\"zh\">Hash \u51fd\u6570<code class=\"literal\">hash</code>\u3001<code class=\"literal\">hash_murmur2</code>\u548c<code class=\"literal\">hash_fnv1a</code>\u90fd\u63a5\u53d7\u4e00\u4e2a\u8f93\u5165\u503c\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\u79cd\u5b50\uff0c\u5219\u4f1a\u4f7f\u7528<code class=\"literal\">:default_seed</code>\u7684\u503c\uff1b\u9664\u975e\u901a\u8fc7\u547d\u4ee4\u884c<code class=\"literal\">-D</code>\u9009\u9879\u8986\u76d6\uff0c\u5426\u5219\u8be5\u503c\u4f1a\u88ab\u968f\u673a\u521d\u59cb\u5316\u3002</p>\n<p lang=\"zh\">permute \u63a5\u53d7\u8f93\u5165\u503c\u3001\u5927\u5c0f\u548c\u53ef\u9009\u7684\u79cd\u5b50\u53c2\u6570\u3002\u5b83\u5728 [0, size) \u8303\u56f4\u5185\u751f\u6210\u6574\u6570\u7684\u4f2a\u968f\u673a\u6392\u5217\uff0c\u5e76\u8fd4\u56de\u8f93\u5165\u503c\u5728\u6392\u5217\u4e2d\u7684\u7d22\u5f15\u3002\u6240\u9009\u6392\u5217\u7531\u79cd\u5b50\u51b3\u5b9a\uff0c\u672a\u6307\u5b9a\u79cd\u5b50\u65f6\u9ed8\u8ba4\u4f7f\u7528 :default_seed\u3002\u4e0e\u54c8\u5e0c\u51fd\u6570\u4e0d\u540c\uff0cpermute \u4fdd\u8bc1\u8f93\u51fa\u503c\u65e2\u65e0\u51b2\u7a81\u4e5f\u65e0\u7a7a\u7f3a\u3002\u533a\u95f4\u5916\u7684\u8f93\u5165\u503c\u4f1a\u5bf9 size \u53d6\u6a21\u3002\u5982\u679c size \u4e0d\u662f\u6b63\u6570\uff0c\u51fd\u6570\u4f1a\u62a5\u9519\u3002permute \u53ef\u7528\u4e8e\u6253\u6563 random_zipfian \u6216 random_exponential \u7b49\u975e\u5747\u5300\u968f\u673a\u51fd\u6570\u7684\u5206\u5e03\uff0c\u4f7f\u66f4\u9891\u7e41\u62bd\u53d6\u7684\u503c\u4e0d\u4f1a\u5b58\u5728\u7b80\u5355\u7684\u5173\u8054\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b pgbench \u811a\u672c\u6a21\u62df\u4e86\u793e\u4ea4\u5a92\u4f53\u548c\u535a\u5ba2\u5e73\u53f0\u4e0a\u53ef\u80fd\u51fa\u73b0\u7684\u4e00\u7c7b\u5178\u578b\u5b9e\u9645\u8d1f\u8f7d\uff1a\u5c11\u6570\u8d26\u6237\u4ea7\u751f\u8fc7\u91cf\u8d1f\u8f7d\u3002</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, :size, 1.07)\n\\set k 1 + permute(:r, :size)\n</pre>\n<p lang=\"zh\">\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u82e5\u5e72\u5f7c\u6b64\u4e0d\u76f8\u5173\u7684\u4e0d\u540c\u5206\u5e03\uff0c\u8fd9\u65f6\u53ef\u9009\u79cd\u5b50\u53c2\u6570\u5c31\u5f88\u6709\u7528\uff1a</p>\n<pre class=\"programlisting\">\\set k1 1 + permute(:r, :size, :default_seed + 123)\n\\set k2 1 + permute(:r, :size, :default_seed + 321)\n</pre>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u7528<code class=\"function\">hash</code>\u8fd1\u4f3c\u5b9e\u73b0\u7c7b\u4f3c\u7684\u884c\u4e3a\uff1a</p>\n<pre class=\"programlisting\">\\set size 1000000\n\\set r random_zipfian(1, 100 * :size, 1.07)\n\\set k 1 + abs(hash(:r)) % :size\n</pre>\n<p lang=\"zh\">\u4f46\u662f\uff0c\u7531\u4e8e<code class=\"function\">hash</code>\u4f1a\u4ea7\u751f\u51b2\u7a81\uff0c\u6709\u4e9b\u503c\u5c06\u6c38\u8fdc\u4e0d\u53ef\u8fbe\uff0c\u800c\u53e6\u4e00\u4e9b\u503c\u5219\u4f1a\u6bd4\u539f\u59cb\u5206\u5e03\u6240\u9884\u671f\u7684\u66f4\u5e38\u51fa\u73b0\u3002</p>\n<p lang=\"zh\">\u4f5c\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff0c\u5185\u7f6e\u7684\u7c7b TPC-B \u4e8b\u52a1\u7684\u5168\u90e8\u5b9a\u4e49\u662f\uff1a</p>\n<pre class=\"programlisting\">\\set aid random(1, 100000 * :scale)\n\\set bid random(1, 1 * :scale)\n\\set tid random(1, 10 * :scale)\n\\set delta random(-5000, 5000)\nBEGIN;\nUPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\nSELECT abalance FROM pgbench_accounts WHERE aid = :aid;\nUPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\nUPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\nINSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\nEND;\n</pre>\n<p lang=\"zh\">\u8be5\u811a\u672c\u5141\u8bb8\u4e8b\u52a1\u7684\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5f15\u7528\u4e0d\u540c\u7684\u968f\u673a\u9009\u4e2d\u884c\u3002\uff08\u8fd9\u4e2a\u793a\u4f8b\u4e5f\u8bf4\u660e\u4e86\u4e3a\u4ec0\u4e48\u6bcf\u4e2a\u5ba2\u6237\u7aef\u4f1a\u8bdd\u90fd\u5fc5\u987b\u62e5\u6709\u81ea\u5df1\u7684\u53d8\u91cf \u2014 \u5426\u5219\u5b83\u4eec\u5c31\u65e0\u6cd5\u5f7c\u6b64\u72ec\u7acb\u5730\u8bbf\u95ee\u4e0d\u540c\u7684\u884c\u3002\uff09</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.6\">\n<h3 lang=\"zh\">\u9010\u4e8b\u52a1\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528 -l \u9009\u9879\uff08\u4f46\u4e0d\u4f7f\u7528 --aggregate-interval\uff09\u65f6\uff0cpgbench \u4f1a\u5c06\u6bcf\u4e2a\u4e8b\u52a1\u7684\u4fe1\u606f\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u3002\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn\uff0c\u5176\u4e2d prefix \u9ed8\u8ba4\u4e3a pgbench_log\uff0cnnn \u662f pgbench \u8fdb\u7a0b\u7684 PID\u3002\u53ef\u4ee5\u901a\u8fc7 --log-prefix \u9009\u9879\u4fee\u6539\u524d\u7f00\u3002\u5982\u679c -j \u9009\u9879\u4e3a 2 \u6216\u66f4\u5927\uff0c\u5373\u5b58\u5728\u591a\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u547d\u540d\u4e0e\u901a\u5e38\u7684\u5355\u5de5\u4f5c\u7ebf\u7a0b\u60c5\u51b5\u76f8\u540c\u3002\u5176\u4f59\u5de5\u4f5c\u7ebf\u7a0b\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u4e3a prefix.nnn.mmm\uff0c\u5176\u4e2d mmm \u662f\u4ece 1 \u5f00\u59cb\u7684\u5de5\u4f5c\u7ebf\u7a0b\u5e8f\u53f7\u3002</p>\n<p lang=\"zh\">\u65e5\u5fd7\u6587\u4ef6\u7684\u6bcf\u4e00\u884c\u63cf\u8ff0\u4e00\u4e2a\u4e8b\u52a1\u3002\u5b83\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>client_id</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8fd0\u884c\u4e8b\u52a1\u7684\u5ba2\u6237\u7aef\u4f1a\u8bdd</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>transaction_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edf\u8ba1\u8be5\u4f1a\u8bdd\u5df2\u6267\u884c\u7684\u4e8b\u52a1\u6570\u91cf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u8017\u65f6\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>script_no</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6807\u8bc6\u8be5\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\u6587\u4ef6\uff08\u5f53\u901a\u8fc7<code class=\"option\">-f</code>\u6216<code class=\"option\">-b</code>\u6307\u5b9a\u591a\u4e2a\u811a\u672c\u65f6\u5f88\u6709\u7528\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_epoch</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>time_us</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5b8c\u6210\u65f6\u95f4\u7684\u5c0f\u6570\u79d2\u90e8\u5206\uff0c\u4ee5\u5fae\u79d2\u4e3a\u5355\u4f4d</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>schedule_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff0c\u5373\u4e8b\u52a1\u8ba1\u5212\u5f00\u59cb\u65f6\u95f4\u4e0e\u5b9e\u9645\u5f00\u59cb\u65f6\u95f4\u4e4b\u95f4\u7684\u5dee\u503c\uff0c\u5355\u4f4d\u4e3a\u5fae\u79d2\uff08\u4ec5\u5728\u6307\u5b9a<code class=\"option\">--rate</code>\u65f6\u51fa\u73b0\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4e8b\u52a1\u6267\u884c\u671f\u95f4\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08\u4ec5\u5f53 --max-tries \u4e0d\u7b49\u4e8e\u4e00\u65f6\u51fa\u73b0\uff09</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5f53\u540c\u65f6\u4f7f\u7528<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\u65f6\uff0c\u8df3\u8fc7\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">skipped</code>\u3002\u5982\u679c\u4e8b\u52a1\u4ee5\u5931\u8d25\u7ed3\u675f\uff0c\u5176<em class=\"replaceable\"><code>time</code></em>\u5c06\u88ab\u62a5\u544a\u4e3a<code class=\"literal\">failed</code>\u3002\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u4e8b\u52a1\u7684<em class=\"replaceable\"><code>time</code></em>\u4f1a\u6839\u636e\u5931\u8d25\u7c7b\u578b\u62a5\u544a\u4e3a<code class=\"literal\">serialization</code>\u6216<code class=\"literal\">deadlock</code>\uff08\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\uff09\u3002</p>\n<p lang=\"zh\">\u8fd9\u91cc\u662f\u5728\u5355\u4e2a\u5ba2\u6237\u7aef\u8fd0\u884c\u4e2d\u751f\u6210\u7684\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7684\u7247\u6bb5\uff1a</p>\n<pre class=\"screen\">0 199 2241 0 1175850568 995598\n0 200 2465 0 1175850568 998079\n0 201 2513 0 1175850569 608\n0 202 2038 0 1175850569 2663\n</pre>\n<p lang=\"zh\">\u53e6\u4e00\u4e2a\u793a\u4f8b\u4f7f\u7528\u7684\u662f<code class=\"literal\">--rate=100</code>\u4ee5\u53ca<code class=\"literal\">--latency-limit=5</code>\uff08\u6ce8\u610f\u989d\u5916\u7684 <em class=\"replaceable\"><code>schedule_lag</code></em>\u5217\uff09\uff1a</p>\n<pre class=\"screen\">0 81 4621 0 1412881037 912698 3005\n0 82 6173 0 1412881037 914578 4304\n0 83 skipped 0 1412881037 914578 5217\n0 83 skipped 0 1412881037 914578 5099\n0 83 4722 0 1412881037 916203 3108\n0 84 4142 0 1412881037 918023 2333\n0 85 2465 0 1412881037 919759 740\n</pre>\n<p lang=\"zh\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e8b\u52a1 82 \u8fdf\u5230\u4e86\uff0c\u56e0\u4e3a\u5b83\u7684\u5ef6\u8fdf\uff086.173 ms\uff09\u8d85\u8fc7\u4e86 5 ms \u9650\u5236\u3002\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u4e8b\u52a1\u88ab\u8df3\u8fc7\uff0c\u56e0\u4e3a\u5b83\u4eec\u5728\u5f00\u59cb\u4e4b\u524d\u5c31\u5df2\u7ecf\u8fdf\u5230\u4e86\u3002</p>\n<p lang=\"zh\">\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5305\u542b\u5931\u8d25\u4e0e\u91cd\u8bd5\u7684\u65e5\u5fd7\u7247\u6bb5\uff0c\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u8bbe\u4e3a 10\uff08\u6ce8\u610f\u989d\u5916\u7684 retries \u5217\uff09\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 failed 0 1499414498 84905 9\n2 0 failed 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\uff0c\u5931\u8d25\u7684\u7c7b\u578b\u5c06\u5728<em class=\"replaceable\"><code>time</code></em>\u4e2d\u62a5\u544a\uff0c\u5982\u4e0b\u6240\u793a\uff1a</p>\n<pre class=\"screen\">3 0 47423 0 1499414498 34501 3\n3 1 8333 0 1499414498 42848 0\n3 2 8358 0 1499414498 51219 0\n4 0 72345 0 1499414498 59433 6\n1 3 41718 0 1499414498 67879 4\n1 4 8416 0 1499414498 76311 0\n3 3 33235 0 1499414498 84469 3\n0 0 serialization 0 1499414498 84905 9\n2 0 serialization 0 1499414498 86248 9\n3 4 8307 0 1499414498 92788 0\n</pre>\n<p lang=\"zh\">\u5728\u80fd\u591f\u5904\u7406\u5927\u91cf\u4e8b\u52a1\u7684\u786c\u4ef6\u4e0a\u8fd0\u884c\u957f\u65f6\u95f4\u6d4b\u8bd5\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u53d8\u5f97\u975e\u5e38\u5927\u3002\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--sampling-rate</code>\u9009\u9879\uff0c\u4ec5\u8bb0\u5f55\u4e8b\u52a1\u7684\u968f\u673a\u6837\u672c\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.7\">\n<h3 lang=\"zh\">\u805a\u5408\u65e5\u5fd7\u8bb0\u5f55</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--aggregate-interval</code>\u9009\u9879\u65f6\uff0c\u65e5\u5fd7\u6587\u4ef6\u4f1a\u91c7\u7528\u4e0d\u540c\u7684\u683c\u5f0f\u3002\u6bcf\u4e00\u884c\u65e5\u5fd7\u63cf\u8ff0\u4e00\u4e2a\u805a\u5408\u65f6\u95f4\u95f4\u9694\uff0c\u5305\u542b\u4ee5\u4e0b\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5b57\u6bb5\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>interval_start</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u7684\u8d77\u59cb\u65f6\u95f4\uff0c\u4ee5 Unix \u7eaa\u5143\u65f6\u95f4\u6233\u8868\u793a</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>num_transactions</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8be5\u65f6\u95f4\u95f4\u9694\u5185\u7684\u4e8b\u52a1\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u603b\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_latency_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_latency</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5ef6\u8fdf</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u603b\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>sum_lag_2</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\u7684\u5e73\u65b9\u548c\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>min_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5c0f\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>max_lag</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u5927\u4e8b\u52a1\u5f00\u59cb\u5ef6\u8fdf\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>skipped</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56e0\u4e3a\u542f\u52a8\u65f6\u95f4\u4f1a\u592a\u665a\u800c\u88ab\u8df3\u8fc7\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--rate</code>\u548c<code class=\"option\">--latency-limit</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retried</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>retries</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u7684\u91cd\u8bd5\u6b21\u6570\uff08--max-tries \u7b49\u4e8e\u4e00\u65f6\u4e3a\u96f6\uff09</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>serialization_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u4e32\u884c\u5316\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><em class=\"replaceable\"><code>deadlock_failures</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u53d1\u751f\u6b7b\u9501\u9519\u8bef\u4e14\u5176\u540e\u672a\u518d\u91cd\u8bd5\u7684\u4e8b\u52a1\u6570\uff08\u9664\u975e\u6307\u5b9a\u4e86<code class=\"option\">--failures-detailed</code>\uff0c\u5426\u5219\u4e3a\u96f6\uff09</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4f7f\u7528\u8be5\u9009\u9879\u751f\u6210\u7684\u793a\u4f8b\u8f93\u51fa\uff1a</p>\n<pre class=\"screen\"><strong class=\"userinput\"><code>pgbench --aggregate-interval=10 --time=20 --client=10 --log --rate=1000 --latency-limit=10 --failures-detailed --max-tries=10 test</code></strong>\n\n1650260552 5178 26171317 177284491527 1136 44462 2647617 7321113867 0 9866 64 7564 28340 4148 0\n1650260562 4808 25573984 220121792172 1171 62083 3037380 9666800914 0 9998 598 7392 26621 4527 0\n</pre>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u666e\u901a\uff08\u672a\u805a\u5408\uff09\u65e5\u5fd7\u683c\u5f0f\u4f1a\u663e\u793a\u6bcf\u4e2a\u4e8b\u52a1\u6240\u4f7f\u7528\u7684\u811a\u672c\uff0c\u800c\u805a\u5408\u683c\u5f0f\u4e0d\u4f1a\u3002\u56e0\u6b64\uff0c\u5982\u679c\u9700\u8981\u6309\u811a\u672c\u533a\u5206\u7684\u6570\u636e\uff0c\u5c31\u5fc5\u987b\u81ea\u884c\u805a\u5408\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.8\">\n<h3 lang=\"zh\">\u9010\u8bed\u53e5\u62a5\u544a</h3>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">-r</code>\u9009\u9879\uff0c<span class=\"application\">pgbench</span>\u4e3a\u6bcf\u4e2a\u8bed\u53e5\u6536\u96c6\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">latency</code> \u2014 \u6bcf\u6761\u8bed\u53e5\u7684\u8017\u65f6\u3002<span class=\"application\">pgbench</span>\u62a5\u544a\u8be5\u8bed\u53e5\u6240\u6709\u6210\u529f\u6267\u884c\u7684\u5e73\u5747\u503c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u7684\u5931\u8d25\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8be5\u8bed\u53e5\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u53d1\u751f\u7684\u91cd\u8bd5\u6b21\u6570\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#FAILURES-AND-RETRIES\" title=\"\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</a>\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u62a5\u544a\u4ec5\u5728<code class=\"option\">--max-tries</code>\u9009\u9879\u4e0d\u7b49\u4e8e1\u65f6\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6240\u6709\u6570\u503c\u90fd\u662f\u9488\u5bf9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u7684\u6bcf\u6761\u8bed\u53e5\u8ba1\u7b97\u7684\uff0c\u5e76\u5728\u57fa\u51c6\u6d4b\u8bd5\u5b8c\u6210\u540e\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u811a\u672c\uff0c\u8f93\u51fa\u5c06\u7c7b\u4f3c\u5982\u4e0b\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 1\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 10000/10000\nnumber of failed transactions: 0 (0.000%)\nnumber of transactions above the 50.0 ms latency limit: 1311/10000 (13.110 %)\nlatency average = 28.488 ms\nlatency stddev = 21.009 ms\ninitial connection time = 69.068 ms\ntps = 346.224794 (without initial connection time)\nstatement latencies in milliseconds and failures:\n   0.012  0  \\set aid random(1, 100000 * :scale)\n   0.002  0  \\set bid random(1, 1 * :scale)\n   0.002  0  \\set tid random(1, 10 * :scale)\n   0.002  0  \\set delta random(-5000, 5000)\n   0.319  0  BEGIN;\n   0.834  0  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n   0.641  0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  11.126  0  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  12.961  0  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n   0.634  0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n   1.957  0  END;\n</pre>\n<p lang=\"zh\">\u4f7f\u7528\u53ef\u4e32\u884c\u5316\u9ed8\u8ba4\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\u7684\u9ed8\u8ba4\u811a\u672c\u7684\u53e6\u4e00\u4e2a\u8f93\u51fa\u793a\u4f8b\uff08<code class=\"command\">PGOPTIONS='-c default_transaction_isolation=serializable' pgbench ...</code>\uff09\uff1a</p>\n<pre class=\"screen\">starting vacuum...end.\ntransaction type: &lt;builtin: TPC-B (sort of)&gt;\nscaling factor: 1\nquery mode: simple\nnumber of clients: 10\nnumber of threads: 1\nmaximum number of tries: 10\nnumber of transactions per client: 1000\nnumber of transactions actually processed: 6317/10000\nnumber of failed transactions: 3683 (36.830%)\nnumber of transactions retried: 7667 (76.670%)\ntotal number of retries: 45339\nnumber of transactions above the 50.0 ms latency limit: 106/6317 (1.678 %)\nlatency average = 17.016 ms\nlatency stddev = 13.283 ms\ninitial connection time = 45.017 ms\ntps = 186.792667 (without initial connection time)\nstatement latencies in milliseconds, failures and retries:\n  0.006     0      0  \\set aid random(1, 100000 * :scale)\n  0.001     0      0  \\set bid random(1, 1 * :scale)\n  0.001     0      0  \\set tid random(1, 10 * :scale)\n  0.001     0      0  \\set delta random(-5000, 5000)\n  0.385     0      0  BEGIN;\n  0.773     0      1  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n  0.624     0      0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n  1.098   320   3762  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n  0.582  3363  41576  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n  0.465     0      0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n  1.933     0      0  END;\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u591a\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5219\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e2a\u811a\u672c\u6587\u4ef6\u62a5\u544a\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u4e3a\u9010\u8bed\u53e5\u5ef6\u8fdf\u8ba1\u7b97\u6536\u96c6\u989d\u5916\u7684\u8ba1\u65f6\u4fe1\u606f\u4f1a\u5e26\u6765\u4e00\u5b9a\u5f00\u9500\u3002\u8fd9\u4f1a\u62d6\u6162\u5e73\u5747\u6267\u884c\u901f\u5ea6\uff0c\u5e76\u964d\u4f4e\u8ba1\u7b97\u51fa\u7684 TPS\u3002\u51cf\u901f\u5e45\u5ea6\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u5e73\u53f0\u548c\u786c\u4ef6\u3002\u6bd4\u8f83\u542f\u7528\u548c\u672a\u542f\u7528\u5ef6\u8fdf\u62a5\u544a\u65f6\u7684\u5e73\u5747 TPS \u503c\uff0c\u662f\u5224\u65ad\u8fd9\u4e00\u8ba1\u65f6\u5f00\u9500\u662f\u5426\u663e\u8457\u7684\u597d\u65b9\u6cd5\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"FAILURES-AND-RETRIES\">\n<h3 lang=\"zh\">\u5931\u8d25\u548c\u4e32\u884c\u5316/\u6b7b\u9501\u91cd\u8bd5</h3>\n<p lang=\"zh\">\u5728\u6267\u884c<span class=\"application\">pgbench</span>\u65f6\uff0c\u6709\u4e09\u79cd\u4e3b\u8981\u7c7b\u578b\u7684\u9519\u8bef\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u4e3b\u7a0b\u5e8f\u9519\u8bef\u3002\u5b83\u4eec\u6700\u4e3a\u4e25\u91cd\uff0c\u603b\u662f\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\uff0c\u5e76\u663e\u793a\u76f8\u5e94\u7684\u9519\u8bef\u6d88\u606f\u3002\u5b83\u4eec\u5305\u62ec\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\" style=\"list-style-type: circle;\">\n<li class=\"listitem\">\n<p><span class=\"application\">pgbench</span>\u5f00\u59cb\u6267\u884c\u65f6\u7684\u9519\u8bef\uff08\u4f8b\u5982\u9009\u9879\u503c\u65e0\u6548\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u521d\u59cb\u5316\u6a21\u5f0f\u4e2d\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u7528\u4e8e\u521b\u5efa\u5185\u7f6e\u811a\u672c\u6240\u9700\u8868\u7684\u67e5\u8be2\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5728\u7ebf\u7a0b\u542f\u52a8\u4e4b\u524d\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\u65e0\u6cd5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3001\u5143\u547d\u4ee4\u4e2d\u6709\u8bed\u6cd5\u9519\u8bef\u3001\u7ebf\u7a0b\u521b\u5efa\u5931\u8d25\uff09\uff1b</p>\n</li>\n<li class=\"listitem\">\n<p>\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u6c38\u8fdc\u4e0d\u8be5\u53d1\u751f\u2026\u2026\uff09\u3002</p>\n</li>\n</ul>\n</div>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u7ebf\u7a0b\u5728\u7ba1\u7406\u5176\u5ba2\u6237\u7aef\u65f6\u53d1\u751f\u7684\u9519\u8bef\uff08\u4f8b\u5982\uff0c\u5ba2\u6237\u7aef\u65e0\u6cd5\u5f00\u59cb\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u6216\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\u6240\u7528\u7684\u5957\u63a5\u5b57\u5df2\u7ecf\u5931\u6548\uff09\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8be5\u7ebf\u7a0b\u7684\u6240\u6709\u5ba2\u6237\u7aef\u90fd\u4f1a\u505c\u6b62\uff0c\u800c\u5176\u4ed6\u7ebf\u7a0b\u7ee7\u7eed\u5de5\u4f5c\uff1b\u4f46\u662f\uff0c\u5982\u679c\u6307\u5b9a\u4e86<code class=\"option\">--exit-on-abort</code>\uff0c\u5219\u6240\u6709\u7ebf\u7a0b\u90fd\u4f1a\u7acb\u5373\u505c\u6b62\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\u3002\u5728\u53d1\u751f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\uff08\u7406\u8bba\u4e0a\u4e0d\u5e94\u53d1\u751f\uff09\u6216\u6307\u5b9a\u4e86<code class=\"option\">--exit-on-abort</code>\u65f6\uff0c\u5b83\u4eec\u4f1a\u5bfc\u81f4<span class=\"application\">pgbench</span>\u7acb\u5373\u9000\u51fa\u5e76\u663e\u793a\u76f8\u5e94\u9519\u8bef\u6d88\u606f\u3002\u5426\u5219\uff0c\u6700\u574f\u60c5\u51b5\u4e0b\u53ea\u4f1a\u4e2d\u6b62\u5931\u8d25\u7684\u5ba2\u6237\u7aef\uff0c\u800c\u5176\u4ed6\u5ba2\u6237\u7aef\u7ee7\u7eed\u8fd0\u884c\uff08\u4f46\u67d0\u4e9b\u5ba2\u6237\u7aef\u9519\u8bef\u4f1a\u5728\u4e0d\u4e2d\u6b62\u5ba2\u6237\u7aef\u7684\u60c5\u51b5\u4e0b\u5904\u7406\u5e76\u5355\u72ec\u62a5\u544a\uff0c\u89c1\u4e0b\u6587\uff09\u3002\u672c\u8282\u540e\u7eed\u9ed8\u8ba4\u8ba8\u8bba\u7684\u90fd\u662f\u76f4\u63a5\u5ba2\u6237\u7aef\u9519\u8bef\uff0c\u800c\u4e0d\u662f\u5185\u90e8<span class=\"application\">pgbench</span>\u9519\u8bef\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5ba2\u6237\u7aef\u5728\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u65f6\u4f1a\u4e2d\u6b62\u8fd0\u884c\uff1b\u4f8b\u5982\uff0c\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e22\u5931\uff0c\u6216\u8005\u811a\u672c\u5728\u6700\u540e\u4e00\u4e2a\u4e8b\u52a1\u5c1a\u672a\u5b8c\u6210\u65f6\u5c31\u7ed3\u675f\u4e86\u3002\u53e6\u5916\uff0c\u5982\u679c SQL \u6216\u5143\u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u4e14\u539f\u56e0\u4e0d\u662f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\uff0c\u5ba2\u6237\u7aef\u4e5f\u4f1a\u4e2d\u6b62\u3002\u5426\u5219\uff0c\u5982\u679c SQL \u547d\u4ee4\u56e0\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u800c\u5931\u8d25\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5f53\u524d\u4e8b\u52a1\u4f1a\u56de\u6eda\uff0c\u4e5f\u5305\u62ec\u5c06\u5ba2\u6237\u7aef\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u6b64\u4e8b\u52a1\u8fd0\u884c\u4e4b\u524d\u7684\u72b6\u6001\uff08\u5047\u8bbe\u4e00\u4e2a\u4e8b\u52a1\u811a\u672c\u53ea\u5305\u542b\u4e00\u4e2a\u4e8b\u52a1\uff1b\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/pgbench.html#TRANSACTIONS-AND-SCRIPTS\" title=\"\u5728pgbench\u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f\">\u5728 pgbench \u4e2d\u5b9e\u9645\u6267\u884c\u7684\u201c\u4e8b\u52a1\u201d\u662f\u4ec0\u4e48\uff1f</a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff09\u3002\u53d1\u751f\u4e32\u884c\u5316\u6216\u6b7b\u9501\u9519\u8bef\u7684\u4e8b\u52a1\u4f1a\u5728\u56de\u6eda\u540e\u91cd\u65b0\u6267\u884c\uff0c\u76f4\u5230\u6210\u529f\u5b8c\u6210\uff0c\u6216\u8005\u8fbe\u5230\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u7531<code class=\"option\">--max-tries</code>\u6307\u5b9a\uff09\u3001\u8fbe\u5230\u6700\u5927\u91cd\u8bd5\u65f6\u95f4\uff08\u7531<code class=\"option\">--latency-limit</code>\u6307\u5b9a\uff09\uff0c\u6216\u8005\u57fa\u51c6\u6d4b\u8bd5\u7ed3\u675f\uff08\u7531<code class=\"option\">--time</code>\u6307\u5b9a\uff09\u3002\u5982\u679c\u6700\u540e\u4e00\u6b21\u5c1d\u8bd5\u4ecd\u7136\u5931\u8d25\uff0c\u8be5\u4e8b\u52a1\u4f1a\u88ab\u62a5\u544a\u4e3a\u5931\u8d25\uff0c\u4f46\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e2d\u6b62\uff0c\u800c\u662f\u7ee7\u7eed\u5de5\u4f5c\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a --max-tries \u9009\u9879\uff0c\u4e8b\u52a1\u5728\u53d1\u751f\u5e8f\u5217\u5316\u9519\u8bef\u6216\u6b7b\u9501\u540e\u4e0d\u4f1a\u91cd\u8bd5\uff0c\u56e0\u4e3a\u5176\u9ed8\u8ba4\u503c\u4e3a 1\u3002\u53ef\u4ee5\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\uff08--max-tries=0\uff09\u5e76\u914d\u5408 --latency-limit\uff0c\u4ec5\u9650\u5236\u5c1d\u8bd5\u7684\u6700\u957f\u603b\u8017\u65f6\u3002\u4f7f\u7528\u65e0\u9650\u5c1d\u8bd5\u6b21\u6570\u65f6\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 --time \u9650\u5236\u57fa\u51c6\u6d4b\u8bd5\u65f6\u957f\u3002</p>\n<p lang=\"zh\">\u5728\u91cd\u590d\u5305\u542b\u591a\u4e2a\u4e8b\u52a1\u7684\u811a\u672c\u65f6\u8981\u5c0f\u5fc3\uff1a\u811a\u672c\u603b\u662f\u5b8c\u5168\u91cd\u8bd5\uff0c\u56e0\u6b64\u6210\u529f\u7684\u4e8b\u52a1\u53ef\u80fd\u4f1a\u6267\u884c\u591a\u6b21\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 shell \u547d\u4ee4\u91cd\u8bd5\u4e8b\u52a1\u65f6\u8981\u5c0f\u5fc3\u3002\u4e0e SQL \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u540c\uff0cshell \u547d\u4ee4\u7684\u7ed3\u679c\u4e0d\u4f1a\u56de\u6eda\uff0c\u552f\u4e00\u7684\u4f8b\u5916\u662f<code class=\"command\">\\setshell</code>\u547d\u4ee4\u8bbe\u7f6e\u7684\u53d8\u91cf\u503c\u3002</p>\n</div>\n<p lang=\"zh\">\u6210\u529f\u4e8b\u52a1\u7684\u5ef6\u8fdf\u5305\u62ec\u4e8b\u52a1\u6267\u884c\u7684\u6574\u4e2a\u65f6\u95f4\uff0c\u5305\u62ec\u56de\u6eda\u548c\u91cd\u8bd5\u3002\u5ef6\u8fdf\u4ec5\u9488\u5bf9\u6210\u529f\u7684\u4e8b\u52a1\u548c\u547d\u4ee4\u8fdb\u884c\u6d4b\u91cf\uff0c\u800c\u4e0d\u9488\u5bf9\u5931\u8d25\u7684\u4e8b\u52a1\u6216\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u4e3b\u62a5\u544a\u5305\u542b\u5931\u8d25\u4e8b\u52a1\u7684\u6570\u91cf\u3002\u5982\u679c --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1\uff0c\u4e3b\u62a5\u544a\u8fd8\u4f1a\u5305\u542b\u91cd\u8bd5\u76f8\u5173\u7edf\u8ba1\uff1a\u53d1\u751f\u91cd\u8bd5\u7684\u4e8b\u52a1\u603b\u6570\u548c\u91cd\u8bd5\u603b\u6b21\u6570\u3002\u6bcf\u811a\u672c\u62a5\u544a\u7ee7\u627f\u4e3b\u62a5\u544a\u7684\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u3002\u53ea\u6709 --max-tries \u9009\u9879\u4e0d\u7b49\u4e8e 1 \u65f6\uff0c\u6bcf\u8bed\u53e5\u62a5\u544a\u624d\u4f1a\u663e\u793a\u91cd\u8bd5\u7edf\u8ba1\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5e0c\u671b\u5728\u9010\u4e8b\u52a1\u65e5\u5fd7\u3001\u805a\u5408\u65e5\u5fd7\u4ee5\u53ca\u4e3b\u62a5\u544a\u548c\u9010\u811a\u672c\u62a5\u544a\u4e2d\u6309\u57fa\u672c\u7c7b\u578b\u5bf9\u5931\u8d25\u8fdb\u884c\u5206\u7ec4\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--failures-detailed</code>\u9009\u9879\u3002\u5982\u679c\u8fd8\u5e0c\u671b\u6309\u7c7b\u578b\u533a\u5206\u6240\u6709\u9519\u8bef\u548c\u5931\u8d25\uff08\u4e0d\u518d\u91cd\u8bd5\u7684\u9519\u8bef\uff09\uff0c\u5305\u62ec\u8d85\u51fa\u4e86\u54ea\u4e00\u79cd\u91cd\u8bd5\u9650\u5236\uff0c\u4ee5\u53ca\u4e32\u884c\u5316/\u6b7b\u9501\u5931\u8d25\u8d85\u51fa\u4e86\u591a\u5c11\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--verbose-errors</code>\u9009\u9879\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.10\">\n<h3 lang=\"zh\">\u8868\u8bbf\u95ee\u65b9\u6cd5</h3>\n<p lang=\"zh\">\u53ef\u4ee5\u4e3a pgbench \u8868\u6307\u5b9a<a class=\"link\" href=\"/docs/18/tableam.html\" title=\"\u7b2c\u00a062\u00a0\u7ae0\u00a0\u8868\u8bbf\u95ee\u65b9\u6cd5\u63a5\u53e3\u5b9a\u4e49\">\u8868\u8bbf\u95ee\u65b9\u6cd5</a>\u3002\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGOPTIONS</code>\u7528\u4e8e\u6307\u5b9a\u901a\u8fc7\u547d\u4ee4\u884c\u4f20\u9012\u7ed9 PostgreSQL \u7684\u6570\u636e\u5e93\u914d\u7f6e\u9009\u9879\uff08\u89c1<a class=\"xref\" href=\"/docs/18/config-setting.html#CONFIG-SETTING-SHELL\" title=\"19.1.4.\u00a0\u901a\u8fc7 Shell \u5f71\u54cd\u53c2\u6570\">\u7b2c\u00a019.1.4\u00a0\u8282</a>\uff09\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u7528\u5982\u4e0b\u65b9\u5f0f\u4e3a pgbench \u521b\u5efa\u7684\u8868\u6307\u5b9a\u4e00\u4e2a\u540d\u4e3a<code class=\"literal\">wuzza</code>\u7684\u5047\u60f3\u9ed8\u8ba4\u8868\u8bbf\u95ee\u65b9\u6cd5\uff1a</p>\n<pre class=\"programlisting\">PGOPTIONS='-c default_table_access_method=wuzza'\n</pre>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.11\">\n<h3 lang=\"zh\">\u826f\u597d\u5b9e\u8df5</h3>\n<p lang=\"zh\">\u5f88\u5bb9\u6613\u7528<span class=\"application\">pgbench</span>\u5f97\u51fa\u5b8c\u5168\u6ca1\u6709\u610f\u4e49\u7684\u6570\u5b57\u3002\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e9b\u6709\u52a9\u4e8e\u83b7\u5f97\u6709\u7528\u7ed3\u679c\u7684\u51c6\u5219\u3002</p>\n<p lang=\"zh\">\u9996\u5148\uff0c<span class=\"emphasis\"><em>\u7edd\u4e0d\u8981</em></span>\u76f8\u4fe1\u4efb\u4f55\u53ea\u8fd0\u884c\u4e86\u51e0\u79d2\u949f\u7684\u6d4b\u8bd5\u3002\u4f7f\u7528<code class=\"option\">-t</code>\u6216<code class=\"option\">-T</code>\u9009\u9879\u8ba9\u6d4b\u8bd5\u81f3\u5c11\u6301\u7eed\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u5e73\u6ed1\u6389\u566a\u58f0\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u624d\u80fd\u5f97\u5230\u53ef\u590d\u73b0\u7684\u7ed3\u679c\u3002\u4e00\u4e2a\u597d\u505a\u6cd5\u662f\u628a\u540c\u4e00\u6d4b\u8bd5\u8fd0\u884c\u51e0\u6b21\uff0c\u770b\u770b\u7ed3\u679c\u662f\u5426\u53ef\u590d\u73b0\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u9ed8\u8ba4\u7684\u7c7b TPC-B \u6d4b\u8bd5\u573a\u666f\uff0c\u521d\u59cb\u5316\u89c4\u6a21\u56e0\u5b50\uff08-s\uff09\u5e94\u81f3\u5c11\u4e0e\u8ba1\u5212\u6d4b\u8bd5\u7684\u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf\uff08-c\uff09\u4e00\u6837\u5927\uff0c\u5426\u5219\u6d4b\u91cf\u7684\u4e3b\u8981\u662f\u66f4\u65b0\u4e89\u7528\u3002pgbench_branches \u8868\u53ea\u6709 -s \u884c\uff0c\u800c\u6bcf\u4e2a\u4e8b\u52a1\u90fd\u8981\u66f4\u65b0\u5176\u4e2d\u4e00\u884c\uff0c\u56e0\u6b64 -c \u5927\u4e8e -s \u5fc5\u7136\u4f1a\u5bfc\u81f4\u5927\u91cf\u4e8b\u52a1\u963b\u585e\uff0c\u7b49\u5f85\u5176\u4ed6\u4e8b\u52a1\u5b8c\u6210\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u6d4b\u8bd5\u573a\u666f\u8fd8\u4f1a\u5bf9\u8868\u521d\u59cb\u5316\u540e\u7684\u65f6\u95f4\u957f\u77ed\u975e\u5e38\u654f\u611f\uff1a\u8868\u4e2d\u6b7b\u5143\u7ec4\u548c\u65e0\u6548\u7a7a\u95f4\u7684\u7d2f\u79ef\u4f1a\u6539\u53d8\u7ed3\u679c\u3002\u8981\u7406\u89e3\u8fd9\u4e9b\u7ed3\u679c\uff0c\u5fc5\u987b\u8ddf\u8e2a\u66f4\u65b0\u603b\u6570\u4ee5\u53ca\u4f55\u65f6\u53d1\u751f\u6e05\u7406\u3002\u5982\u679c\u542f\u7528\u4e86\u81ea\u52a8\u6e05\u7406\uff0c\u5b83\u53ef\u80fd\u4f1a\u7ed9\u6d4b\u5f97\u7684\u6027\u80fd\u5e26\u6765\u4e0d\u53ef\u9884\u6d4b\u7684\u53d8\u5316\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pgbench</span>\u7684\u4e00\u4e2a\u5c40\u9650\u662f\uff1a\u5728\u5c1d\u8bd5\u6d4b\u8bd5\u5927\u91cf\u5ba2\u6237\u7aef\u4f1a\u8bdd\u65f6\uff0c\u5b83\u81ea\u5df1\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u8fd0\u884c<span class=\"application\">pgbench</span>\u6765\u7f13\u89e3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u8fc7\u7f51\u7edc\u5ef6\u8fdf\u5fc5\u987b\u8db3\u591f\u4f4e\u3002\u751a\u81f3\u53ef\u4ee5\u5728\u591a\u53f0\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a<span class=\"application\">pgbench</span>\u5b9e\u4f8b\uff0c\u5bf9\u540c\u4e00\u53f0\u6570\u636e\u5e93\u670d\u52a1\u5668\u65bd\u538b\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.11.9.12\">\n<h3 lang=\"zh\">\u5b89\u5168\u6027</h3>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/18/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.10.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u5c31\u4e0d\u8981\u5728\u8be5\u6570\u636e\u5e93\u4e2d\u8fd0\u884c<span class=\"application\">pgbench</span>\u3002<span class=\"application\">pgbench</span>\u4f7f\u7528\u975e\u9650\u5b9a\u540d\u79f0\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66f4\u6539\u641c\u7d22\u8def\u5f84\u3002</p>\n</div>\n</div>\n</div></div>", "manual_path": "pgbench.html", "localization": {"status": "complete", "sources": [{"url": "/docs/18/pgbench.html", "method": "same-major semantic node", "sha256": "60943db39d7d7f13b4348a7156e67a1d2cdf13ffa959d3bbec221e9302ccb7ca", "language": "zh", "matched_nodes": ["#PGBENCH/div[2]/p[1]", "#PGBENCH/div[3]/h2[0]", "#PGBENCH/div[4]/div[8]/h3[0]", "#PGBENCH/div[4]/div[8]/p[1]", "#PGBENCH/div[4]/p[11]", "#PGBENCH/div[4]/p[12]", "#PGBENCH/div[4]/p[14]", "#PGBENCH/div[4]/p[1]", "#PGBENCH/div[4]/p[2]", "#PGBENCH/div[4]/p[4]", "#PGBENCH/div[4]/p[4]/a[0]", "#PGBENCH/div[4]/p[5]", "#PGBENCH/div[4]/p[7]", "#PGBENCH/div[4]/p[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[25]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[0]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[10]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[2]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[4]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[6]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/div[1]/dl[0]/dt[8]", "#PGBENCH/div[5]/div[2]/div[2]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[5]/div[2]/h3[0]", "#PGBENCH/div[5]/div[2]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[15]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/div[1]/ul[0]/li[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[17]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[23]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[3]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[27]/p[4]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[31]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[33]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[35]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[37]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[39]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[41]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/div[1]/ul[0]/li[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/div[1]/ul[0]/li[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[43]/p[2]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[45]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[49]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[51]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[0]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[53]/p[1]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[55]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[57]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[3]/div[2]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[5]/div[3]/h3[0]", "#PGBENCH/div[5]/div[3]/p[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[5]/div[4]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[5]/div[4]/h3[0]", "#PGBENCH/div[5]/div[4]/p[1]", "#PGBENCH/div[5]/p[1]", "#PGBENCH/div[6]/h2[0]", "#PGBENCH/div[7]/div[1]/dl[0]/dd[1]", "#PGBENCH/div[7]/h2[0]", "#PGBENCH/div[7]/p[2]", "#PGBENCH/div[7]/p[3]", "#PGBENCH/div[8]/div[10]/h3[0]", "#PGBENCH/div[8]/div[10]/p[1]", "#PGBENCH/div[8]/div[10]/p[2]", "#PGBENCH/div[8]/div[10]/p[4]", "#PGBENCH/div[8]/div[10]/p[5]", "#PGBENCH/div[8]/div[11]/h3[0]", "#PGBENCH/div[8]/div[11]/p[1]", "#PGBENCH/div[8]/div[1]/h3[0]", "#PGBENCH/div[8]/div[1]/h3[0]/span[1]", "#PGBENCH/div[8]/div[1]/p[1]", "#PGBENCH/div[8]/div[1]/p[2]", "#PGBENCH/div[8]/div[1]/p[4]", "#PGBENCH/div[8]/div[1]/p[5]", "#PGBENCH/div[8]/div[2]/div[3]/h3[0]", "#PGBENCH/div[8]/div[2]/div[3]/p[1]", "#PGBENCH/div[8]/div[2]/div[3]/p[2]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[0]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[1]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[2]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/div[1]/table[0]/tbody[2]/tr[3]/td[1]", "#PGBENCH/div[8]/div[2]/div[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[11]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[1]/p[4]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[2]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[3]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[5]/p[5]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[7]/p[1]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[0]", "#PGBENCH/div[8]/div[2]/div[8]/dl[0]/dd[9]/p[1]", "#PGBENCH/div[8]/div[2]/h3[0]", "#PGBENCH/div[8]/div[2]/p[1]", "#PGBENCH/div[8]/div[2]/p[2]", "#PGBENCH/div[8]/div[2]/p[4]", "#PGBENCH/div[8]/div[2]/p[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[12]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[15]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[16]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[17]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[18]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[20]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[21]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[22]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[23]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[3]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[3]/div[2]/p[0]", "#PGBENCH/div[8]/div[3]/h3[0]", "#PGBENCH/div[8]/div[3]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[0]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[10]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[11]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[12]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[13]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[14]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[15]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[16]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[17]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[18]/td[0]/p[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[19]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[1]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[2]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[3]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[4]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[5]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[6]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[7]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[8]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/tbody[2]/tr[9]", "#PGBENCH/div[8]/div[4]/div[2]/div[1]/table[0]/thead[1]", "#PGBENCH/div[8]/div[4]/div[2]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[0]/p[0]", "#PGBENCH/div[8]/div[4]/div[5]/ul[0]/li[1]/p[0]", "#PGBENCH/div[8]/div[4]/div[6]/p[1]", "#PGBENCH/div[8]/div[4]/div[6]/p[2]", "#PGBENCH/div[8]/div[4]/h3[0]", "#PGBENCH/div[8]/div[4]/p[10]", "#PGBENCH/div[8]/div[4]/p[12]", "#PGBENCH/div[8]/div[4]/p[14]", "#PGBENCH/div[8]/div[4]/p[15]", "#PGBENCH/div[8]/div[4]/p[17]", "#PGBENCH/div[8]/div[4]/p[1]", "#PGBENCH/div[8]/div[4]/p[4]", "#PGBENCH/div[8]/div[4]/p[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[5]/div[3]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[5]/h3[0]", "#PGBENCH/div[8]/div[5]/p[12]", "#PGBENCH/div[8]/div[5]/p[14]", "#PGBENCH/div[8]/div[5]/p[2]", "#PGBENCH/div[8]/div[5]/p[4]", "#PGBENCH/div[8]/div[5]/p[5]", "#PGBENCH/div[8]/div[5]/p[7]", "#PGBENCH/div[8]/div[5]/p[9]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[11]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[13]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[15]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[17]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[19]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[1]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[21]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[27]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[29]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[3]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[5]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[7]", "#PGBENCH/div[8]/div[6]/div[2]/dl[0]/dd[9]", "#PGBENCH/div[8]/div[6]/h3[0]", "#PGBENCH/div[8]/div[6]/p[1]", "#PGBENCH/div[8]/div[6]/p[3]", "#PGBENCH/div[8]/div[6]/p[5]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[7]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[7]/h3[0]", "#PGBENCH/div[8]/div[7]/p[10]", "#PGBENCH/div[8]/div[7]/p[1]", "#PGBENCH/div[8]/div[7]/p[3]", "#PGBENCH/div[8]/div[7]/p[4]", "#PGBENCH/div[8]/div[7]/p[5]", "#PGBENCH/div[8]/div[7]/p[7]", "#PGBENCH/div[8]/div[7]/p[9]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[0]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[1]", "#PGBENCH/div[8]/div[8]/div[2]/ul[0]/li[2]", "#PGBENCH/div[8]/div[8]/div[4]/p[2]", "#PGBENCH/div[8]/div[8]/div[4]/p[3]", "#PGBENCH/div[8]/div[8]/p[1]", "#PGBENCH/div[8]/div[8]/p[3]", "#PGBENCH/div[8]/div[8]/p[5]", "#PGBENCH/div[8]/div[8]/p[7]", "#PGBENCH/div[8]/div[9]/h3[0]", "#PGBENCH/div[8]/div[9]/p[1]", "#PGBENCH/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "pgbench \u2014 run a benchmark test on PostgreSQL", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/0/value": "pgbench", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Client applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/tables/1/title": "Environment variables", "/versions/18/tables/0/rows/0/summary": "Required to invoke initialization mode.", "/versions/18/tables/0/rows/1/summary": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are:", "/versions/18/tables/0/rows/2/summary": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100.", "/versions/18/tables/0/rows/3/summary": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)", "/versions/18/tables/0/rows/4/summary": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware).", "/versions/18/tables/0/rows/5/summary": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers.", "/versions/18/tables/0/rows/6/summary": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)", "/versions/18/tables/0/rows/7/summary": "Create indexes in the specified tablespace, rather than the default tablespace.", "/versions/18/tables/0/rows/8/summary": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range .", "/versions/18/tables/0/rows/9/summary": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning.", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Create tables in the specified tablespace, rather than the default tablespace.", "/versions/18/tables/0/rows/11/summary": "Create all tables as unlogged tables, rather than permanent tables.", "/versions/18/tables/0/rows/12/summary": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately.", "/versions/18/tables/0/rows/13/summary": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1.", "/versions/18/tables/0/rows/14/summary": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead.", "/versions/18/tables/0/rows/15/summary": "Define a variable for use by a custom script (see below). Multiple -D options are allowed.", "/versions/18/tables/0/rows/16/summary": "Add a transaction script read from filename to the list of scripts to be executed.", "/versions/18/tables/0/rows/17/summary": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1.", "/versions/18/tables/0/rows/18/summary": "Write information about each transaction to a log file. See below for details.", "/versions/18/tables/0/rows/19/summary": "Transactions that last more than limit milliseconds are counted and reported separately, as late .", "/versions/18/tables/0/rows/20/summary": "Protocol to use for submitting queries to the server:", "/versions/18/tables/0/rows/21/summary": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers .", "/versions/18/tables/0/rows/22/summary": "Run built-in simple-update script. Shorthand for -b simple-update .", "/versions/18/tables/0/rows/23/summary": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries.", "/versions/18/tables/0/rows/24/summary": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1.", "/versions/18/tables/0/rows/25/summary": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results.", "/versions/18/tables/0/rows/26/summary": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used.", "/versions/18/tables/0/rows/27/summary": "Run built-in select-only script. Shorthand for -b select-only .", "/versions/18/tables/0/rows/28/summary": "Number of transactions each client runs. Default is 10.", "/versions/18/tables/0/rows/29/summary": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive.", "/versions/18/tables/0/rows/30/summary": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history .", "/versions/18/tables/0/rows/31/summary": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below.", "/versions/18/tables/0/rows/32/summary": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case.", "/versions/18/tables/0/rows/33/summary": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types:", "/versions/18/tables/0/rows/34/summary": "Set the filename prefix for the log files created by --log . The default is pgbench_log .", "/versions/18/tables/0/rows/35/summary": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions.", "/versions/18/tables/0/rows/36/summary": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools.", "/versions/18/tables/0/rows/37/summary": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable.", "/versions/18/tables/0/rows/38/summary": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged.", "/versions/18/tables/0/rows/39/summary": "Show the actual code of builtin script scriptname on stderr, and exit immediately.", "/versions/18/tables/0/rows/40/summary": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information.", "/versions/18/tables/0/rows/41/summary": "Print debugging output.", "/versions/18/tables/0/rows/42/summary": "The database server's host name", "/versions/18/tables/0/rows/43/summary": "The database server's port number", "/versions/18/tables/0/rows/44/summary": "The user name to connect as", "/versions/18/tables/0/rows/45/summary": "Print the pgbench version and exit.", "/versions/18/tables/0/rows/46/summary": "Show help about pgbench command line arguments, and exit.", "/versions/18/tables/1/columns/0/label": "Variable", "/versions/18/tables/1/columns/1/label": "Meaning", "/versions/18/tables/1/rows/0/description": "Default connection parameters."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "d046021a2b2b5e07aeb05eab043ddf066e09285bd0e833f53652f9b65b21231c"}, "comparison_data": {"options": [{"names": ["-i", "--initialize"], "signature": "-i --initialize", "description": "Required to invoke initialization mode."}, {"names": ["-I init_steps", "--init-steps= init_steps"], "signature": "-I init_steps --init-steps= init_steps", "description": "Perform just a selected set of the normal initialization steps. init_steps specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is dtgvp . The available steps are: d (Drop) Drop any existing pgbench tables. t (create Tables) Create the tables used by the standard pgbench scenario, namely pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers . g or G (Generate data, client-side or server-side) Generate data and load it into the standard tables, replacing any data already present. With g (client-side data generation), data is generated in pgbench client and then sent to the server. This uses the client/server bandwidth extensively through a COPY . pgbench uses the FREEZE option to load data into ordinary (non-partition) tables with version 14 or later of PostgreSQL to speed up subsequent VACUUM . Using g causes logging to print one message every 100,000 rows while generating data for all tables. With G (server-side data generation), only small queries are sent from the pgbench client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using G causes logging not to print any progress message while generating data. The default initialization behavior uses client-side data generation (equivalent to g ). v (Vacuum) Invoke VACUUM on the standard tables. p (create Primary keys) Create primary key indexes on the standard tables. f (create Foreign keys) Create foreign key constraints between the standard tables. (Note that this step is not performed by default.)"}, {"names": ["-F", "--fillfactor="], "signature": "-F fillfactor --fillfactor= fillfactor", "description": "Create the pgbench_accounts , pgbench_tellers and pgbench_branches tables with the given fillfactor. Default is 100."}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming during initialization. (This option suppresses the v initialization step, even if it was specified in -I .)"}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). This setting has no effect if G is specified in -I ."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Multiply the number of rows generated by the scale factor. For example, -s 100 will create 10,000,000 rows in the pgbench_accounts table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers ( aid columns) will switch to using larger integers ( bigint ), in order to be big enough to hold the range of account identifiers."}, {"names": ["--foreign-keys"], "signature": "--foreign-keys", "description": "Create foreign key constraints between the standard tables. (This option adds the f step to the initialization step sequence, if it is not already present.)"}, {"names": ["--index-tablespace= index_tablespace"], "signature": "--index-tablespace= index_tablespace", "description": "Create indexes in the specified tablespace, rather than the default tablespace."}, {"names": ["--partition-method= NAME"], "signature": "--partition-method= NAME", "description": "Create a partitioned pgbench_accounts table with NAME method. Expected values are range or hash . This option requires that --partitions is set to non-zero. If unspecified, default is range ."}, {"names": ["--partitions= NUM"], "signature": "--partitions= NUM", "description": "Create a partitioned pgbench_accounts table with NUM partitions of nearly equal size for the scaled number of accounts. Default is 0 , meaning no partitioning."}, {"names": ["--tablespace= tablespace"], "signature": "--tablespace= tablespace", "description": "Create tables in the specified tablespace, rather than the default tablespace."}, {"names": ["--unlogged-tables"], "signature": "--unlogged-tables", "description": "Create all tables as unlogged tables, rather than permanent tables."}, {"names": ["-b", "--builtin"], "signature": "-b scriptname[@weight] --builtin = scriptname[@weight]", "description": "Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: tpcb-like , simple-update and select-only . Unambiguous prefixes of built-in names are accepted. With the special name list , show the list of built-in scripts and exit immediately. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details."}, {"names": ["-c", "--client="], "signature": "-c clients --client= clients", "description": "Number of clients simulated, that is, number of concurrent database sessions. Default is 1."}, {"names": ["-C", "--connect"], "signature": "-C --connect", "description": "Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead."}, {"names": ["-D", "--define="], "signature": "-D varname = value --define= varname = value", "description": "Define a variable for use by a custom script (see below). Multiple -D options are allowed."}, {"names": ["-f", "--file="], "signature": "-f filename[@weight] --file= filename[@weight]", "description": "Add a transaction script read from filename to the list of scripts to be executed. Optionally, write an integer weight after @ to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an @ character, append a weight so that there is no ambiguity, for example filen@me@1 .) See below for details."}, {"names": ["-j", "--jobs="], "signature": "-j threads --jobs= threads", "description": "Number of worker threads within pgbench . Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1."}, {"names": ["-l", "--log"], "signature": "-l --log", "description": "Write information about each transaction to a log file. See below for details."}, {"names": ["-L", "--latency-limit="], "signature": "-L limit --latency-limit= limit", "description": "Transactions that last more than limit milliseconds are counted and reported separately, as late . When throttling is used ( --rate=... ), transactions that lag behind schedule by more than limit ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as skipped . When the --max-tries option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than limit ms. To limit only the time of tries and not their number, use --max-tries=0 . By default, the option --max-tries is set to 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["-M", "--protocol="], "signature": "-M querymode --protocol= querymode", "description": "Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 54 for more information.)"}, {"names": ["-n", "--no-vacuum"], "signature": "-n --no-vacuum", "description": "Perform no vacuuming before running the test. This option is necessary if you are running a custom test scenario that does not include the standard tables pgbench_accounts , pgbench_branches , pgbench_history , and pgbench_tellers ."}, {"names": ["-N", "--skip-some-updates"], "signature": "-N --skip-some-updates", "description": "Run built-in simple-update script. Shorthand for -b simple-update ."}, {"names": ["-P", "--progress="], "signature": "-P sec --progress= sec", "description": "Show progress report every sec seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling ( -R ), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When --max-tries is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries."}, {"names": ["-r", "--report-per-command"], "signature": "-r --report-per-command", "description": "Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the --max-tries option is not equal to 1."}, {"names": ["-R", "--rate="], "signature": "-R rate --rate= rate", "description": "Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. If --latency-limit is used together with --rate , a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate."}, {"names": ["-s", "--scale="], "signature": "-s scale_factor --scale= scale_factor", "description": "Report the specified scale factor in pgbench 's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the pgbench_branches table. However, when testing only custom benchmarks ( -f option), the scale factor will be reported as 1 unless this option is used."}, {"names": ["-S", "--select-only"], "signature": "-S --select-only", "description": "Run built-in select-only script. Shorthand for -b select-only ."}, {"names": ["-t", "--transactions="], "signature": "-t transactions --transactions= transactions", "description": "Number of transactions each client runs. Default is 10."}, {"names": ["-T", "--time="], "signature": "-T seconds --time= seconds", "description": "Run the test for this many seconds, rather than a fixed number of transactions per client. -t and -T are mutually exclusive."}, {"names": ["-v", "--vacuum-all"], "signature": "-v --vacuum-all", "description": "Vacuum all four standard tables before running the test. With neither -n nor -v , pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history ."}, {"names": ["--aggregate-interval= seconds"], "signature": "--aggregate-interval= seconds", "description": "Length of aggregation interval (in seconds). May be used only with -l option. With this option, the log contains per-interval summary data, as described below."}, {"names": ["--exit-on-abort"], "signature": "--exit-on-abort", "description": "Exit immediately when any client is aborted due to some error. Without this option, even when a client is aborted, other clients could continue their run as specified by -t or -T option, and pgbench will print an incomplete results in this case. Note that serialization failures or deadlock failures do not abort the client, so they are not affected by this option. See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--failures-detailed"], "signature": "--failures-detailed", "description": "Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: serialization failures; deadlock failures; See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--log-prefix= prefix"], "signature": "--log-prefix= prefix", "description": "Set the filename prefix for the log files created by --log . The default is pgbench_log ."}, {"names": ["--max-tries= number_of_tries"], "signature": "--max-tries= number_of_tries", "description": "Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the --latency-limit option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries ( --max-tries=0 ) without --latency-limit or --time . The default value is 1 and transactions with serialization/deadlock errors are not retried. See Failures and Serialization/Deadlock Retries for more information about retrying such transactions."}, {"names": ["--progress-timestamp"], "signature": "--progress-timestamp", "description": "When showing progress (option -P ), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools."}, {"names": ["--random-seed="], "signature": "--random-seed= seed", "description": "Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for seed may be: time (the default, the seed is based on the current time), rand (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script ( random... functions) or implicitly (for instance option --rate uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for seed may also be provided through the environment variable PGBENCH_RANDOM_SEED . To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. Setting the seed explicitly allows to reproduce a pgbench run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same pgbench run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely."}, {"names": ["--sampling-rate= rate"], "signature": "--sampling-rate= rate", "description": "Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS)."}, {"names": ["--show-script="], "signature": "--show-script= scriptname", "description": "Show the actual code of builtin script scriptname on stderr, and exit immediately."}, {"names": ["--verbose-errors"], "signature": "--verbose-errors", "description": "Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.) See Failures and Serialization/Deadlock Retries for more information."}, {"names": ["--debug"], "signature": "--debug", "description": "Print debugging output."}, {"names": ["-h", "--host="], "signature": "-h hostname --host= hostname", "description": "The database server's host name"}, {"names": ["-p", "--port="], "signature": "-p port --port= port", "description": "The database server's port number"}, {"names": ["-U", "--username="], "signature": "-U login --username= login", "description": "The user name to connect as"}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pgbench version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pgbench command line arguments, and exit."}], "synopsis": ["pgbench -i [ option ...] [ dbname ]", "pgbench [ option ...] [ dbname ]"], "environment": [{"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters."}]}, "comparison_hash": "3fee128ed72e2dadb503883963e144eb39fe4ec647ea20726a6508671823ee62", "manual_language": "zh"}, "comparison": {"left": "13", "right": "14", "status": "changed", "diff": "--- PostgreSQL 13\n+++ PostgreSQL 14\n@@ -169,7 +169,7 @@\n       \"signature\": \"-L limit --latency-limit= limit\"\n     },\n     {\n-      \"description\": \"Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 52 for more information.)\",\n+      \"description\": \"Protocol to use for submitting queries to the server: simple : use simple query protocol. extended : use extended query protocol. prepared : use extended query protocol with prepared statements. In the prepared mode, pgbench reuses the parse analysis result starting from the second query iteration, so pgbench runs faster than in other modes. The default is simple query protocol. (See Chapter 53 for more information.)\",\n       \"names\": [\n         \"-M\",\n         \"--protocol=\""}}