Anomaly : too many connections for role, in a specific loop of Worflow

Hello all,

I have this error message below :


I try to loop in a array of 432 values to check if the value is already existing in a specific table.
But i have this error of postresql too many connections for my role
First question i don't understand why i have this error in this specific loop ?
And how fix this ?

Thanks for you help and your answers

Do you need to run this check as a loop? If you are just checking if a record exists, you could do a left join of your results to the source table and select rows where the PK in the source table is null to get all the rows that don't exist.

As for the too many connections, I have run into that with my own Postgres DB setup elsewhere, and I had to setup connection pooling with pgBouncer to get around it. I don't know if/how that is possible with the Retool managed DB, but perhaps a Retool team member can chime in.

Thanks for your answer but how can transform the array result to use it as left join ? I try this with no sucess :

Ah - didn't realize it was coming from code not a DB. You would likely need to add a block that queries the source table, then use "Query JSON with SQL" to join the result of the code2 and query2 blocks. Something along these lines:

1 Like

Great solution, thanks a lot

1 Like