N1QL and Total Record Count for Paging

I am wondering if there is an update or any change to the count(*) for a query. I am in the middle of starting to implement
paging support for my grid’s. One of the requirement is to return the total record count so that my grid can calculate the nbr of pages etc. I read in some discussions that there might be a support for count without a separate query but i could not find anything.

we already have support for count(*). More efficient. https://blog.couchbase.com/understanding-index-grouping-aggregation-couchbase-n1ql-query/

without any predicate is very fast. It reads from bucket stats and returns.
If you have any predicate we need go through index or fetch document and count on the fly.
If query needs sort and not using index order sortCount in metrics of N1QL query gives total qualified rows.
You also have option of using views and SDK.


I know there is the select count(*) but it requires a separate query to be send which takes, time, resources as well need to maintain separate N1QL query staments

Any update here?
It’s very rare when you develop an application that you need to count ALL the documents, without any WHERE criteria.

Why doesn’t SELECT have totalHits? Like FTS has

The totoal counts will not available until you process all possible records. That will be waste of resources.
Application should do two separate queries first do count and then do pagination.