The site I'm working on is a webshop type of site, and it can have any amount of products in it's database which are all categorized somehow and their categories can change, so based on a product's category they all have a long url so it's something like:
The site is also set up in a way that
example.com/p/id, would automatically 301 redirect to the full URL.
The problem with the long URLs is that I have to query the category for each product when generating the sitemap, and doing this with short links would be a way faster process because those only need product IDs.
When generating a sitemap, would it be ok to use the short links of a product instead of the long ones and would it affect SEO at all?