Speed up get_object_ids