Implements queryRecords result set counting.