PDT-5433 Add reasonable statement limit to count queries