How to clear the `url_rewrite` table and regenerate products and categories urls?

Hi There!

The point is that I want to clear url_rewrite table and regenerate products and categories urls :slight_smile:

And I got issue exactly like this https://github.com/magento/magento2/issues/11102
So seems I cant delete old rows in table and this looks very strange, cause I do not uderstand what for I need to store billions of unneeded rows in db??
Maybe there exist some best practice how to work with(regenerate) url rewrites and somebody could point me to a good article?

Because after I remove all rows from url_rewrite, even if I save category from admin then only product’s rows added to url_rewrite table.

Thank you,
Vlad.