diff --git a/content/zh/docs/AboutopenGauss/figures/SPQ_delete1.jpg b/content/zh/docs/AboutopenGauss/figures/SPQ_delete1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ae89af4b2a416696ef6382f039be121638d98723 Binary files /dev/null and b/content/zh/docs/AboutopenGauss/figures/SPQ_delete1.jpg differ diff --git a/content/zh/docs/AboutopenGauss/figures/SPQ_delete100.jpg b/content/zh/docs/AboutopenGauss/figures/SPQ_delete100.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7c0cc344ff5da8bb3960c78fe741c398be99ed4e Binary files /dev/null and b/content/zh/docs/AboutopenGauss/figures/SPQ_delete100.jpg differ diff --git a/content/zh/docs/AboutopenGauss/figures/SPQ_dml.jpg b/content/zh/docs/AboutopenGauss/figures/SPQ_dml.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0973af11f5782e3700201fe0920723baa2682416 Binary files /dev/null and b/content/zh/docs/AboutopenGauss/figures/SPQ_dml.jpg differ diff --git a/content/zh/docs/AboutopenGauss/figures/SPQ_insert.jpg b/content/zh/docs/AboutopenGauss/figures/SPQ_insert.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e93b2686777c5b2e8e7c48bae1e8ce4d797323fa Binary files /dev/null and b/content/zh/docs/AboutopenGauss/figures/SPQ_insert.jpg differ diff --git a/content/zh/docs/AboutopenGauss/figures/SPQ_update.jpg b/content/zh/docs/AboutopenGauss/figures/SPQ_update.jpg new file mode 100644 index 0000000000000000000000000000000000000000..15f038c724095191db34d2529c99da44e250bd44 Binary files /dev/null and b/content/zh/docs/AboutopenGauss/figures/SPQ_update.jpg differ diff --git "a/content/zh/docs/AboutopenGauss/\350\265\204\346\272\220\346\261\240\345\214\226\345\244\232\346\234\272\345\271\266\350\241\214.md" "b/content/zh/docs/AboutopenGauss/\350\265\204\346\272\220\346\261\240\345\214\226\345\244\232\346\234\272\345\271\266\350\241\214.md" index 0075889cf8429212d38a3a7a1a7f27b85a4f78c4..80541a6c314c62a2bf8edf9ba5ef315191bbe385 100644 --- "a/content/zh/docs/AboutopenGauss/\350\265\204\346\272\220\346\261\240\345\214\226\345\244\232\346\234\272\345\271\266\350\241\214.md" +++ "b/content/zh/docs/AboutopenGauss/\350\265\204\346\272\220\346\261\240\345\214\226\345\244\232\346\234\272\345\271\266\350\241\214.md" @@ -69,6 +69,39 @@ openGauss中创建索引的基本原理即原始表数据的扫描、排序, 针对100G数据量创建索引测试,在资源池化(一主两备)场景下执行SPQ与openGauss创建索引语句,整体性能提升约2倍。 +### 4. 多机并行DML增强 +openGauss中DML主要分为两部分:查找数据,写入符合要求的数据。SPQ采用多机并行加速读取数据和写入数据,通过多个只读节点来提升查询性能,从而提升DML性能。当前多机并行DML支持单线程写入(insert、delete和update)。 + +**图 8** SPQ DML设计方案 + +![](figures/SPQ_dml.jpg) + +- Insert + +**图 9** SPQ Insert性能测试 + +![](figures/SPQ_insert.jpg) + +本次测试数据量100G,写线程数为1,每个节点的读线程数为32,在资源池化(一主两备)场景下执行SPQ和openGauss原生语句。在读数据量远大于写数据量的情况下,性能提升最高2倍左右。 + +- Update + +**图 10** SPQ Update性能测试 + +![](figures/SPQ_update.jpg) + +本次测试数据量100G,写线程数为1,每个节点的读线程数为32,在资源池化(一主两备)场景下执行SPQ和openGauss原生语句。在读数据量远大于写数据量的情况下,性能提升最高10倍左右。 + +- Delete + +**图 11** SPQ Delete性能测试 + +![](figures/SPQ_delete100.jpg) + +![](figures/SPQ_delete1.jpg) + +本次测试数据量100G,写线程数为1,每个节点的读线程数为32,在资源池化(一主两备)场景下执行SPQ和openGauss原生语句。在读数据量远大于写数据量的情况下,性能提升最高10倍左右;读写数据量相同的情况下,性能提升1.7倍左右。 + ## 特性增强 无。 diff --git a/content/zh/docs/ExtensionReference/spqplugin-DELETE.md b/content/zh/docs/ExtensionReference/spqplugin-DELETE.md index 1a93ebb8f70e346cc366e77fbdd4d6ff2c65b5d0..b4eeca8ba45ed21a4230d956bd2943acd4e97bbc 100644 --- a/content/zh/docs/ExtensionReference/spqplugin-DELETE.md +++ b/content/zh/docs/ExtensionReference/spqplugin-DELETE.md @@ -23,18 +23,19 @@ openGauss=# set spqplugin.spq_optimizer_enable_dml = true; SET openGauss=# set spqplugin.spq_enable_delete = on; SET +openGauss=# set query_dop = 2; +SET --查看多机计划。 openGauss=# explain delete from t1 where c1 = 1; - QUERY PLAN ---------------------------------------------------------------------------------------------------------- - Streaming (type: GATHER) (cost=0.00..0.00 rows=0 width=0) - -> Streaming(type: LOCAL GATHER dop: 1/3) (cost=0.00..0.00 rows=0 width=0) - -> Delete on t1 (cost=0.00..431.02 rows=1 width=1) - -> SPQ Result (cost=0.00..431.00 rows=1 width=26) - -> Streaming(type: DML REDISTRIBUTE dop: 3/2) (cost=0.00..431.00 rows=1 width=15) - -> Spq Seq Scan on t1 (cost=0.00..431.00 rows=1 width=15) - Filter: (c1 = 1) -(7 rows) + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Streaming (type: GATHER) (cost=0.00..0.00 rows=0 width=1) + -> Delete on t1 (cost=0.00..431.01 rows=1 width=1) + -> SPQ Result (cost=0.00..431.00 rows=1 width=22) + -> Streaming(type: DML REDISTRIBUTE dop: 1/2) (cost=0.00..431.00 rows=1 width=11) + -> Spq Seq Scan on t1 (cost=0.00..431.00 rows=1 width=11) + Filter: (c1 = 1) +(6 rows) --删除表。 openGauss=# drop table t1; diff --git "a/content/zh/docs/ExtensionReference/spqplugin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" "b/content/zh/docs/ExtensionReference/spqplugin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" index 06c485a9529fb5326ba7acef23bae848f83c4fa5..a99580c1c36965fc75cee93a300b0d50147aa372 100644 --- "a/content/zh/docs/ExtensionReference/spqplugin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" +++ "b/content/zh/docs/ExtensionReference/spqplugin-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" @@ -786,3 +786,58 @@ spqplugin.cluster_map = 'node1|x.x.x.x|12300,node2|x.x.x.x|12300' - off表示不使用多机并行在线创建btree索引,使用内核原有功能。 **默认值**:off + +## spqplugin.spq_enable_insert_select + +**参数说明**:参数值为布尔类型,该参数用于控制多机并行insert操作。 + +**取值范围**:布尔型 + +- on表示使用多机并行插入数据。 +- off表示不使用多机并行插入数据,使用内核原有功能。 + +**默认值**:off + +## spqplugin.spq_enable_insert_from_tableless + +**参数说明**:参数值为布尔类型,该参数用于控制多机并行不带子查询的insert操作。 + +**取值范围**:布尔型 + +- on表示允许多机并行不带子查询的insert操作。 +- off表示不使用多机并行插入数据,使用内核原有功能。 + +**默认值**:off + +## spqplugin.spq_enable_insert_order_sensitive + +**参数说明**:参数值为布尔类型,该参数用于保证按照查询结果的顺序写入数据。 + +**取值范围**:布尔型 + +- on表示按照查询结果的顺序写入数据。 +- off表示不保证写入数据的顺序。 + +**默认值**:off + +## spqplugin.spq_enable_delete + +**参数说明**:参数值为布尔类型,该参数用于控制多机并行delete操作。 + +**取值范围**:布尔型 + +- on表示使用多机并行删除数据。 +- off表示不使用多机并行删除数据,使用内核原有功能。 + +**默认值**:off + +## spqplugin.spq_enable_update + +**参数说明**:参数值为布尔类型,该参数用于控制多机并行update操作。 + +**取值范围**:布尔型 + +- on表示使用多机并行更新数据。 +- off表示不使用多机并行更新数据,使用内核原有功能。 + +**默认值**:off \ No newline at end of file diff --git a/content/zh/docs/ExtensionReference/spqplugin-INSERT.md b/content/zh/docs/ExtensionReference/spqplugin-INSERT.md index 4322e25c92d3dbfe2e24e5b61400b94110881156..bfad831369a3b8d4bc56113800cc4df19f9ffe85 100644 --- a/content/zh/docs/ExtensionReference/spqplugin-INSERT.md +++ b/content/zh/docs/ExtensionReference/spqplugin-INSERT.md @@ -29,18 +29,20 @@ openGauss=# set spqplugin.spq_optimizer_enable_dml_constraints = true; SET openGauss=# set spqplugin.spq_enable_insert_select = on; SET +openGauss=# set query_dop = 2; +SET --查看多机计划。 openGauss=# explain insert into t2 select * from t1; QUERY PLAN ---------------------------------------------------------------------------------------------------------- - Streaming (type: GATHER) (cost=0.00..0.00 rows=0 width=0) - -> Streaming(type: LOCAL GATHER dop: 1/3) (cost=0.00..0.00 rows=0 width=0) - -> Insert on t2 (cost=0.00..431.01 rows=1 width=5) - -> SPQ Result (cost=0.00..0.00 rows=0 width=0) - -> Streaming(type: DML REDISTRIBUTE dop: 3/2) (cost=0.00..431.00 rows=1 width=16) - -> Spq Seq Scan on t1 (cost=0.00..431.00 rows=1 width=5) -(6 rows) +--------------------------------------------------------------------------------------------------- + Streaming (type: GATHER) (cost=0.00..0.00 rows=0 width=5) + -> Insert on t2 (cost=0.00..431.01 rows=1 width=5) + -> SPQ Result (cost=0.00..0.00 rows=0 width=0) + -> Streaming(type: DML REDISTRIBUTE dop: 1/2) (cost=0.00..431.00 rows=1 width=16) + -> Spq Seq Scan on t1 (cost=0.00..431.00 rows=1 width=5) +(5 rows) + --删除表。 openGauss=# drop table t1; diff --git a/content/zh/docs/ExtensionReference/spqplugin-SQL.md b/content/zh/docs/ExtensionReference/spqplugin-SQL.md index 669e1fba38b3d2a48110c6d9496763724f121615..f43d398fe83499de2e30c3ad1fa31a5dea1272a1 100644 --- a/content/zh/docs/ExtensionReference/spqplugin-SQL.md +++ b/content/zh/docs/ExtensionReference/spqplugin-SQL.md @@ -3,3 +3,9 @@ - **[CREATE INDEX](spqplugin-CREATE-INDEX.md)** - **[SELECT](spqplugin-SELECT.md)** + +- **[INSERT](spqplugin-INSERT.md)** + +- **[DELETE](spqplugin-DELETE.md)** + +- **[UPDATE](spqplugin-UPDATE.md)** \ No newline at end of file diff --git a/content/zh/docs/ExtensionReference/spqplugin-UPDATE.md b/content/zh/docs/ExtensionReference/spqplugin-UPDATE.md index 72d977db999221adc0e7e27814fea2ea29e49a4a..fcc226a7acd07d156ae00fdd851e9c35401a3365 100644 --- a/content/zh/docs/ExtensionReference/spqplugin-UPDATE.md +++ b/content/zh/docs/ExtensionReference/spqplugin-UPDATE.md @@ -26,19 +26,20 @@ openGauss=# set spqplugin.spq_optimizer_enable_dml_constraints = true; SET openGauss=# set spqplugin.spq_enable_update = on; SET +openGauss=# set query_dop = 2; +SET --查看多机计划。 openGauss=# explain update t1 set c1 = 2 where c1 < 2; QUERY PLAN ---------------------------------------------------------------------------------------------------------- - Streaming (type: GATHER) (cost=0.00..0.00 rows=0 width=0) - -> Streaming(type: LOCAL GATHER dop: 1/3) (cost=0.00..0.00 rows=0 width=0) - -> Update on t1 (cost=0.00..431.03 rows=1 width=1) - -> SPQ Result (cost=0.00..0.00 rows=0 width=0) - -> Streaming(type: DML REDISTRIBUTE dop: 3/2) (cost=0.00..431.00 rows=2 width=26) - -> Split (cost=0.00..431.00 rows=2 width=26) - -> Spq Seq Scan on t1 (cost=0.00..431.00 rows=1 width=15) - Filter: (c1 < 2) -(8 rows) +--------------------------------------------------------------------------------------------------- + Streaming (type: GATHER) (cost=0.00..0.00 rows=0 width=1) + -> Update on t1 (cost=0.00..431.03 rows=1 width=1) + -> SPQ Result (cost=0.00..0.00 rows=0 width=0) + -> Streaming(type: DML REDISTRIBUTE dop: 1/2) (cost=0.00..431.00 rows=2 width=22) + -> Split (cost=0.00..431.00 rows=2 width=22) + -> Spq Seq Scan on t1 (cost=0.00..431.00 rows=1 width=11) + Filter: (c1 < 2) +(7 rows) --删除表。 openGauss=# drop table t1; diff --git "a/content/zh/docs/ExtensionReference/spqplugin\344\275\277\347\224\250.md" "b/content/zh/docs/ExtensionReference/spqplugin\344\275\277\347\224\250.md" index 5d0ef07c1dfeacde6944eae1b5f15bd511d50b85..f296522448067ea1ef8d41fad864978379708063 100644 --- "a/content/zh/docs/ExtensionReference/spqplugin\344\275\277\347\224\250.md" +++ "b/content/zh/docs/ExtensionReference/spqplugin\344\275\277\347\224\250.md" @@ -27,8 +27,14 @@ spqplugin.enable_spq = on ## 使用插件 -多机并行功能目前支持部分DQL、DDL,详情参考: +多机并行功能目前支持部分DQL、DDL、DML,详情参考: -[SELECT](../SQLReference/SELECT.md) +[SELECT](spqplugin-SELECT.md) -[CREATE INDEX](../SQLReference/CREATE-INDEX.md) \ No newline at end of file +[CREATE INDEX](spqplugin-CREATE-INDEX.md) + +[INSERT](spqplugin-INSERT.md) + +[DELETE](spqplugin-DELETE.md) + +[UPDATE](spqplugin-UPDATE.md)