【发布时间】:2022-01-14 05:34:45
【问题描述】:
例如,我有两个独立的查询:
const query = "SELECT PG_SLEEP(30);"
const query1 = "SELECT PG_SLEEP(30);"
console.time("Query")
await Promise.all([pgClient.query(query), pgClient.query(query1)]);
console.timeEnd("Query")
根据文档,这将被添加到一个队列中并一个接一个地执行,是否可以异步执行两个查询?所以注册时间应该是30左右而不是60...
更新: 其他方法是使用库的the pool feature 而不是实例化两个客户端
【问题讨论】:
标签: node.js postgresql node-postgres