Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unindexed GenericForeignKey relationships are very slow to delete #347

Open
YPCrumble opened this issue Oct 24, 2022 · 1 comment · May be fixed by #348
Open

Unindexed GenericForeignKey relationships are very slow to delete #347

YPCrumble opened this issue Oct 24, 2022 · 1 comment · May be fixed by #348

Comments

@YPCrumble
Copy link
Contributor

First, thanks for maintaining this great library!

I'm getting very slow SQL times when deleting an action_object from my database if it triggers deletion of more than a few dozen notifications. Essentially, when a user deletes the action object, it requires deleting each of these hundred notification objects which takes a really long time. Per this Stack Overflow answer, it seems that an index on the appropriate GenericForeignKey field n the AbstractNotification model would solve the issue. Django also mentions it in the docs and refers to this open issue that the index might be created in the future: https://code.djangoproject.com/ticket/23435.

Would maintainers be open to adding this index by default, and potentially indexing each of the GenericForeignKey relations by default? If not, is there an easy way to do this simply in my application?

Thanks for considering it!

@YPCrumble
Copy link
Contributor Author

Also, I'd be happy to create a PR if that's helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants