From 0322c353fe5a3a6c710f43c267d190d1d9084a82 Mon Sep 17 00:00:00 2001 From: zcp100_zcp100 Date: Fri, 3 Nov 2023 09:42:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?update(mogdb):=E6=9B=B4=E6=96=B0=E6=80=A7?= =?UTF-8?q?=E8=83=BD=E4=BC=98=E5=8C=96=E6=8C=87=E5=8D=97+=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=94=99=E5=88=AB=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuring-concurrent-query.md | 95 ---------------- .../system-tuning/system-tuning.md | 1 - product/en/docs-mogdb/v5.0/toc.md | 1 - product/en/docs-mogdb/v5.0/toc_performance.md | 1 - .../reference-guide/sql-syntax/CREATE-VIEW.md | 2 +- .../configuring-concurrent-query.md | 101 ------------------ .../system-tuning/system-tuning.md | 1 - .../reference-guide/sql-syntax/CREATE-VIEW.md | 2 +- product/zh/docs-mogdb/v5.0/toc.md | 1 - product/zh/docs-mogdb/v5.0/toc_performance.md | 1 - 10 files changed, 2 insertions(+), 204 deletions(-) delete mode 100644 product/en/docs-mogdb/v5.0/performance-tuning/system-tuning/configuring-concurrent-query.md delete mode 100644 product/zh/docs-mogdb/v5.0/performance-tuning/system-tuning/configuring-concurrent-query.md diff --git a/product/en/docs-mogdb/v5.0/performance-tuning/system-tuning/configuring-concurrent-query.md b/product/en/docs-mogdb/v5.0/performance-tuning/system-tuning/configuring-concurrent-query.md deleted file mode 100644 index e81d9b42..00000000 --- a/product/en/docs-mogdb/v5.0/performance-tuning/system-tuning/configuring-concurrent-query.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: SMP -summary: SMP -author: zhang cuiping -date: 2023-04-07 ---- - -# Configuring Concurrent Query - -The Symmetric Multi-Processing (SMP) technology of MogDB uses the multi-core CPU architecture of a computer to implement multi-thread parallel computing, fully using CPU resources to improve query performance. In complex query scenarios, a single query takes long time and the system concurrency is low. Therefore, the SMP technology is used to implement operator-level parallel execution, which effectively reduces the query time and improves the query performance and resource utilization. The overall implementation of the SMP technology is as follows: For query operators that can be executed in parallel, data is sliced, multiple worker threads are started for computation, and then the results are summarized and returned to the frontend. The data interaction operator **Stream** is added to the SMP architecture to implement data exchange between multiple worker threads, ensuring the correctness and integrity of the query. - -## Applicable Scenarios and Restrictions - -The SMP feature improves the performance through operator parallelism and occupies more system resources, including CPU, memory, and I/O. Actually, SMP is a method consuming resources to save time. It improves system performance in applicable scenarios where resources are sufficient, but may deteriorate performance otherwise. SMP applies to analytical query scenarios where a single query takes a long time and the service concurrency is low. The SMP technology can reduce the query delay and improve the system throughput. However, in a transaction-related high-concurrency scenario, as the delay of each single query is short, using the SMP technology increases the query delay and reduces the system throughput. - -- Applicable scenarios - - Operators that support parallelism. The plan contains the following operators that support parallelism. - - Scan: scans row-store ordinary tables, row-store partitioned tables, column-store ordinary tables, and column-store partitioned tables sequentially. - - Join: HashJoin and NestLoop - - Agg: HashAgg, SortAgg, PlainAgg, and WindowAgg (which supports only **partition by**, and does not support **order by**) - - Stream: Local Redistribute and Local Broadcast - - Others: Result, Subqueryscan, Unique, Material, Setop, Append, and VectoRow - - SMP-specific operators: To execute queries in parallel, Stream operators are added for data exchange of the SMP feature. These new operators can be considered as the subtypes of Stream operators. - - Local Gather aggregates data of parallel threads within an instance. - - Local Redistribute redistributes data based on the distribution key across threads within an instance. - - Local Broadcast broadcasts data to each thread within an instance. - - Local RoundRobin distributes data in polling mode across threads within an instance. - - The following uses the **TPCH Q1** parallel plan as an example. - -![img](https://cdn-mogdb.enmotech.com/docs-media/mogdb/performance-tuning/configuring-concurrent-query.png) - -In this plan, the Scan and HashAgg operators are processed in parallel, and the Local Gather operator is added for data exchange. Operator 3 is a Local Gather operator. “dop: 1/4” indicates that the degree of parallelism of the sender thread is 4 and the degree of parallelism of the receiver thread is 1. That is, the lower-layer HashAggregate operator 4 is executed based on the degree of parallelism 4, the upper-layer operators 1 and 2 are executed in serial mode, and operator 3 aggregates data of parallel threads within the instance. - -You can view the parallelism situation of each operator in the dop information. - -- Non-applicable scenarios - - Index scanning cannot be executed in parallel. - - MergeJoin cannot be executed in parallel. - - WindowAgg order by cannot be executed in parallel. - - The cursor cannot be executed in parallel. - - Queries in stored procedures and functions cannot be executed in parallel. - - Subplans and initplans cannot be queried in parallel, and operators that contain subqueries cannot be executed in parallel, either. - - Query statements that contain the median operation cannot be executed in parallel. - - Queries with global temporary tables cannot be executed in parallel. - - Updating materialized views cannot be executed in parallel. - -## Resource Restrictions on SMP Performance - -The SMP architecture consumes abundant resources to save time. After plans are executed in parallel, the resource consumption increases, covering the CPU, memory, and I/O resources. As the degree of parallelism grows, the resource consumption increases. If these resources become a bottleneck, the SMP architecture does not improve performance but may deteriorate the overall performance of the database instance. The following describes the various resource restrictions on the SMP performance: - -- CPU - - In a general customer scenario where the system CPU usage is not high, using the SMP architecture will fully use the CPU resources to improve the system performance. If the number of CPU cores of the database server is small and the CPU usage is already high, enabling the SMP feature may deteriorate the system performance due to resource contention between multiple threads. - -- Memory - - Parallel query causes high memory usage, but the memory usage of each operator is still subject to **work_mem** and other parameters. Assuming that **work_mem** is 4 GB and the degree of parallelism is 2, the memory usage of each thread in parallel is limited to 2 GB. When **work_mem** is small or the system memory is not sufficient, using SMP may flush data to disks. As a result, the query performance deteriorates. - -- I/O - - A parallel scan increases I/O resource consumption. It can improve scan performance only when I/O resources are sufficient. - -## Other Factors Affecting the SMP Performance - -Besides resources, there are other factors that impact the SMP performance, such as uneven data distribution in a partitioned table and degree of parallelism. - -- Data skew - - Severe data skew deteriorates SMP performance. For example, if the data volume of a value in the join column is much more than that of other values, the data volume of a parallel thread will be much more than that of others after Hash-based data redistribution, resulting in the long-tail issue and poor SMP performance. - -- Degree of parallelism - - The SMP feature uses more resources, and remaining resources are insufficient in a high concurrency scenario. Therefore, enabling the SMP feature will result in severe resource contention among queries. Once resource contention occurs, no matter the CPU, I/O, or memory resources, all of them will result in entire performance deterioration. In the high concurrency scenario, enabling the SMP feature will not improve the performance and even may cause performance deterioration. - -## Procedure - -1. Observe the current system load situation. If resources are sufficient (the resource usage is smaller than 50%), perform step 2. Otherwise, exit this system. - -2. Set **query_dop** to **1** (default value). Use **explain** to generate an execution plan and check whether the plan can be used in scenarios in [Applicable Scenarios and Restrictions](#Applicable Scenarios and Restrictions). If yes, go to step 3. - -3. Set **query_dop** to *value*. The degree of parallelism is 1 or *value* regardless of the resource usage and plan characteristics. - -4. Before the query statement is executed, set **query_dop** to an appropriate value. After the statement is executed, set **query_dop** to disable the query. The following provides an example: - - ```sql - MogDB=# SET query_dop = 4; - MogDB=# SELECT COUNT(*) FROM t1 GROUP BY a; - ...... - MogDB=# SET query_dop = 1; - ``` - - > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **Note**: - > - > - Set **query_dop** to *value*. The degree of parallelism is 1 or *value* regardless of the resource usage and plan characteristics. - > - Before the query statement is executed, set **query_dop** to an appropriate value. After the statement is executed, set **query_dop** to disable the query. The following provides an example: \ No newline at end of file diff --git a/product/en/docs-mogdb/v5.0/performance-tuning/system-tuning/system-tuning.md b/product/en/docs-mogdb/v5.0/performance-tuning/system-tuning/system-tuning.md index 6f8d814a..df17e27f 100644 --- a/product/en/docs-mogdb/v5.0/performance-tuning/system-tuning/system-tuning.md +++ b/product/en/docs-mogdb/v5.0/performance-tuning/system-tuning/system-tuning.md @@ -12,5 +12,4 @@ date: 2023-04-23 - **[Configuring SMP](configuring-smp.md)** - **[Configuring LLVM](configuring-llvm.md)** - **[Configuring Ustore](configuring-ustore.md)** -- **[Configuring Concurrent Query](configuring-concurrent-query.md)** - **[Resource Load Management](resource-load-management/resource-load-management.md)** \ No newline at end of file diff --git a/product/en/docs-mogdb/v5.0/toc.md b/product/en/docs-mogdb/v5.0/toc.md index 9ed4c0f8..a9de9f25 100644 --- a/product/en/docs-mogdb/v5.0/toc.md +++ b/product/en/docs-mogdb/v5.0/toc.md @@ -711,7 +711,6 @@ + [Configuring SMP](/performance-tuning/system-tuning/configuring-smp.md) + [Configuring LLVM](/performance-tuning/system-tuning/configuring-llvm.md) + [Configuring Ustore](/performance-tuning/system-tuning/configuring-ustore.md) - + [Configuring Concurrent Query](/performance-tuning/system-tuning/configuring-concurrent-query.md) + [Resource Load Management](/performance-tuning/system-tuning/resource-load-management/resource-load-management.md) + [Overview](/performance-tuning/system-tuning/resource-load-management/resource-load-management-overview.md) + [Resource Management Preparation](/performance-tuning/system-tuning/resource-load-management/resource-management-preparations/resource-management-preparations.md) diff --git a/product/en/docs-mogdb/v5.0/toc_performance.md b/product/en/docs-mogdb/v5.0/toc_performance.md index fc145f9b..58f1f33d 100644 --- a/product/en/docs-mogdb/v5.0/toc_performance.md +++ b/product/en/docs-mogdb/v5.0/toc_performance.md @@ -10,7 +10,6 @@ + [Configuring SMP](/performance-tuning/system-tuning/configuring-smp.md) + [Configuring LLVM](/performance-tuning/system-tuning/configuring-llvm.md) + [Configuring Ustore](/performance-tuning/system-tuning/configuring-ustore.md) - + [Configuring Concurrent Query](/performance-tuning/system-tuning/configuring-concurrent-query.md) + [Resource Load Management](/performance-tuning/system-tuning/resource-load-management/resource-load-management.md) + [Overview](/performance-tuning/system-tuning/resource-load-management/resource-load-management-overview.md) + [Resource Management Preparation](/performance-tuning/system-tuning/resource-load-management/resource-management-preparations/resource-management-preparations.md) diff --git a/product/zh/docs-mogdb/v3.1/reference-guide/sql-syntax/CREATE-VIEW.md b/product/zh/docs-mogdb/v3.1/reference-guide/sql-syntax/CREATE-VIEW.md index 62f29012..fdf4301f 100644 --- a/product/zh/docs-mogdb/v3.1/reference-guide/sql-syntax/CREATE-VIEW.md +++ b/product/zh/docs-mogdb/v3.1/reference-guide/sql-syntax/CREATE-VIEW.md @@ -36,7 +36,7 @@ CreateView ::= CREATE [ OR REPLACE ] [DEFINER = user] [ TEMP | TEMPORARY ] VIEW - **DEFINER = user** - 指定user作为视图的属主。该选项尽在B兼容模式下使用。 + 指定user作为视图的属主。该选项仅在B兼容模式下使用。 - **TEMP | TEMPORARY** diff --git a/product/zh/docs-mogdb/v5.0/performance-tuning/system-tuning/configuring-concurrent-query.md b/product/zh/docs-mogdb/v5.0/performance-tuning/system-tuning/configuring-concurrent-query.md deleted file mode 100644 index c175cd77..00000000 --- a/product/zh/docs-mogdb/v5.0/performance-tuning/system-tuning/configuring-concurrent-query.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: 配置并行查询功能 -summary: 配置并行查询功能 -author: zhang cuiping -date: 2023-04-07 ---- - -# 配置并行查询功能 - -MogDB的SMP并行技术是一种利用计算机多核CPU架构来实现多线程并行计算,以充分利用CPU资源来提高查询性能的技术。在复杂查询场景中,单个查询的执行较长,系统并发度低,通过SMP并行执行技术实现算子级的并行,能够有效减少查询执行时间,提升查询性能及资源利用率。SMP并行技术的整体实现思想是对于能够并行的查询算子,将数据分片,启动若干个工作线程分别计算,最后将结果汇总,返回前端。SMP并行执行增加数据交互算子(Stream),实现多个工作线程之间的数据交互,确保查询的正确性,完成整体的查询。 - -## 适用场景与限制 - -SMP特性通过算子并行来提升性能,同时会占用更多的系统资源,包括CPU、内存、I/O等等。本质上SMP是一种以资源换取时间的方式,在合适的场景以及资源充足的情况下,能够起到较好的性能提升效果;但是如果在不合适的场景下,或者资源不足的情况下,反而可能引起性能的劣化。SMP特性适用于分析类查询场景,这类场景的特点是单个查询时间较长,业务并发度低。通过SMP并行技术能够降低查询时延,提高系统吞吐性能。然而在事务类大并发业务场景下,由于单个查询本身的时延很短,使用多线程并行技术反而会增加查询时延,降低系统吞吐性能。 - -- 适用场景 - - - 支持并行的算子:计划中存在以下算子支持并行。 - - - Scan:支持行存普通表和行存分区表顺序扫描、列存普通表和列存分区表顺序扫描。 - - Join:HashJoin、NestLoop - - Agg:HashAgg、SortAgg、PlainAgg、WindowAgg(只支持partition by,不支持order by)。 - - Stream:Local Redistribute、Local Broadcast - - 其他:Result、Subqueryscan、Unique、Material、Setop、Append、VectoRow - - - SMP特有算子:为了实现并行,新增了并行线程间的数据交换Stream算子供SMP特性使用。这些新增的算子可以看做Stream算子的子类。 - - - Local Gather:实现实例内部并行线程的数据汇总。 - - Local Redistribute:在实例内部各线程之间,按照分布键进行数据重分布。 - - Local Broadcast:将数据广播到实例内部的每个线程。 - - Local RoundRobin:在实例内部各线程之间实现数据轮询分发。 - - - 示例说明,以TPCH Q1的并行计划为例。 - - ![img](https://cdn-mogdb.enmotech.com/docs-media/mogdb/performance-tuning/configuring-concurrent-query.png) - - 在这个计划中,实现了Scan以及HashAgg算子的并行,并新增了Local Gather数据交换算子。其中3号算子为Local Gather算子,上面标有的“dop: 1/4”表明该算子的发送端线程的并行度为4,而接受端线程的并行度为1,即下层的4号HashAggregate算子按照4并行度执行,而上层的1~2号算子按照串行执行,3号算子实现了实例内并行线程的数据汇总。 - - 通过计划Stream算子上表明的dop信息即可看出各个算子的并行情况。 - -- 非适用场景 - - - 索引扫描不支持并行执行。 - - MergeJoin不支持并行执行。 - - WindowAgg order by不支持并行执行。 - - cursor不支持并行执行。 - - 存储过程和函数内的查询不支持并行执行。 - - 不支持子查询subplan和initplan的并行,以及包含子查询的算子的并行。 - - 查询语句中带有median操作的查询不支持并行执行。 - - 带全局临时表的查询不支持并行执行。 - - 物化视图的更新不支持并行执行。 - -## 资源对SMP性能的影响 - -SMP架构是一种利用富余资源来换取时间的方案,计划并行之后必定会引起资源消耗的增加,包括CPU、内存、I/O等资源的消耗都会出现明显的增长,而且随着并行度的增大,资源消耗也随之增大。当上述资源成为瓶颈的情况下,SMP无法提升性能,反而可能导致数据库实例整体性能的劣化。下面对各种资源对SMP性能的影响情况分别进行说明。 - -- CPU资源 - - 在一般客户场景中,系统CPU利用率不高的情况下,利用SMP并行架构能够更充分地利用系统CPU资源,提升系统性能。但当数据库服务器的CPU核数较少,CPU利用率已经比较高的情况下,如果打开SMP并行,不仅性能提升不明显,反而可能因为多线程间的资源竞争而导致性能劣化。 - -- 内存资源 - - 查询并行后会导致内存使用量的增长,但每个算子使用内存上限仍受到work_mem等参数的限制。假设work_mem为4GB,并行度为2,那么每个并行线程所分到的内存上限为2GB。在work_mem较小或者系统内存不充裕的情况下,使用SMP并行后,可能出现数据下盘,导致查询性能劣化的问题。 - -- I/O资源 - - 要实现并行扫描必定会增加I/O的资源消耗,因此只有在I/O资源充足的情况下,并行扫描才能够提高扫描性能。 - -## 其他因素对SMP性能的影响 - -除了资源因素外,还有一些因素也会对SMP并行性能造成影响。例如分区表中分区数据不均,以及系统并发度等因素。 - -- 数据倾斜对SMP性能的影响 - - 当数据中存在严重数据倾斜时,并行效果较差。例如某表join列上某个值的数据量远大于其他值,开启并行后,根据join列的值对该表数据做hash重分布,使得某个并行线程的数据量远多于其他线程,造成长尾问题,导致并行后效果差。 - -- 系统并发度对SMP性能的影响 - - SMP特性会增加资源的使用,而在高并发场景下资源剩余较少。所以,如果在高并发场景下,开启SMP并行,会导致各查询之间严重的资源竞争问题。一旦出现了资源竞争的现象,无论是CPU、I/O、内存,都会导致整体性能的下降。因此在高并发场景下,开启SMP往往不能达到性能提升的效果,甚至可能引起性能劣化。 - -## 配置步骤 - -1. 观察当前系统负载情况,如果系统资源充足(资源利用率小于50%),执行下一步;否则退出。 - -2. 设置query_dop=1(默认值),利用explain打出执行计划,观察计划是否符合[适用场景与限制](#适用场景与限制)中的适用场景。如果符合,进入下一步。 - -3. 设置query_dop=value,不考虑资源情况和计划特征,强制选取dop为1或value。 - -4. 在符合条件的查询语句执行前设置合适的query_dop值,在语句执行结束后关闭query_dop。举例如下。 - - ``` - MogDB=# SET query_dop = 4; - MogDB=# SELECT COUNT(*) FROM t1 GROUP BY a; - ...... - MogDB=# SET query_dop = 1; - ``` - - > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明:** - > - > - 资源许可的情况下,并行度越高,性能提升效果越好。 - > - SMP并行度支持会话级设置,推荐客户在执行符合要求的查询前,打开smp,执行结束后,关闭smp。以免在业务峰值时,对业务造成冲击。 \ No newline at end of file diff --git a/product/zh/docs-mogdb/v5.0/performance-tuning/system-tuning/system-tuning.md b/product/zh/docs-mogdb/v5.0/performance-tuning/system-tuning/system-tuning.md index e696d430..22c84ed7 100644 --- a/product/zh/docs-mogdb/v5.0/performance-tuning/system-tuning/system-tuning.md +++ b/product/zh/docs-mogdb/v5.0/performance-tuning/system-tuning/system-tuning.md @@ -12,5 +12,4 @@ date: 2023-04-23 - **[配置SMP](configuring-smp.md)** - **[配置LLVM](configuring-llvm.md)** - **[配置Ustore](configuring-ustore.md)** -- **[配置并行查询功能](configuring-concurrent-query.md)** - **[资源负载管理](resource-load-management/resource-load-management.md)** \ No newline at end of file diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-VIEW.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-VIEW.md index e4ad1e69..e4f2c352 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-VIEW.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-VIEW.md @@ -36,7 +36,7 @@ CreateView ::= CREATE [ OR REPLACE ] [DEFINER = user] [ TEMP | TEMPORARY ] VIEW - **DEFINER = user** - 指定user作为视图的属主。该选项尽在B兼容模式下使用。 + 指定user作为视图的属主。该选项仅在B兼容模式下使用。 - **TEMP | TEMPORARY** diff --git a/product/zh/docs-mogdb/v5.0/toc.md b/product/zh/docs-mogdb/v5.0/toc.md index 46620571..f224f563 100644 --- a/product/zh/docs-mogdb/v5.0/toc.md +++ b/product/zh/docs-mogdb/v5.0/toc.md @@ -711,7 +711,6 @@ + [配置SMP](/performance-tuning/system-tuning/configuring-smp.md) + [配置LLVM](/performance-tuning/system-tuning/configuring-llvm.md) + [配置Ustore](/performance-tuning/system-tuning/configuring-ustore.md) - + [配置并行查询功能](/performance-tuning/system-tuning/configuring-concurrent-query.md) + [资源负载管理](/performance-tuning/system-tuning/resource-load-management/resource-load-management.md) + [资源负载管理概述](/performance-tuning/system-tuning/resource-load-management/resource-load-management-overview.md) + [资源管理准备](/performance-tuning/system-tuning/resource-load-management/resource-management-preparations/resource-management-preparations.md) diff --git a/product/zh/docs-mogdb/v5.0/toc_performance.md b/product/zh/docs-mogdb/v5.0/toc_performance.md index d4d320a2..e18293a5 100644 --- a/product/zh/docs-mogdb/v5.0/toc_performance.md +++ b/product/zh/docs-mogdb/v5.0/toc_performance.md @@ -10,7 +10,6 @@ + [配置SMP](/performance-tuning/system-tuning/configuring-smp.md) + [配置LLVM](/performance-tuning/system-tuning/configuring-llvm.md) + [配置Ustore](/performance-tuning/system-tuning/configuring-ustore.md) - + [配置并行查询功能](/performance-tuning/system-tuning/configuring-concurrent-query.md) + [资源负载管理](/performance-tuning/system-tuning/resource-load-management/resource-load-management.md) + [资源负载管理概述](/performance-tuning/system-tuning/resource-load-management/resource-load-management-overview.md) + [资源管理准备](/performance-tuning/system-tuning/resource-load-management/resource-management-preparations/resource-management-preparations.md) -- Gitee From 5b8635ad69655fa32279169dc6b4f80a1b901ed1 Mon Sep 17 00:00:00 2001 From: zcp100_zcp100 Date: Fri, 3 Nov 2023 11:01:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(mogdb):=E6=9B=B4=E6=96=B0create=20view?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v5.0/reference-guide/sql-syntax/CREATE-VIEW.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-VIEW.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-VIEW.md index e4f2c352..83555370 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-VIEW.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-VIEW.md @@ -111,14 +111,6 @@ MogDB=# CREATE VIEW ro_view1 AS SELECT a, b FROM base_tbl; MogDB=# INSERT INTO ro_view1 values (2, 'insertView'); MogDB=# UPDATE ro_view1 SET b = 'updateView' WHERE a = 1; MogDB=# DELETE FROM ro_view1 WHERE a= 2; - ---创建check option视图 -MogDB=# CREATE VIEW ro_view2 AS SELECT a, b FROM base_tbl WHERE a > 10 WITH CHECK OPTION; - ---插入、更新视图不可见数据失败 -MogDB=# INSERT INTO ro_view2 values (5, 'insertView'); -MogDB=# INSERT INTO base_tbl values (15, 'insertTable'); -MogDB=# UPDATE ro_view2 SET a = 5 WHERE a = 15; ``` ## 相关链接 -- Gitee