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

add proper db indexes #4

Open
harmv opened this issue Mar 31, 2010 · 0 comments
Open

add proper db indexes #4

harmv opened this issue Mar 31, 2010 · 0 comments

Comments

@harmv
Copy link

harmv commented Mar 31, 2010

django-email-confirmation misses some obvious database indexes

We found this issue when using email-confirmation on really large databases.

2 issues found:
EmailConfirmation.confirmation_key <- you always do a lookup with confirmation_key as key
EmailAddress.email <- when looking for dups etc, you query on this key

patch below:

Index: 3rdparty/django-email-confirmation/emailconfirmation/models.py
===================================================================
--- 3rdparty/django-email-confirmation/emailconfirmation/models.py      (revision 417)
+++ 3rdparty/django-email-confirmation/emailconfirmation/models.py      (working copy)
@@ -44,7 +44,7 @@
 class EmailAddress(models.Model):

     user = models.ForeignKey(User)
-    email = models.EmailField()
+    email = models.EmailField(db_index=True)
     verified = models.BooleanField(default=False)
     primary = models.BooleanField(default=False)

@@ -135,7 +135,7 @@

     email_address = models.ForeignKey(EmailAddress)
     sent = models.DateTimeField()
-    confirmation_key = models.CharField(max_length=40)
+    confirmation_key = models.CharField(max_length=40,db_index=True)

     objects = EmailConfirmationManager()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant