I have two independent queries for example:
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")
This, according to the documentation, will be added to a queue and execute one after the other, is it possible to execute the two queries asynchronously? so the registered time should be around 30 instead of 60...
UPDATE: Other approach would be to use the pool feature of the library instead of instantiating two clients
CodePudding user response:
For that, you have to open two database connections. Then it is no problem to have two queries running concurrently.
