gpt4 book ai didi

sql - PostgreSQL:一次运行多个选择

转载 作者:行者123 更新时间:2023-11-29 12:03:07 26 4
gpt4 key购买 nike

如何才能运行例如postgreSQL 中一次查询 1000 个?我想测试数据库的性能和优化。我想运行很多选择并计算运行时间。

最佳答案

使用pgbench将是一个好主意。首先,创建一个 sql 文件并将测试查询放入其中。然后通过将 SQLFilePath、UserName 和 DatabaseName 替换为您的版本来以这种方式运行测试台

pgbench.exe -c 10 -f SQLFilePath -j 10 -n -t 10 -U UserName DatabaseName

这是您可以调整的命令列表

-c = number of concurrent database clients
-f = script file path
-j = number of threads (the clients are evenly distributed among this number of threads)
-n = don't run VACUUM (docs require it be set in case of custom a script)
-t = number of transactions each client makes

关于sql - PostgreSQL:一次运行多个选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44746008/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com