为了更快的定位您的问题,请提供以下信息,谢谢
【详述】问题详细描述
cte是一个两表join, 谓词是引用了cte后加的过滤, 实际执行计划中谓词被下推到了cte以下.
两个部分的谓词 一个是渠道是天猫 一个是渠道是京东, 导致了cte合并失效
请问能不能关闭谓词下推, 或者支持谓词合并之后下推 下推渠道是天猫或京东, 然后cte执行完成后再分别过滤天猫和京东.
上面是一个简化的执行计划, 真实的执行计划要复杂许多, 复用失效带来的性能影响非常大
为了更快的定位您的问题,请提供以下信息,谢谢
【详述】问题详细描述
cte是一个两表join, 谓词是引用了cte后加的过滤, 实际执行计划中谓词被下推到了cte以下.
请问能不能关闭谓词下推, 或者支持谓词合并之后下推 下推渠道是天猫或京东, 然后cte执行完成后再分别过滤天猫和京东.
上面是一个简化的执行计划, 真实的执行计划要复杂许多, 复用失效带来的性能影响非常大
发一下简化执行计划对应的sql,方便测试解决问题
/*"fabric-jobId" = '18f85aa4-9027-318f-7998-a0a2e91bbf00'*/ WITH
`cse1_auto` AS (SELECT `dwd_trd_sys_sale_order_detail_f`.`channel`, `dwd_trd_sys_sale_order_detail_f`.`shop_code`, `dwd_trd_sys_sale_order_detail_f`.`shop_name`, `dwd_trd_sys_sale_order_detail_f`.`product_code`, `dwd_trd_sys_sale_order_detail_f`.`spec_code`, `dwd_trd_sys_sale_order_detail_f`.`spec_name`, `dwd_trd_sys_sale_order_detail_f`.`sale_amount`, `dwd_trd_sys_sale_order_detail_f`.`sale_discount`, `dwd_trd_sys_sale_order_detail_f`.`sale_post`
FROM `nc_dev`.`dwd_trd_sys_sale_order_detail_f`),
`cse2_auto` AS (SELECT `dwd_trd_sys_sale_order_detail_f`.`channel`, `dwd_trd_sys_sale_order_detail_f`.`shop_code`, `dwd_trd_sys_sale_order_detail_f`.`shop_name`, `dwd_trd_sys_sale_order_detail_f`.`product_code`, `dwd_trd_sys_sale_order_detail_f`.`spec_code`, `dwd_trd_sys_sale_order_detail_f`.`spec_name`, `dwd_trd_sys_sale_order_detail_f`.`sale_amount`, `dwd_trd_sys_sale_order_detail_f`.`sale_discount`, `dwd_trd_sys_sale_order_detail_f`.`sale_post`
FROM `nc_dev`.`dwd_trd_sys_sale_order_detail_f`),
`cse3_auto` AS (SELECT `dwd_trd_sys_sale_order_detail_f`.`channel` AS `channel_1c4`, `dwd_trd_sys_sale_order_detail_f`.`product_code` AS `product_code_1c4`, `dwd_trd_sys_sale_order_detail_f`.`sale_amount` AS `sale_amount_1c4`, `dwd_trd_sys_sale_order_detail_f`.`sale_discount` AS `sale_discount_1c4`, `dwd_trd_sys_sale_order_detail_f`.`sale_post` AS `sale_post_1c4`, `dwd_trd_sys_sale_order_detail_f`.`shop_code` AS `shop_code_1c4`, `dwd_trd_sys_sale_order_detail_f`.`shop_name` AS `shop_name_1c4`, `dwd_trd_sys_sale_order_detail_f`.`spec_code` AS `spec_code_1c4`, `dwd_trd_sys_sale_order_detail_f`.`spec_name` AS `spec_name_1c4`
FROM `nc_dev`.`dwd_trd_sys_sale_order_detail_f`),
`cse4_auto` AS (SELECT `channel_1c4`, `sale_amount_1c4`, `sale_discount_1c4`, `sale_post_1c4`, `shop_code_1c4`, `shop_name_1c4`, `spec_name_1c4`, `$f66`
FROM (SELECT `dwd_trd_sys_sale_order_detail_f`.`channel` AS `channel_1c4`, `dwd_trd_sys_sale_order_detail_f`.`sale_amount` AS `sale_amount_1c4`, `dwd_trd_sys_sale_order_detail_f`.`sale_discount` AS `sale_discount_1c4`, `dwd_trd_sys_sale_order_detail_f`.`sale_post` AS `sale_post_1c4`, `dwd_trd_sys_sale_order_detail_f`.`shop_code` AS `shop_code_1c4`, `dwd_trd_sys_sale_order_detail_f`.`shop_name` AS `shop_name_1c4`, `dwd_trd_sys_sale_order_detail_f`.`spec_name` AS `spec_name_1c4`, CONCAT(CONCAT(CASE WHEN `dwd_trd_sys_sale_order_detail_f`.`product_code` IS NOT NULL THEN `dwd_trd_sys_sale_order_detail_f`.`product_code` ELSE '' END, '--'), CASE WHEN `dwd_trd_sys_sale_order_detail_f`.`spec_code` IS NOT NULL THEN `dwd_trd_sys_sale_order_detail_f`.`spec_code` ELSE '' END) AS `$f66`
FROM `nc_dev`.`dwd_trd_sys_sale_order_detail_f`) AS `dwd_trd_sys_sale_order_detail_f2`),
`cse6_auto` AS (SELECT `dim_product_spec`.`product_type`, `dim_product_spec`.`product_code`, `dim_product_spec`.`spec_code`
FROM `nc_dev`.`dim_product_spec`),
`cse7_auto` AS (SELECT `dim_product_spec`.`product_type`, `dim_product_spec`.`product_code`, `dim_product_spec`.`spec_code`
FROM `nc_dev`.`dim_product_spec`),
`cse8_auto` AS (SELECT `dim_product_spec`.`product_code` AS `product_code_mNe`, `dim_product_spec`.`product_type` AS `product_type_mNe`, `dim_product_spec`.`spec_code` AS `spec_code_mNe`
FROM `nc_dev`.`dim_product_spec`),
`cse9_auto` AS (SELECT `product_type_mNe`, `$f52`
FROM (SELECT `dim_product_spec`.`product_type` AS `product_type_mNe`, CONCAT(CONCAT(CASE WHEN `dim_product_spec`.`product_code` IS NOT NULL THEN `dim_product_spec`.`product_code` ELSE '' END, '--'), CASE WHEN `dim_product_spec`.`spec_code` IS NOT NULL THEN `dim_product_spec`.`spec_code` ELSE '' END) AS `$f52`
FROM `nc_dev`.`dim_product_spec`) AS `dim_product_spec2`),
`cse10_auto` AS (SELECT `cse4_auto`.`channel_1c4`, `cse4_auto`.`sale_amount_1c4`, `cse4_auto`.`sale_discount_1c4`, `cse4_auto`.`sale_post_1c4`, `cse4_auto`.`shop_code_1c4`, `cse4_auto`.`shop_name_1c4`, `cse4_auto`.`spec_name_1c4`, `cse4_auto`.`$f66`, `cse9_auto`.`product_type_mNe`, `cse9_auto`.`$f52`
FROM (`cse4_auto` LEFT JOIN `cse9_auto` ON `cse4_auto`.`$f66` = `cse9_auto`.`$f52`)),
`cse11_auto` AS (SELECT `cse10_auto`.`channel_1c4`, `cse10_auto`.`sale_amount_1c4`, `cse10_auto`.`sale_discount_1c4`, `cse10_auto`.`sale_post_1c4`, `cse10_auto`.`shop_code_1c4`, `cse10_auto`.`shop_name_1c4`, `cse10_auto`.`spec_name_1c4`, `cse10_auto`.`product_type_mNe`
FROM `cse10_auto`),
`cse14_auto` AS (SELECT `dim_shop_ext`.`shop_code`, `dim_shop_ext`.`business_category`
FROM `nc_dev`.`dim_shop_ext`),
`cse15_auto` AS (SELECT `dim_shop_ext`.`shop_code`, `dim_shop_ext`.`business_category`
FROM `nc_dev`.`dim_shop_ext`)
(SELECT `business_category_Onc`, `spec_name_1c4`, `product_type_mNe`, `channel_1c4`, `shop_name_1c4`, MAX(`xsje_r5m`) AS `$f5`, MAX(`xsyf_tJ2`) AS `$f6`, MAX(`xszkje_UJ7`) AS `$f7`, MAX(`xssr_OqY`) AS `$f8`, MAX(`jdxssr_rIr`) AS `$f9`, MAX(`xsje_pqp`) AS `$f10`, MAX(`xsyf_X0a`) AS `$f11`, MAX(`xszkje_nKt`) AS `$f12`, MAX(`xssr_u0G`) AS `$f13`, MAX(`tmxssr_JvN`) AS `$f14`
FROM ((SELECT `business_category_Onc`, `spec_name_1c4`, `product_type_mNe`, `channel_1c4`, `shop_name_1c4`, `xsje_r5m`, `xsyf_tJ2`, `xszkje_UJ7`, `xssr_OqY`, `jdxssr_rIr`, NULL AS `xsje_pqp`, NULL AS `xsyf_X0a`, NULL AS `xszkje_nKt`, NULL AS `xssr_u0G`, NULL AS `tmxssr_JvN`
FROM (SELECT `business_category_Onc`, `spec_name_1c4`, `product_type_mNe`, `channel_1c4`, `shop_name_1c4`, CAST(SUM(`$f5`) AS DOUBLE) AS `xsje_r5m`, CAST(SUM(`$f6`) AS DOUBLE) AS `xsyf_tJ2`, CAST(SUM(`$f7`) AS DOUBLE) AS `xszkje_UJ7`, CAST(CAST(CASE WHEN CAST(SUM(`$f5`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f5`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) - CAST(CASE WHEN CAST(SUM(`$f7`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f7`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) AS DECIMAL(38, 8)) + CAST(CASE WHEN CAST(SUM(`$f6`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f6`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) AS `xssr_OqY`, CAST(CAST(CASE WHEN CAST(SUM(`$f5`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f5`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) - CAST(CASE WHEN CAST(SUM(`$f7`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f7`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) AS DECIMAL(38, 8)) + CAST(CASE WHEN CAST(SUM(`$f6`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f6`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) AS `jdxssr_rIr`
FROM (SELECT `cse15_auto`.`business_category` AS `business_category_Onc`, `cse11_auto`.`spec_name_1c4`, `cse11_auto`.`product_type_mNe`, `cse11_auto`.`channel_1c4`, `cse11_auto`.`shop_name_1c4`, CAST(`cse11_auto`.`sale_amount_1c4` AS DECIMAL(38, 8)) AS `$f5`, CAST(`cse11_auto`.`sale_post_1c4` AS DECIMAL(38, 8)) AS `$f6`, CAST(`cse11_auto`.`sale_discount_1c4` AS DECIMAL(38, 8)) AS `$f7`
FROM ((SELECT `cse11_auto`.`channel_1c4`, `cse11_auto`.`sale_amount_1c4`, `cse11_auto`.`sale_discount_1c4`, `cse11_auto`.`sale_post_1c4`, `cse11_auto`.`shop_code_1c4`, `cse11_auto`.`shop_name_1c4`, `cse11_auto`.`spec_name_1c4`, `cse11_auto`.`product_type_mNe`
FROM `cse11_auto`
WHERE `cse11_auto`.`channel_1c4` = '京东') AS `cse11_auto` LEFT JOIN `cse15_auto` ON `cse11_auto`.`shop_code_1c4` = `cse15_auto`.`shop_code`)) AS `t`
GROUP BY `business_category_Onc`, `spec_name_1c4`, `product_type_mNe`, `channel_1c4`, `shop_name_1c4`) AS `t2`)
UNION ALL
(SELECT `business_category_Onc`, `spec_name_1c4`, `product_type_mNe`, `channel_1c4`, `shop_name_1c4`, NULL AS `xsje_r5m`, NULL AS `xsyf_tJ2`, NULL AS `xszkje_UJ7`, NULL AS `xssr_OqY`, NULL AS `jdxssr_rIr`, `xsje_pqp`, `xsyf_X0a`, `xszkje_nKt`, `xssr_u0G`, `tmxssr_JvN`
FROM (SELECT `business_category_Onc`, `spec_name_1c4`, `product_type_mNe`, `channel_1c4`, `shop_name_1c4`, CAST(SUM(`$f5`) AS DOUBLE) AS `xsje_pqp`, CAST(SUM(`$f6`) AS DOUBLE) AS `xsyf_X0a`, CAST(SUM(`$f7`) AS DOUBLE) AS `xszkje_nKt`, CAST(CAST(CASE WHEN CAST(SUM(`$f5`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f5`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) - CAST(CASE WHEN CAST(SUM(`$f7`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f7`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) AS DECIMAL(38, 8)) + CAST(CASE WHEN CAST(SUM(`$f6`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f6`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) AS `xssr_u0G`, CAST(CAST(CASE WHEN CAST(SUM(`$f5`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f5`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) - CAST(CASE WHEN CAST(SUM(`$f7`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f7`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) AS DECIMAL(38, 8)) + CAST(CASE WHEN CAST(SUM(`$f6`) AS DOUBLE) IS NOT NULL THEN CAST(SUM(`$f6`) AS DOUBLE) ELSE 0 END AS DECIMAL(38, 8)) AS `tmxssr_JvN`
FROM (SELECT `cse15_auto0`.`business_category` AS `business_category_Onc`, `cse11_auto0`.`spec_name_1c4`, `cse11_auto0`.`product_type_mNe`, `cse11_auto0`.`channel_1c4`, `cse11_auto0`.`shop_name_1c4`, CAST(`cse11_auto0`.`sale_amount_1c4` AS DECIMAL(38, 8)) AS `$f5`, CAST(`cse11_auto0`.`sale_post_1c4` AS DECIMAL(38, 8)) AS `$f6`, CAST(`cse11_auto0`.`sale_discount_1c4` AS DECIMAL(38, 8)) AS `$f7`
FROM ((SELECT `cse11_auto`.`channel_1c4`, `cse11_auto`.`sale_amount_1c4`, `cse11_auto`.`sale_discount_1c4`, `cse11_auto`.`sale_post_1c4`, `cse11_auto`.`shop_code_1c4`, `cse11_auto`.`shop_name_1c4`, `cse11_auto`.`spec_name_1c4`, `cse11_auto`.`product_type_mNe`
FROM `cse11_auto`
WHERE `cse11_auto`.`channel_1c4` = '天猫') AS `cse11_auto0` LEFT JOIN `cse15_auto` AS `cse15_auto0` ON `cse11_auto0`.`shop_code_1c4` = `cse15_auto0`.`shop_code`)) AS `t5`
GROUP BY `business_category_Onc`, `spec_name_1c4`, `product_type_mNe`, `channel_1c4`, `shop_name_1c4`) AS `t8`)) AS `t11`
GROUP BY `business_category_Onc`, `spec_name_1c4`, `product_type_mNe`, `channel_1c4`, `shop_name_1c4`)
CREATE TABLE `dwd_trd_sys_sale_order_detail_f` (
`__id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT "__id",
`data_source` varchar(1048576) NULL COMMENT "数据来源",
`company` varchar(1048576) NULL COMMENT "公司",
`sale_order_id` varchar(1048576) NULL COMMENT "销售主订单号",
`sale_order_detail_id` varchar(1048576) NULL COMMENT "销售子订单号",
`so_sale_order_id` varchar(1048576) NULL COMMENT "来源销售主订单号",
`so_sale_order_detail_id` varchar(1048576) NULL COMMENT "来源销售子订单号",
`order_type` varchar(1048576) NULL COMMENT "订单类型",
`order_source` varchar(1048576) NULL COMMENT "订单来源",
`order_status` varchar(1048576) NULL COMMENT "订单状态",
`dept_code` varchar(1048576) NULL COMMENT "部门编码",
`dept_name` varchar(1048576) NULL COMMENT "部门名称",
`distributor_code` varchar(1048576) NULL COMMENT "分销商编码",
`distributor_name` varchar(1048576) NULL COMMENT "分销商名称",
`warehouse_code` varchar(1048576) NULL COMMENT "仓库编码",
`warehouse_name` varchar(1048576) NULL COMMENT "仓库名称",
`channel` varchar(1048576) NULL COMMENT "渠道",
`shop_code` varchar(1048576) NULL COMMENT "店铺编码",
`shop_name` varchar(1048576) NULL COMMENT "店铺名称",
`salesman_code` varchar(1048576) NULL COMMENT "业务员编码",
`salesman_name` varchar(1048576) NULL COMMENT "业务员名称",
`buyer_id` varchar(1048576) NULL COMMENT "买家ID",
`buyer_name` varchar(1048576) NULL COMMENT "买家名称",
`telephone` varchar(1048576) NULL COMMENT "联系电话",
`express_company_code` varchar(1048576) NULL COMMENT "快递公司编码",
`express_company_name` varchar(1048576) NULL COMMENT "快递公司名称",
`express_number` varchar(1048576) NULL COMMENT "快递单号",
`receive_province` varchar(1048576) NULL COMMENT "收货省份",
`receive_city` varchar(1048576) NULL COMMENT "收货市",
`receive_district` varchar(1048576) NULL COMMENT "收货区",
`receive_address` varchar(1048576) NULL COMMENT "收货地址",
`product_id` varchar(1048576) NULL COMMENT "商品ID",
`spec_id` varchar(1048576) NULL COMMENT "规格ID",
`suite_code` varchar(1048576) NULL COMMENT "组合商品编码",
`suite_name` varchar(1048576) NULL COMMENT "组合商品名称",
`suite_spec_code` varchar(1048576) NULL COMMENT "组合规格编码",
`suite_spec_name` varchar(1048576) NULL COMMENT "组合规格名称",
`product_code` varchar(1048576) NULL COMMENT "商品编码",
`product_name` varchar(1048576) NULL COMMENT "商品名称",
`spec_code` varchar(1048576) NULL COMMENT "规格编码",
`spec_name` varchar(1048576) NULL COMMENT "规格名称",
`sale_num` double NULL COMMENT "销售数量",
`sale_price` double NULL COMMENT "销售单价",
`sale_amount` double NULL COMMENT "销售金额",
`sale_discount` double NULL COMMENT "销售折扣金额",
`sale_post` double NULL COMMENT "销售运费",
`sale_weight` double NULL COMMENT "销售重量",
`is_gift` varchar(1048576) NULL COMMENT "是否赠品",
`product_status` varchar(1048576) NULL COMMENT "商品状态",
`order_time` datetime NULL COMMENT "下单时间",
`pay_time` datetime NULL COMMENT "支付时间",
`order_sure_time` datetime NULL COMMENT "订单确认时间",
`send_time` datetime NULL COMMENT "发货时间",
`flag` varchar(1048576) NULL COMMENT "旗帜",
`label` varchar(1048576) NULL COMMENT "标签",
`remark` varchar(1048576) NULL COMMENT "备注",
`supplier_code` varchar(1048576) NULL COMMENT "供应商编码",
`supplier_name` varchar(1048576) NULL COMMENT "供应商名称",
`document_status` varchar(1048576) NULL COMMENT "单据状态",
`dt` varchar(1048576) NULL COMMENT "日分区"
) ENGINE=OLAP
PRIMARY KEY(`__id`)
COMMENT "DWD_系统销售订单明细表"
DISTRIBUTED BY HASH(`__id`)
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"enable_persistent_index" = "true",
"replicated_storage" = "true",
"fast_schema_evolution" = "true",
"compression" = "LZ4"
);
CREATE TABLE `dim_product_spec` (
`__id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT "__id",
`data_source` varchar(1048576) NULL COMMENT "数据来源",
`product_type` varchar(1048576) NULL COMMENT "商品类型",
`product_id` varchar(1048576) NULL COMMENT "商品ID",
`spec_id` varchar(1048576) NULL COMMENT "规格ID",
`suite_code` varchar(1048576) NULL COMMENT "组合商品编码",
`suite_name` varchar(1048576) NULL COMMENT "组合商品名称",
`suite_spec_code` varchar(1048576) NULL COMMENT "组合规格编码",
`suite_spec_name` varchar(1048576) NULL COMMENT "组合规格名称",
`product_code` varchar(1048576) NULL COMMENT "商品编码",
`product_name` varchar(1048576) NULL COMMENT "商品名称",
`spec_code` varchar(1048576) NULL COMMENT "规格编码",
`spec_name` varchar(1048576) NULL COMMENT "规格名称",
`company` varchar(1048576) NULL COMMENT "公司",
`channel` varchar(1048576) NULL COMMENT "渠道",
`shop_code` varchar(1048576) NULL COMMENT "店铺编码",
`shop_name` varchar(1048576) NULL COMMENT "店铺名称",
`brand` varchar(1048576) NULL COMMENT "品牌",
`category` varchar(1048576) NULL COMMENT "品类",
`series` varchar(1048576) NULL COMMENT "系列",
`unit` varchar(1048576) NULL COMMENT "单位",
`num` double NULL COMMENT "数量",
`weight` double NULL COMMENT "重量",
`pic` varchar(1048576) NULL COMMENT "图片",
`cost_price` double NULL COMMENT "成本单价",
`virtual_cost_price` double NULL COMMENT "虚拟成本单价",
`listing_time` datetime NULL COMMENT "上市时间",
`product_lifecycle` varchar(1048576) NULL COMMENT "商品生命周期",
`age_group` varchar(1048576) NULL COMMENT "岁段",
`product_ext` varchar(1048576) NULL COMMENT "商品扩展属性",
`dt` varchar(1048576) NULL COMMENT "日分区"
) ENGINE=OLAP
PRIMARY KEY(`__id`)
COMMENT "DIM_商品规格信息表"
DISTRIBUTED BY HASH(`__id`)
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"enable_persistent_index" = "true",
"replicated_storage" = "true",
"fast_schema_evolution" = "true",
"compression" = "LZ4"
);
CREATE TABLE `dim_shop_ext` (
`__id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT "__id",
`shop_code` varchar(1048576) NULL COMMENT "店铺编码",
`shop_name` varchar(1048576) NULL COMMENT "店铺名称",
`off_on_label` varchar(1048576) NULL COMMENT "线上线下",
`business_category` varchar(1048576) NULL COMMENT "经营类别"
) ENGINE=OLAP
PRIMARY KEY(`__id`)
COMMENT "DIM_店铺扩展信息表"
DISTRIBUTED BY HASH(`__id`)
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"enable_persistent_index" = "true",
"replicated_storage" = "true",
"fast_schema_evolution" = "true",
"compression" = "LZ4"
);
starocks中的通用子表达式优化没有生效, 这个sql是通过程序识别的通用子表达式生成 的cte到starrocks这边执行的
1、这种多层的cte沟通,是否可以在生成sql的时候,将底层逻辑调整一下,把最终查询的谓词直接写到cte构建的基表中,这种情况是可以实现谓词下推的
2、可以在sql中设置会话参数变量SET_VAR(cbo_cte_reuse_rate=0),强制复用cte,使用这种方式测试一下性能是否有波动