Increase query timeout greater than 2min

Hello, currently I'm creating a app that does a request to an API, but inside the API the data base query takes more than 2min, because has more than 1M records. My question is if its possible to increase the retool API request timeout more than 2min? or if I have other way to do that by javascript.

Kind Regards,
Hugo Loureiro

Did you look in the advanced tab? Not sure but if you’re running on the cloud instance I would ask the Retool team.

Hey @HugoLoureiro, welcome to the community :hugs:

There's a max timeout of 2 minutes on queries which you can't bypass.

I would change the way you're getting your data. Having one call query millions of records is intense.

Could you paginate / batch your queries?

Hey @minijohn, thank you for you answer.
Even if run asynchronously using XMLHttpRequest for example and fire an event when the response arrives? Do I still have the timeout problem?

From what I see, all queries have the max 2 min timeout.

Still think you should be batching/paginating these requests tho.

Hi @HugoLoureiro, queries running on Cloud orgs have a maximum timeout of 2 minutes but JS queries, since they're run in the browser, can run longer. I personally haven't tried running XMLHttpRequest from a JS query on a resource that will return after 2 minutes but it could be worth a shot. You would, however, likely have to allow null origins on your endpoint since the request is coming from a sandbox and that typically isn't recommended. Additionally, as @minijohn mentioned, it's also could be a good idea to batch your request regardless. 1M records is a lot to be pulling into Retool and you're likely to run into issues handling that many records.

Thank you @Kabirdas and @minijohn for your reply :slight_smile:
Yes, but I will not receive 1M records, the query takes a long time to run to find what I want inside a table that has 1M records, I'm searching for records for a certain period of time, with a maximum of 1 month. I'll try with XMLHttpReques.

Thank you both

Hi, @HugoLoureiro, l know it hasn't been that long since your initial post, but I am facing the same problem. I am not pulling that much data; it's just looking for data over several months, so it takes a long time.

I am also new to Retool and JavaScript programming; this does not help :smile:.

-- Billy

I'm having this question too.
I want to get something from our API, which is sum from many rows to return a single number, so pagination is not an option.

@HugoLoureiro Thank you for clarifying! I just wanted to check in and see if you were able to get this working at all?

@Billy Sorry I missed this! In general, creating a new post is a better way to get new responses. Going forward, we're working on systems that won't get replies lost like this! If you're still blocked, would you mind sharing more about your current setup? For example, the resource type, screenshots of your query, etc.

@hiep95 I'd ask the same to you! What does your setup look like? What does your query look like? How many rows are you pulling in?