[ 
https://issues.apache.org/jira/browse/KYLIN-5859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17865862#comment-17865862
 ] 

pengfei.zhan commented on KYLIN-5859:
-------------------------------------

h1. RC

As we can see, because there are many `UNION ALL` operations in the SQL, a 
significant amount of time is spent on the 
`org/apache/kylin/query/engine/SQLConverter.convertSqlToRelNode` conversion 
during the execution process.

!42877.1.png|width=826,height=86!

This matches the timeline in the log.

!42877.2.png|width=826,height=176!

Additionally, searching for 
`org/apache/kylin/query/schema/OLAPTable.getRowType` accounts for 84.44% of the 
time spent during the conversion process.

!42877.3.png!

The time spent on `org/apache/kylin/query/schema/OLAPTable.getSourceColumns` 
accounts for 77.78%.

!42877.4.png!

!42877.5.png|width=845,height=897!

org/apache/kylin/metadata/project/NProjectLoader.listEffectiveRewriteMeasures 
cost the most,
 * org/apache/kylin/metadata/cube/model/NDataflow.getMeasures
 * org/apache/kylin/metadata/cube/model/NDataflow.getModel
 * org/apache/kylin/metadata/model/NDataModelManager.listAllModelIds
 * org/apache/kylin/metadata/project/NProjectLoader.belongToFactTable

Each `SELECT` statement within a `UNION ALL` is executed once, triggering 
`org/apache/calcite/sql/validate/SqlValidatorImpl.validateSelect`, which in 
turn calls `org/apache/kylin/query/schema/OLAPTable.getRowType`. The cumulative 
time for these operations adds up significantly.

> Add cache in ProjectBundle for effectiveRewriteMeasures of table
> ----------------------------------------------------------------
>
>                 Key: KYLIN-5859
>                 URL: https://issues.apache.org/jira/browse/KYLIN-5859
>             Project: Kylin
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: 5.0.0
>            Reporter: pengfei.zhan
>            Assignee: pengfei.zhan
>            Priority: Major
>             Fix For: 5.0.0
>
>         Attachments: 42877.1.png, 42877.2.png, 42877.3.png, 42877.4.png, 
> 42877.5.png
>
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to