optimize statistics recalculation