Most efficient way to return total row count on a grouped N1QL query

Yes. If you have an ORDER BY, the metrics.sortCount field in the cbq shell output represents the total number of rows sorted, before applying OFFSET and LIMIT.

In your case, this would be the total number of groups.

1 Like