feat: support @runtime views
#1350
Open
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.
Replace view references when they are annotated with
@runtime.This is an opt-in version of #141.
@runtimeviews with their definitionqueryBookshopserviceslocalizedviews (localizedcolumns are not represented in thequery)@fiori.draft.enabledentitiesCREATESELECTSAVE(cqn4sqlquery conflicts withresolveView)Support UNION viewsPerformance Improvements
The primary performance goal of allowing for runtime views is to reduce the number of views deployed into the database. This comes at the cost that the
SQLstatements send to the database are larger as they include the tree of runtime views inside the query.View flattening
When walking over the view tree it is possible to flatten views into a smaller number of queries. If there are a number of projections which rename certain columns. This renaming can be done in a single shot which removes redundant information. The main goal of an optimization like this is to reduce the size of the generated
SQLstatement.Reduced view Columns
As the query is known at the point the runtime view is addressed. It is possible to reduce the columns the view exposes to only the columns used inside the consuming query. When this is done for columns that include path expressions the correlating
joinwill automatically disappear from the final query representing the runtime view. Which has been shown in earlier experiments to enable exponential performance improvements for all supported databases (#892).Join removal
Very similar to the Reduced view Columns concept, but instead removing the path expression from the view definition it is possible to identify the columns that are being sourced from a
joinquery in the view and remove the unused joins from the view definition. Which will prevent the database optimization logic from having to identify the cardinality of thejointo determine whether it is required to execute thejoin. As theCSNmodel has more metadata information available to it then the databases have available to them it is more straight forward to identify the cardinality of thejoinallowing for quicker removal tactics.