cluster
Roles and a few other object types are shared across the entire cluster
database
每个PostgreSQL实例管理一个或多个databases。
database是管理database objects的最高级逻辑对象。
内建数据库(安装pg时init生成):
datname usedfor postgres So to create the first “ordinary” database you can connect to postgres. template1 用于创建数据库。PG中新建数据库的本质为:复制template1为一个新数据库。
如果在此数据库中新建了对象,那么之后新建的所有数据库都将包含template1中新建的对象。
template0 和template1数据库的内容完全相同。该数据库应当保持恒定,不能对其进行修改。
与template1不同的是,template1包含了指定的encoding-specific 和 locale-specific data数据,template0不包含。
如果需要从template0新建数据库:createdb -T template0 dbname
schema
一个数据库可以包含一个或多个schemas。
不同schema之间可以拥有相同名称的对象。
每个数据库默认包含public schema。
查看数据库所有的schema
select * from information_schema.schemata;