Optimize simple count queries so that they can execute more quickly.
Only show the timeline if there are no more than 500,000 records.