[
https://issues.apache.org/jira/browse/CALCITE-5284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17606371#comment-17606371
]
Benchao Li commented on CALCITE-5284:
-------------------------------------
This makes me wonder that aren't we always prefer pushing down operators to
JDBC as much as possible? If the answer is yes, I'm not sure I understands the
cost model of the JDBC Adapter now:
* {{JdbcProject}} multiplier is 0.8
* {{JdbcSort}} multiplier is 0.9
* {{JdbcUnion}} and {{JdbcTableModify}} multiplier is 0.1
* {{JdbcToEnumerableConverter}} multiplier is 0.1
* Others multiplier is the 1.0
Is there any reason for this design, could anyone who knows the background help
me to understand this?
> JDBC rules create inefficient plan
> ----------------------------------
>
> Key: CALCITE-5284
> URL: https://issues.apache.org/jira/browse/CALCITE-5284
> Project: Calcite
> Issue Type: Bug
> Environment: Calcite 1.31.1. on Mac
> Reporter: Ulrich Kramer
> Priority: Major
>
> The following unit test for {{JdbcAdapterTest}} fails:
> {code:java}
> @Test void testOffset() {
> CalciteAssert.model(FoodmartSchema.FOODMART_MODEL)
> .query("select * from \"sales_fact_1997\" limit 10 offset 20")
> .explainContains("PLAN=JdbcToEnumerableConverter\n" +
> " JdbcSort(offset=[20], fetch=[10])\n" +
> " JdbcTableScan(table=[[foodmart, sales_fact_1997]])")
> .runs();
> }
> {code}
> For an offset less than 13, an efficient plan is created. With an offset
> above 13, the plan looks like this:
> {code}
> EnumerableLimit(offset=[20], fetch=[10])
> JdbcToEnumerableConverter
> JdbcTableScan(table=[[foodmart, sales_fact_1997]])
> {code}
> which can lead to enormous latency times, since the entire table is loaded
> via JDBC.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)