N1QL query performance with LIMIT and OFFSET

I am running a query on around 1M records, using LIMIT and OFFSET to get a page of items.

The query looks like this:

select userId, max(score) as score, nick from gamebucket
where score is not null and app = "game_pc"
group by userId 
order by score desc
limit 35 offset 10000

Result set looks like this:

[
  {
    "nick": "Zigzag Deadline",
    "score": 24989,
    "userId": "user_-qcZnaNpZ7rLo6jPxX-b"
  },
  {
    "nick": "Zigzag Shoulder",
    "score": 24989,
    "userId": "user_-Y3G4w-BfIx-x6VLktcw"
  }
]

Currently the query takes around 4-5 min to complete.
Is there some way to optimize it?

Thank you! :eyeglasses:

Hello, this is an issue that will be addressed in the next release. A first Couchbase developer preview will be available in Spring. You can follow this issue here https://issues.couchbase.com/browse/MB-17202 .

1 Like

Hello, As per the update in https://issues.couchbase.com/browse/MB-17202 the fix is updated in 4.5. I am using 4.5.1 CE. I have the same issue. Is it a known issue? whether fixed or not?