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
what's your code?
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),
]);
Anything ?
Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting
Hmm the search might be slowing things down a lot 😕
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
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 ?
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
Oh ya possibly then
Maybe it's fetching more data than you need and that's making it slower. Hopefully, when we add queries on relationships, you can add queries to optimize this
Can't wait for query yeah, but for now, i'll stick with the IDs
Thank you for your time