You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed a large performance hit when implementing mongo-cursor-pagination and I'm trying to determine if that is expected and if there is anything that can be improved. I'm using the Mongoose implementation set up like this:
Running it 3 times I now got an average ~900ms response, almost 2x higher.
test: 878.252ms
test: 945.973ms
test: 854.034ms
Luckily it doesn't appear to get worse any further down the line, so it still more performant than a limit/offset style pagination. But it just seems odd to me that it is so much slower than a normal .find() when no extra querying is added and uses the same limit and indexed field. Plus it seems odd that adding a next param again dramatically increases response.
The text was updated successfully, but these errors were encountered:
There's likely a missing index on the collection. Can you turn on Mongo query logging and report the exact Mongo queries that are run by this library? That will inform what index should be created.
I have noticed a large performance hit when implementing mongo-cursor-pagination and I'm trying to determine if that is expected and if there is anything that can be improved. I'm using the Mongoose implementation set up like this:
I have created 300,000 test records.
As a control, I used a standard
.find()
call with no query and limited to 20 results.Running it 3 times I got an average ~30ms response.
Next I tried using
.paginate
based on createdAt (which is indexed), still with no query and same 20 limit.Running it 3 times you can see I got an average ~500ms response, over 10x higher.
Next I tried used the same
.paginate
query and limit, but added thenext
token returned from the previous response.Running it 3 times I now got an average ~900ms response, almost 2x higher.
Luckily it doesn't appear to get worse any further down the line, so it still more performant than a limit/offset style pagination. But it just seems odd to me that it is so much slower than a normal
.find()
when no extra querying is added and uses the same limit and indexed field. Plus it seems odd that adding anext
param again dramatically increases response.The text was updated successfully, but these errors were encountered: