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:
🐛
Missing database index
Needs work
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.