From 296108c5a3a61fa4b55254dcebd4e864305c16eb Mon Sep 17 00:00:00 2001 From: wangfeihuo Date: Fri, 18 Apr 2025 10:31:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dunknow=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=8E=E6=95=B4=E5=BD=A2=E5=9B=A0=E4=B8=BA=E9=9A=90=E5=BC=8F?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E5=AF=BC=E8=87=B4=E7=B4=A2=E5=BC=95=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...02\346\225\260\350\257\264\346\230\216.md" | 46 +++++++++++++++++++ ...02\346\225\260\350\257\264\346\230\216.md" | 46 +++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git "a/content/docs-lite/zh/docs/ExtensionReference/dolphin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" "b/content/docs-lite/zh/docs/ExtensionReference/dolphin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" index 884e178e8..1b27ab458 100644 --- "a/content/docs-lite/zh/docs/ExtensionReference/dolphin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" +++ "b/content/docs-lite/zh/docs/ExtensionReference/dolphin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" @@ -1315,3 +1315,49 @@ openGauss=# select * from t_prepare_010; (1 row) ``` + + +## dolphin.transform_unknown_param_type_to_match_index_first + +**参数说明**:该参数打开后,对于谓词条件,如果谓词左右分别是整型索引列和未知类型的参数类型,那么优先将未知类型的参数解释成索引列的类型进行比较,从而避免因为隐式转换导致索引失效的问题。 + +该参数目前属于USERSET类型参数,请参考[表1](dolphin-重设参数.md#zh-cn_topic_0283137176_zh-cn_topic_0237121562_zh-cn_topic_0059777490_t91a6f212010f4503b24d7943aed6d837)中对应设置方法进行设置。 + +**取值范围**:布尔型 + +**默认值**:false + +**示例**: + +``` +openGauss=# create table test_index(c1 int, c2 varchar); +CREATE TABLE +openGauss=# insert into test_index values (generate_series(1,100), generate_series(1,100)); +INSERT 0 100 +openGauss=# create index index1 on test_index(c1); +CREATE INDEX +openGauss=# analyze test_index; +ANALYZE +openGauss=# set dolphin.transform_unknown_param_type_to_match_index_first=off; +SET +openGauss=# prepare s1 as select * from test_index where c1 = ?; +PREPARE +openGauss=# explain execute s1 using 1; + QUERY PLAN +-------------------------------------------------------------------------------- + Seq Scan on test_index (cost=10000000000.00..1000000000250.00 rows=1 width=6) + Filter: ((c1)::double precision = $1) +(2 rows) + +openGauss=# set dolphin.transform_unknown_param_type_to_match_index_first=on; +SET +openGauss=# prepare s1 as select * from test_index where c1 = ?; +PREPARE +openGauss=# explain execute s1 using 1; + QUERY PLAN +------------------------------------------------------------------------- + [Bypass] + Index Scan using index1 on test_index (cost=0.00..8.27 rows=1 width=6) + Index Cond: (c1 = $1) +(3 rows) +``` \ No newline at end of file diff --git "a/content/zh/docs/ExtensionReference/dolphin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" "b/content/zh/docs/ExtensionReference/dolphin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" index 5df5d5adb..c635d8d22 100644 --- "a/content/zh/docs/ExtensionReference/dolphin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" +++ "b/content/zh/docs/ExtensionReference/dolphin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" @@ -1316,4 +1316,50 @@ openGauss=# select * from t_prepare_010; 1 (1 row) +``` + + +## dolphin.transform_unknown_param_type_to_match_index_first + +**参数说明**:该参数打开后,对于谓词条件,如果谓词左右分别是整型索引列和未知类型的参数类型,那么优先将未知类型的参数解释成索引列的类型进行比较,从而避免因为隐式转换导致索引失效的问题。 + +该参数目前属于USERSET类型参数,请参考[表1](dolphin-重设参数.md#zh-cn_topic_0283137176_zh-cn_topic_0237121562_zh-cn_topic_0059777490_t91a6f212010f4503b24d7943aed6d837)中对应设置方法进行设置。 + +**取值范围**:布尔型 + +**默认值**:false + +**示例**: + +``` +openGauss=# create table test_index(c1 int, c2 varchar); +CREATE TABLE +openGauss=# insert into test_index values (generate_series(1,100), generate_series(1,100)); +INSERT 0 100 +openGauss=# create index index1 on test_index(c1); +CREATE INDEX +openGauss=# analyze test_index; +ANALYZE +openGauss=# set dolphin.transform_unknown_param_type_to_match_index_first=off; +SET +openGauss=# prepare s1 as select * from test_index where c1 = ?; +PREPARE +openGauss=# explain execute s1 using 1; + QUERY PLAN +-------------------------------------------------------------------------------- + Seq Scan on test_index (cost=10000000000.00..1000000000250.00 rows=1 width=6) + Filter: ((c1)::double precision = $1) +(2 rows) + +openGauss=# set dolphin.transform_unknown_param_type_to_match_index_first=on; +SET +openGauss=# prepare s1 as select * from test_index where c1 = ?; +PREPARE +openGauss=# explain execute s1 using 1; + QUERY PLAN +------------------------------------------------------------------------- + [Bypass] + Index Scan using index1 on test_index (cost=0.00..8.27 rows=1 width=6) + Index Cond: (c1 = $1) +(3 rows) ``` \ No newline at end of file -- Gitee