It's common to filter on this string field (which is effectively an enum of a known set) but it's not indexed, so this operation can be very slow when run across casebooks.
This comes up in the Django admin especially: any time contentnode.resource_type is referenced as something to filter on, Django will automatically want to do select distinct resource_type from content_node and then need to iterate over 1,001,118 rows to retrieve 5 or so known values. This particular case can be mitigated by a custom filter.
Note that like #1767, adding the index now will probably take quite some time and might need to be done carefully as part of a migration.
It's common to filter on this string field (which is effectively an enum of a known set) but it's not indexed, so this operation can be very slow when run across casebooks.
This comes up in the Django admin especially: any time
contentnode.resource_type
is referenced as something to filter on, Django will automatically want to doselect distinct resource_type from content_node
and then need to iterate over 1,001,118 rows to retrieve 5 or so known values. This particular case can be mitigated by a custom filter.Note that like #1767, adding the index now will probably take quite some time and might need to be done carefully as part of a migration.