Replace db_index=True with manually defined indexes
There are two indices on ElementType.slug
:
CREATE INDEX documents_elementtype_slug_d7b48d88 ON public.documents_elementtype USING btree (slug);
CREATE INDEX documents_elementtype_slug_d7b48d88_like ON public.documents_elementtype USING btree (slug varchar_pattern_ops);
The first index is useful since we often filter by element type name or look up an element type by its name, but the second one is unnecessary since we never use slug__contains=…
or slug LIKE '…'
.
This pattern seems to be found elsewhere as well: Repository.hook_token
, Repository.url
, ImageServer.url
also have LIKE
indices.
Edited by Erwan Rouchet