Skip to content

Deployment

Custom DB indexes

LogEntry, django_admin_log

Blender ID relies heavily on admin log, reading which becomes an issue as soon as the amount of records reaches hundreds of thousands.

The reason for this slowdown is the fact that generic foreign keys used there cannot be easily indexed by ORM means, see https://code.djangoproject.com/ticket/30122 for more details. To deal with this issue, production Blender ID's database has the following index, which is not part of any migrations:

CREATE INDEX django_admin_log_content_type_id_object_id ON django_admin_log (content_type_id, object_id(10)) LOCK NONE;