Follow up for #1498674: Refactor node properties to multilingual
Postponed on
- #1498674: Refactor node properties to multilingual
- #1497374: Switch from Field-based storage to Entity-based storage
- #2004330: [META] Convert queries to entity field query v2
- #1498720: Make the default SQL storage controller automatically generate tables for every defined entity type
Problem/Motivation
There was not much room for optimization in #1498674: Refactor node properties to multilingual.
However the following issues make it possible to do some optimization:
- #1497374: Switch from Field-based storage to Entity-based storage
- #2004330: [META] Convert queries to entity field query v2
- #1498720: Make the default SQL storage controller automatically generate tables for every defined entity type
They open up the possibility for an interesting proposed resolution.
Performance regressions in 1498674 effected both single language sites and sites with multiple languages. The proposed improvements here will confine the performance regression to multilingual environments, improving (restoring) single language site performance.
Proposed resolution
Once the SQL storage is under the full control of the entity system we can automatically alter primary keys and queries depending on whether we are in a monolingual or multilingual environment. We have a couple of recurring patterns to switch from a monolingual query to a multilingual one, which should not be hard to automate.
Drop composite primary key and set it to just nid as primary key making the monolingual query, for example:SELECT title FROM {node_field_data} WHERE status = 1 AND promote = 1 ORDER BY created
as performant as HEAD was before 1498674.
Remaining tasks
Open follow-ups for each performance improvement that is not automated.
Consider doing a meta which would have an issue for each query.
Identify the patterns. List examples.
Automate (write a script to use the patterns identified and change the code?) the improvements.
User interface changes
None.
API changes
None.
Original report in issue summary of #1498674: Refactor node properties to multilingual
there is not much room for optimization in this issue, however #1497374: Switch from Field-based storage to Entity-based storage, the contextual conversion of entity queries to EFQ2 and #1498720: Make the default SQL storage controller automatically generate tables for every defined entity type open up for some interesting scenario: once the SQL storage is under the full control of the entity system we can automatically alter primary keys and queries depending on whether we are in a monolingual or multilingual environment. We have a couple of recurring patterns to switch from a monolingual query to a multilingual one, which should not be hard to automate. This would let us confine the performance regression to multilingual environments, which should be a fair compromise.