Saving slugs results in memory exhaustion
Description
Just saving a non unique slug in a database that has a lot of entries (Not like an insane amount, just 500) seems to result in a lot of queries and then memory exhaustion
I already increased the memory to 512Mo and it was ok for a few weeks, but now it exceeds the 512Mo limit again
Something is terribly wrong in there, here is the query trace from sentry as we can see there is some huge queries being run
I will try to investigate the cause
So apparently the slug table has grown to an incredible size (70Mb) with each entry having hundreds of duplicated non active slugs
Ugh, this sounds really bad, we'll be looking into it asap.
Does this PR help by any chance? I have not reviewed it yet.
Very likely yes, not sure if the PR solves it, but the issue should definitely because of the same thing, I have been looking at the query log and it seems 3 queries are duplicated (because a function is called multiple times when the result could be cached) in the code path and the one retrieving the list of all the existing ids is not even needed (it can be inlined with a not condition on the foreign key), I will send in a PR with those improvements