Problem with memory when running larger N1QL query

N1QL will stream the results, surprising N1QL gives error for 20K documents. Check resultSize at the end of the query. Is this more than request-size-cap (default 67108864).

Could you please try the query in cbq shell without limit and offset.

If resultSet is large to reduce memory consumption, best way to do pagination is prepare statement with offset, limit as parameters and execute prepare statement repeatedly changing offset ( if resultCount == limit increase offset by limit).