diff --git a/CN/modules/ROOT/pages/6.3.3.adoc b/CN/modules/ROOT/pages/6.3.3.adoc index 5cb41417..c04927b5 100644 --- a/CN/modules/ROOT/pages/6.3.3.adoc +++ b/CN/modules/ROOT/pages/6.3.3.adoc @@ -36,12 +36,22 @@ RowID 应当具备以下特性: (Node *) makeTypeNameFromOid(INT8OID, -1), -1), seqstmt->options); - seqstmt->options = lcons(makeDefElem("nocache", + if (rowid_seq_cache > 1) + { + seqstmt->options = lcons(makeDefElem("cache", + (Node *) makeInteger(rowid_seq_cache), + -1), + seqstmt->options); + } + else + seqstmt->options = lcons(makeDefElem("nocache", NULL, -1), seqstmt->options); ``` +cache 选项来自 `ivorysql.rowid_seq_cache`,默认值为 `20`。因此默认生成的序列使用 `CACHE 20`;只有当该参数设为 `1` 时才会使用 `NOCACHE`。这一行为同时适用于建表时创建的序列和 `ALTER TABLE … SET WITH ROWID` 创建的序列。 + 同时为了快速通过RowID伪列查询到一行数据,默认会在表的RowID列上创建一个UNIQUE索引,以提供快速查询功能。 RowID列作为系统属性列其实现是通过在 heap.c 中新增一个系统列来实现的。 diff --git a/CN/modules/ROOT/pages/9.adoc b/CN/modules/ROOT/pages/9.adoc index 2432ee47..d61ca1be 100644 --- a/CN/modules/ROOT/pages/9.adoc +++ b/CN/modules/ROOT/pages/9.adoc @@ -232,7 +232,7 @@ createdb也接受下列命令行参数用于连接参数: - `--maintenance-db=*dbname*` -指定要连接到来发现哪些其他数据库应该被聚簇的数据库名。如果没有指定,将使用 `postgres` 数据库。而如果它也不存在(或者如果它就是要创建新数据库的名称),将使用 `template1`。这可以是 http://www.postgresql.org/docs/17/libpq-connect.html#LIBPQ-CONNSTRING[connection string]。如果是这样,连接时字符串参数将覆盖所有冲突的命令行选项。 +指定在创建新数据库时要连接到的数据库名。如果没有指定,将使用 `postgres` 数据库。而如果它也不存在(或者如果它就是要创建新数据库的名称),将使用 `template1`。这可以是 http://www.postgresql.org/docs/17/libpq-connect.html#LIBPQ-CONNSTRING[connection string]。如果是这样,连接时字符串参数将覆盖所有冲突的命令行选项。 ==== 环境 diff --git a/EN/modules/ROOT/pages/6.3.3.adoc b/EN/modules/ROOT/pages/6.3.3.adoc index c5cb7f52..275c12d3 100644 --- a/EN/modules/ROOT/pages/6.3.3.adoc +++ b/EN/modules/ROOT/pages/6.3.3.adoc @@ -36,12 +36,22 @@ When the RowID functionality is enabled via the GUC parameter, or by the WITH RO (Node *) makeTypeNameFromOid(INT8OID, -1), -1), seqstmt->options); - seqstmt->options = lcons(makeDefElem("nocache", + if (rowid_seq_cache > 1) + { + seqstmt->options = lcons(makeDefElem("cache", + (Node *) makeInteger(rowid_seq_cache), + -1), + seqstmt->options); + } + else + seqstmt->options = lcons(makeDefElem("nocache", NULL, -1), seqstmt->options); ``` +The cache option comes from `ivorysql.rowid_seq_cache`, whose default is `20`. With the default, the generated sequence uses `CACHE 20`; only when the parameter is set to `1` does the generator use `NOCACHE`. This applies both to the sequence created with a new table and to `ALTER TABLE … SET WITH ROWID`. + To enable fast querying of a row using the RowID pseudo-column, a `UNIQUE` index is automatically created on the RowID column of the table by default to provide efficient query performance. The implementation of the RowID column as a system attribute column is achieved by adding a new system column in heap.c.