No need to lock the database when counting rows

Merged username-removed-71423 requested to merge jensj/ase:lockfix into master