Optimised count query used in paginator adapter