高斯数据库(openGauss)的模式
2026/7/7 0:06:05 网站建设 项目流程

都有各自的对象标识符oid(object identifiers),它是一个无符号的四字节整数,相关对象的oid都存放在相关的系统目录表中,比如数据库的oid和表的oid分别存放在pg_database,pg_class表中。下图展示了openGauss数据库的逻辑存储结构。

模式Schema是数据库中的命名空间,在数据库中创建的所有对象都是在Schema中创建。一个用户可以从同一个客户端连接中访问不同的Schema。而不同的Schema中可以有多个同名的表、索引、视图、序列、函数等等各种不同的数据库对象。

可以通过下面的方式来查看当前数据库的Schema。

openGauss=# \dn # 输出的信息如下: List of schemas Name | Owner -----------------+-------- blockchain | postgres coverage | postgres cstore | postgres db4ai | postgres dbe_perf | postgres dbe_pldebugger | postgres dbe_pldeveloper | postgres dbe_sql_util | postgres myuser | myuser pkg_service | postgres public | postgres snapshot | postgres sqladvisor | postgres (13 rows)

在默认情况下,OpenGauss会自动创建12个模式。下表说明了其中主要模式的功能和作用。

下面的步骤将创建一个新的模式,并在该模式下创建一张表。
(1)创建一个新的模式。

openGauss=# create schema myschema;

(2)在该模式下创建一张表。

openGauss=# create table myschema.test1(tid int);

(3)查看指定模式下的表。

openGauss=# \dt myschema.* List of relations Schema | Name | Type | Owner | Storage ----------+-------+-------+---------+---------------------------------- myschema | test1 | table |postgres | {orientation=row,compression=no}

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询