tweak update_all_stats query