[
https://issues.apache.org/jira/browse/KYLIN-6039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17928329#comment-17928329
]
Guoliang Sun commented on KYLIN-6039:
-------------------------------------
h3. Root Cause
`org.apache.kylin.query.util.PrepareSQLUtils#findNextPlaceHolder` iterates
through the SQL character by character, and during each iteration, it calls
`org.apache.kylin.query.util.PrepareSQLUtils#identQuoting`.
Within `identQuoting`, `kylinConfig.getCalciteExtrasProperties()` is called
twice, and each call traverses all Kylin configurations. When the SQL is long,
the number of iterations becomes very large. For example, if the SQL length is
8000 and there are 300 parameters, the total number of iterations is `8000 *
600`.
h3. Dev Design
Move the `identQuoting` logic outside the loop, extract its result, and pass
the value into the loop. After this optimization, the number of iterations will
be reduced to `8000 + 300`.
> Performance Optimization for Long SQL Parsing with Dynamic Parameters
> ---------------------------------------------------------------------
>
> Key: KYLIN-6039
> URL: https://issues.apache.org/jira/browse/KYLIN-6039
> Project: Kylin
> Issue Type: Improvement
> Affects Versions: 5.0.0
> Reporter: Guoliang Sun
> Priority: Major
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)