You should read multiple "batches" specifying last key received from
previous batch as first key for next one.
For large databases I'd recommend you to use statistical approach (if it's
feasible). With random parittioner it works well.
Don't read the whole db. Knowing whole keyspace you can read pa
default count is 100, set this to some max value, but this won't guarantee
actual count.
Something like paging can help in counting. Get the last key as start in
second query, end as null, count as some value. But this will port data to
client where as we only need count.
Other solution may be (i