#Reading is too slow with only 17 documents on a collection

11 messages · Page 1 of 1 (latest)

atomic valve
#

What am i doing wrong here, reading takes up to 6 secs to get the data
there are 27 attributes, 3 of theme are relationships
I have tried with multiple combinations of indexes (as i need searching)
i also tried with only one index ,an $updatedAt key index
It's pretty much inusable at this point, cause it's meant to be used for thousands of documents

atomic valve
#

This is how i get my list, i only get 12 elements at a time
also search on an attribute on demand

ClientDatabase.database!.listDocuments(
            databaseId: databaseId,
            collectionId: vehiculeid,
            queries: [

              if(i==2)
                Query.equal('annee_util', int.tryParse(searchKey)??9999),
              if(i!=2)
              Query.search(getAttributeForSearch(i), searchKey),
              if(filters.containsKey('yearmin'))
                Query.greaterThanEqual('annee_util', int.tryParse(filters['yearmin']!)),
              if(filters.containsKey('yearmax'))
                Query.lessThanEqual('annee_util', int.tryParse(filters['yearmax']!)),
              if(filters.containsKey('genre'))
                Query.equal('genre', filters['genre']),
              if(filters.containsKey('marque'))
                Query.equal('marque', filters['marque']),
              Query.limit(count),
              Query.offset(startingAt),
              getQuery(sortedBy, sortedAsc),
            ]);
atomic valve
#

Anything ?

ornate mural
atomic valve
#

But the search is only used if there is something typed in the TextBox, by default it's not
My problem here is the default reading
By default, it's only 3 queries :

Query.limit(count),
Query.offset(startingAt),
Query.orderAsc('\$id'),

(order depending on the column clicked by the user)

Sorry about the code

atomic valve
#

Is it not the presence of the 3 relationships in the Collection ?
2 of those collection have relationships with other tables themeselves.
Maybe the fact that it's downloading those values in addition can be slow ? should i change those relationships into a simple String value ?

atomic valve
#

Well, after replacing the relationships with a simple String (document id), it's now loading under 1s

I guess relationships are not meant to be used with a list of data that is meant to be read multiple times

ornate mural