How to get to 1-10 and 10-20 and 20-30 records by using N1QL query.
Please use LIMIT and OFFSET
@cihangirb Thanks i will check it.
Late update! For people arriving via Google, paging in N1QL queries is covered quite a bit here:
Is there any plans by the CB team to avoid doing an additional query to get the count of the total number of results?
At the moment we always have to do two queries to display something like “You are on page 2 of 5 pages showing 50 items of 250 total items”.
Both of our queries are having the same WHERE condition while the query getting the total number of results has a SELECT count(*)
My assumption is that this is a very common requirement and it maybe much more efficient to do this in Couchbase under the hood in one query instead of two separate queries. Maybe even optional would be fine.
Hi @synesty, Yes. We are investigating into approximate counts.
Our indexing team is working on this and could be exploited if the query is covered.
Also in 5.0, the count gets pushed down to the index service and you should see a big improvement in the response time when you execute your first query to get the count.
Thanks, that is great news Yes we are on 5.0 beta2 already and counts are fast. But the approximate counts would still be another great thing to reduce another query and make the code simpler and more intuitive.