Problem/Motivation
I was working on an issue with entity reference and views being slow under D7, but this seems to be affecting D8 as well.
In short - D7 field schema API foes not allow you in any way to define index that is based on generic field columns and custom ones.
For the entity reference example. THe following index is impossible to be defined in field schema API:
- deleted
- entity_type
- field_name_target_id
You can create it in D7 with the db_add_index, but for new fields this does not work.
For detailed description see this:
#2827782: Missing database index
Assigning the issue against D8, as both entity reference and views are both in core and they have this index missing.
Proposed resolution
Any ideas how to tackle this in D8 are welcome.
This is for D7:
For what I can see an alter hook of sort that will be called against the final field table schema only to the field's module might work.
- Best as it's going to be atomic.
A hook that will be invoked just to notify for field's creation, so modules can hook on it and add indexes with the existing API
- Possible but not perfect, as it non-atomic. Create + alter to add the index.
Remaining tasks
Decide on a solution for D7 & D8.
User interface changes
None.
API changes
Additions only.
Data model changes
None.
Comments
Comment #2
ndobromirov commentedComment #16
quietone commented@ndobromirov, thanks for reporting this and helping to improve Drupal.
There has been no discussion here for 8 years and the issue summary is not clear if this is a problem with Drupal 8+ or not. Therefore, I am setting the status to Postponed (maintainer needs more info) to get confirmation that this is an issue on Drupal 10 or Drupal 11. If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #17
smustgrave commentedSince there has been no follow up going to close out for now. If still an issue on D11 please reopen.