Count doesn't match the number of rows in a query?

If I don’t change the WHERE clause on a query, why would the count return a number larger than the rows of data? At least I think that is what is happening.

Table: Sellers
WHERE: SellersFundraisers[Sellers].Fundraisers.objectId = ‘856FC1D6-6BC3-4FC5-B0FF-F0840CFBEC9F’

Count says 243 -

If I try to get 1 row at offset 241, there is no data -


Your where clause condition contains relation.
In this case Backendless will make the join request which will return the number of occurrences from the resulting Cartesian set instead of the number of entries.


Hi @olhadanylova - Thanks for the explanation. I don’t follow that 100%, but that is OK. How do I go about fixing the issue? I have more than 100 records I need to loop through, and getting the count is how it is done in this example -


Hi Tim,

Instead of relying on the “Count” function (which is not great from the performance perspective), use the following algorithm:

The key element in the algorithm is to loop through the entire data set using pageSize and offset and check if the size of the response is less than the page size.

This algorithm will perform much better as it does not have any dependency on the API call obtaining the size of the collectoin (i.e. count).


Thanks @mark-piller