omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

Django Association model missing index #967

Closed clintonb closed 8 years ago

clintonb commented 8 years ago

The Association model inherits from DjangoAssociationMixin, which performs a lookup when logging in. This lookup relies on the server_url and handle columns.

Due to the lack of indices on these columns this lookup results in a full table scan, which is non-performant for applications with large user bases.

Recommendations

  1. Add a compound index on the server_url and handle columns of the Association model.
  2. Update the documentation recommending that those classes inheriting DjangoAssociationMixin include the same compound index.
clintonb commented 8 years ago

After a quick glance, the documentation doesn't mention DjangoAssociationMixin, so I'm not sure of the value of including it or where to include it.