Upon attempting to delete a user and all associated content, relation_query_enforce_distinct_endpoints_alter generates an SQL query that will run for a very very long time (i.e. I manually killed it after running for 30 hours).

Details:
I have a site with six relations, one of which hooks into the user account. When account cancel is attempted, it generates the query in the attachment and subsequently locks the user table from further changes until the SQL process is manually killed.

CommentFileSizeAuthor
crazy-big.sql_.txt55.11 KBzxaos
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikran’s picture

mikran’s picture

Category: Support request » Bug report

Actually I think this is different issue and why an earth would anyone need to check for uniqueness of relations that have that many endpoints (20+).

I think the solution for this is to limit relation exists calls to just 2 endpoints, so the question is "Are these two entities related?". And relation type uniqueness should then be limited to binary relations only. Altough that's an API change that will probably break a lot of things.

mikran’s picture

Title: relation_query_enforce_distinct_endpoints_alter generates code that will never finish » relation_relation_exists generates crazy queries if relations should be unique with many endpoints (like 20+)

But I believe your situation should be fixed if you remove the unique setting from the relation type. Then these crazy queries will not be generated.