Slow postrgesql insert queries

Dear all,

I cannot find a lot about the expected speed of sql queries within retool. I am inserting data in several tables. There is not a lot of data, it is like a signup type deal.

The same insert query takes 0.01 sec outside of retool, but using retool it takes 1.5-1.7 seconds. Is this to be expected?

I cannot use caching since it is an insert, the data changes, is there a way to speed it up?

Thanks!

Hi @smarlet,

Can you share some details of how you're running your insert?

Ah I'm sorry, I am using the build in queries, exactly like this:

I have a 4 step form which needs to be filled in with information. At the end of the 4th step I have a button 'save' which runs a js query triggers the 4 queries in sequence.

Some of the queries are returning a foreign key needed in the subsequent query.

image

As you can see the js queries are like ms fast. The other queries range from 1-2 seconds.

I'd need to see the code in the JS / Queries to figure out what's going on, but JS queries are generally going to be very fast since they are (almost) always dealing with available data and just processing it. DB/Resource queries have to connect, execute, return data. The JS queries reporting runtimes of 0.0s seems strange if they are orchestrating the Postgres queries though, are you awaiting each response and then passing it along as additionalScope?

You can also get a bit more detail by hovering over the time number, and retool will provide you with details on what took time.

image