suddenly, my page got so many users in db that the a filter for email over the auth_user
table almost failing because of the extremely big number of users.
Since the table comes built-in, I need to add db_index=True
to columns in this table, any idea how to do this?
One quick and easy way would be to manually add the index using
RunSQL
in a migration.It's not very elegant. For one thing, the migration will be for a different app (since you don't control the
auth
migrations). For another, the schema will technically be out of sync with the database. However, I don't think there are any negative consequences in this case, since Django doesn't do anything withdb_index
other than create the index.