官术网_书友最值得收藏!

Summary

In this chapter, we explored the basic building blocks of PostgreSQL. There are several shared objects across the database cluster. These shared objects are roles, tablespaces, databases, including template databases, template procedural languages, and some setting parameters. The tablespace is a defined storage normally used by the database administrator for optimization or maintenance purposes.

The template1 database is cloned each time a database is created. It can be loaded with extensions that should be available for all new databases. The template0 database provides a fallback strategy in case the template1 database is corrupted. Also, it can be used if the template1 locale isn't the required locale.

The role has several attributes, such as login, superuser, and createdb. The role is called a user in the older PostgreSQL version if it can log into the database, and a group if it can't. Roles can be granted to other roles; this allows database administrators to manage permissions easily.

PostgreSQL has more than 200 settings that control database behavior. These settings can have different contexts, such as internal, postmaster, backend, user, superuser, and SIGHUP. To take a quick look at these settings, you can use the pg_settings view.

The user database is the container for schemas, tables, views, functions, ranges, domain, sequences, and indexes. The database-access permissions can be controlled via the create, temporary, and connect access privileges. Several aspects of database behavior can be controlled by the ALTER DATABASE statement. The pg_database catalog table describes all the databases in the PostgreSQL cluster.

PostgreSQL provides a rich set of data types, including numeric, text, and date/time data types. Choosing a data type is an important task; thus, you should seek a balance between between extensibility, storage consumption, and performance when choosing a data type. You should be careful when performing operations on a mixture of different data types due to implicit conversion. For example, you should know how the system behaves when comparing the text data type with the varchar data type. This also applies to the time and date data types.

Tables are the major building blocks in PostgreSQL; they're used internally to implement views and sequences. A table can be categorized as temporary or permanent. In streaming replication, unlogged tables aren't replicated to the slave nodes.

In the next chapter, more building blocks will be explored, such as indexes and views. By the end of the next chapter, you should have the basic knowledge to design and implement the physical data structure of an application. 

主站蜘蛛池模板: 怀柔区| 吉林省| 改则县| 潞城市| 武威市| 陇南市| 铅山县| 铁力市| 马关县| 尼木县| 西昌市| 余干县| 陇西县| 通化县| 巴东县| 阳原县| 广汉市| 陈巴尔虎旗| 榕江县| 靖安县| 邛崃市| 上饶县| 饶平县| 大化| 肃宁县| 慈溪市| 漳浦县| 高密市| 贞丰县| 依安县| 大邑县| 保山市| 耿马| 科技| 彭水| 鄂托克前旗| 潞西市| 英吉沙县| 新竹市| 南木林县| 达孜县|