模式(schema)是數(shù)據(jù)庫(kù)中的1個(gè)概念,可以將其理解為1個(gè)命名空間或目錄。 在PG中,1個(gè)數(shù)據(jù)庫(kù)包括1個(gè)或多個(gè)模式,模式中又包括了表、函數(shù)及操作符等數(shù)據(jù)庫(kù)對(duì)象。 在PG中,不能同時(shí)訪(fǎng)問(wèn)不同數(shù)據(jù)庫(kù)中的對(duì)象,當(dāng)要訪(fǎng)問(wèn)另外一個(gè)數(shù)據(jù)庫(kù)中的表或其他對(duì)象時(shí),需要重新連接到這個(gè)新的數(shù)據(jù)庫(kù),而模式?jīng)]有此限制。 模式創(chuàng)建: create schema sch_name [authorization user_name] postgres=# create schema test; CREATE SCHEMA postgres=# \dn List of schemas Name | Owner --------+---------- public | postgres test | postgres (2 rows) postgres=# drop schema test; DROP SCHEMA postgres=# \dn List of schemas Name | Owner --------+---------- public | postgres (1 row) postgres=# postgres=# show search_path; search_path ----------------- "$user", public (1 row) postgres=#
上一篇 初始操作系統(tǒng)中的虛擬內(nèi)存(上)
下一篇 [置頂] Aerospike數(shù)據(jù)庫(kù)實(shí)戰(zhàn)(六) -- 踩坑&經(jīng)驗(yàn)總結(jié)