const myScore = 50;
await db.collection("scores")
.where("score", ">=", myScore)
.orderBy("score")
.limit(10)
.get();
or
await db.collection("scores")
.where("score", ">=", myScore)
.limit(10)
.orderBy("score")
.get();
I’m expecting that orderBy will work faster if I use it after limit.
>Solution :
The performance of the two queries is exactly the same. It’s not possible to limit before order. The limit is always taken from the final result, after all filters and orders are applied.