ENG-5024 in-transaction optimized count(*)