How to improve the Bulk Insert speed on Postgres db

I found this post that explained how you can add a function in a workflow that is a resource query (bulk insert to Postgres for my use case) and call it in a loop over chunks of data.

New function in the workflow:
Screenshot 2024-12-02 at 4.11.59 PM

Updated Javascript code block to slice chunks (and removed the postgres insert code block)

My bulk insert is now completing in less than 10 secs!