evonove/django-oauth-toolkit — pull request #146 by tchaumeny (2014-09-01 15:10:31+00:00)
Title: Add an index on AccessToken.token to speedup token verification

A report on our PostgreSQL database use showed that the most consuming query was this one :
```SQL
SELECT "oauth2_provider_accesstoken"."id", "oauth2_provider_accesstoken"."user_id", "oauth2_provider_accesstoken"."token", "oauth2_provider_accesstoken"."application_id", "oauth2_provider_accesstoken"."expires", "oauth2_provider_accesstoken"."scope" FROM "oauth2_provider_accesstoken" WHERE "oauth2_provider_accesstoken"."token" = '';
```

This pull request adds an index on the `AccessToken.token` field so that this very frequent query can run much faster.