Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CN/modules/ROOT/pages/6.3.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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 中新增一个系统列来实现的。
Expand Down
2 changes: 1 addition & 1 deletion CN/modules/ROOT/pages/9.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]。如果是这样,连接时字符串参数将覆盖所有冲突的命令行选项。

==== 环境

Expand Down
12 changes: 11 additions & 1 deletion EN/modules/ROOT/pages/6.3.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading