Reduced SQL queries in updateStats