高斯数据库(openGauss)的模式

📅 2026/7/7 0:06:13
高斯数据库(openGauss)的模式
都有各自的对象标识符oidobject 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 | {orientationrow,compressionno}