如何在postgreSQL中一次运行1000个查询?我想测试我的数据库的性能和优化。我想运行许多选择和计算运行时间。
发布于 2017-06-25 12:59:03
使用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发布于 2017-06-26 08:16:41
您可以考虑使用Apache JMeter,它通过JDBC协议支持PostgreSQL负载测试。
有关使用Apache进行数据库负载测试的更多信息,请参见用JMeter构建数据库测试方案的真正秘密文章。
https://stackoverflow.com/questions/44746008
复制相似问题