5

Any ideeas why Cloud Firestore connection is slow for my client yet for me is almost instant? The Firebase server selected is europe-west3, my client is in UK and I am in Romania.

He has a relative good download speed, according to speedtest.net, but downloading data from Cloud Firestore is extremely slow. Even 6 documents, with a total of 8 small fields, are loading extremely slow.

6
  • Show your code please Mar 8, 2021 at 6:56
  • @VadimPopov this is the code for getting those 6 documents I mentioned: collection.orderBy("dateAdded", descending: true).snapshots(); A listener which gets all data from a collection;
    – adi
    Mar 8, 2021 at 8:35
  • Try updating google and firebase related packages Mar 9, 2021 at 8:58
  • @PavelShastov will try that as soon I will be able.
    – adi
    Mar 9, 2021 at 17:47
  • @adi Did you manage to figure out why this happened?
    – Bracher
    Jun 28, 2022 at 19:46

3 Answers 3

0

Have you checked Firebase Blog Post "Why is my Cloud Firestore query slow?"

I think you should use implement Indexing on your data.

Firebase provides powerful tools for ordering and querying your data. Specifically, Firebase allows you to do ad-hoc queries on a collection of nodes using any common child key.

A node's key is indexed automatically, so there is no need to index it explicitly.

3
  • I think Firebase already takes care of indexing all documents by all fields, hence the limitations it imposes when it comes to compound indexes
    – perepm
    Mar 8, 2021 at 13:41
  • the documentation you have linked refers to Realtime Database, an entirely different product
    – perepm
    Mar 8, 2021 at 13:42
  • Thank you for your answer but it isn't what I need. 1. You are mainly pointing to Realtime Database, which is different like ppicom mentioned. 2. I have looked at "Why is my Cloud Firestore query slow" but the issue is the same for both big and small data. For example it takes a long time to get the user info from the database which is a document with: name, email, phone number, uid and category id.
    – adi
    Mar 8, 2021 at 13:51
0

Not sure what might be the reason, but I think it is a great idea to make sure it is initilizing firebase before querying and logging errors.

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(App());
}

Initialize before operations:

await Firebase.initializeApp();

Put above code and operations on try, catch, log and see what happens when it is slow, it might be initializing in the wrong time or not initializing and taking extra time to operate.

0

The issue was with the browser.

On the same machine, but different browser there weren't any issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.