Firestore slow queries when using Retool


  • Goal:
    We aim to optimize our Firestore queries when using Retool. The expected behavior is for Firestore queries to execute quickly, similar to their performance when run locally.

  • Steps:
    We have set up Firestore queries within Retool, both using the graphical interface (GUI) and raw query syntax. However, we are experiencing significant delays when these queries are executed on the Retool hosted environment, compared to when they are run locally. We have consulted the Retool documentation on optimizing queries and Firestore best practices but have not found a resolution.

  • Details:
    Here are some relevant code snippets and query syntax examples demonstrating the issue:

    // Example of a Firestore query in Retool GUI
    db.collection('users').get().then((snapshot) => {
        const users = snapshot.docs.map(doc => doc.data());
        return users;
    });
    
    // Example of a Firestore raw query in Retool
    SELECT * FROM users;
    

    Despite these straightforward queries, the performance is notably slower on the hosted Retool environment. We do not receive any specific error messages, just prolonged execution times.

  • Screenshots:
    Below are some screenshots of our Retool app/editor setup, illustrating the query configurations and the latency issues:

    Firestore Query GUI
    Firestore Raw Query

We appreciate any insights or suggestions to help resolve these performance issues.


Hi @Eric_Vassille, welcome to the forum! :wave:
Where in the world are we located? Enabling Retool outbound regions may improve execution time depending on where we are.

Hi Paula, I put Europe on both but it was not better.

Interesting, how much data are we retrieving? :face_with_monocle:

I found this Medium post that might be helpful:

Although, you did mention that you have followed Firestore best practices.

Was there no improvement on the query runtime when we changed the outbound region?