performance: Use CONSTRUCT query for dimension values metadata #1218
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims at improving the performance of dimension values fetching by replacing several SELECT queries with one CONSTRUCT query.
Observations
I compared the performance of the old and new way of fetching and included the results below. I based these measurements on four datasets:
opening each one in the editing mode and triggering fetching of dimension metadata values the same number of times for each dataset.
I've also removed the conditions to limit inclusion of some properties based on scale type, as I am not 100% sure if they are needed anymore (e.g. if dimension values description can really only be present when scale type is either ordinal or nominal). Also, when they were added to the data, I think it makes sense to include them even when scale type is mapped wrongly. When they were removed, the performance of CONSTRUCT queries based on 406 new queries was better than SELECT queries by 0.04%.
cc @adintegra @Rdataflow