in

Does pg client accept multiple queries?


I’m using pg library in order to execute queries on psql db, on this case I’m initilizing only one client and doing multiple queries it seems to be working; is this a good practice or I should use other approach or other library?

try {
    [response1, response2, response3] = await Promise.all([
      executeQuery(query1, pgClient),
      executeQuery(query2, pgClient),
      executeQuery(query3, pgClient),
    ]);
  } catch(error) {
  }
// instead of
const {response1}  = await pgClient.query(query1)
  const {response2}  = await pgClient.query(query2)
  const {response2}  = await pgClient.query(query3)



Source: https://stackoverflow.com/questions/70599302/does-pg-client-accept-multiple-queries

usePortal – 30 seconds of code

A complete template for 2022 focused on around React, Postgres and various web3 integrations