Improved update_indexes_internal perfomance