Understanding PostgreSQL

0. Tutorial link

https://www.runoob.com/postgresql/postgresql-tutorial.html

1 Introduction

PostgreSQL is a free software object-relational database management system ( ORDBMS ) with very complete features. It is an object-relational database management system based on POSTGRES, version 4.2 developed by the Department of Computer Science at the University of California . Many of the leading concepts of POSTGRES only appeared in the commercial website database at a relatively late time. PostgreSQL supports most of the SQL standards and provides many other modern features, such as complex queries, foreign keys , triggers , views , transaction integrity, and multi-version concurrency control. Similarly, PostgreSQL can also be extended in many ways, such as by adding new data types, functions, operators, aggregate functions , indexing methods, procedural languages, etc. In addition, because of the flexible license, anyone can use, modify, and distribute PostgreSQL for any purpose for free.

2. Advantages

1) The operating system supports WINDOWS , Linux , UNIX , MAC OS X , BSD  2) From the basic function point of view, it supports ACID , associated integrity, database transactions , Unicode multi-language 3) In terms of tables and views, PostgreSQL supports temporary tables, and Materialized views, you can use PL/pgSQL, PL/Perl, PL/Python or other procedural language stored procedures and trigger simulation 4) Index, fully supports R-/R+tree index, hash index, reverse index, Partial index, Expression index, GiST , GIN (used to speed up full-text retrieval), bitmap indexing is supported starting from version 8.3. 5) On other objects, it supports data fields, stored procedures, triggers, functions, external calls, and cursors. 7) In terms of data table partitioning, 4 types of partitions are supported, namely range, hash, mixed, and list. 6) Support from transactions In terms of degree, transaction support has undergone more thorough testing compared with MySQL . 7) In terms of My ISAM table processing method, MySQL uses table locking for non-transactional MyISAM tables, and a long-running query is very likely. Will hinder the update of the table, and PostgreSQL does not have such a problem 8) In terms of stored procedures, PostgreSQL supports stored procedures. Because the existence of stored procedures also avoids the transmission of a large number of original SQL statements on the network, this advantage is obvious. 9) In terms of the extension of user-defined functions , PostgreSQL can more easily use UDF (user-defined functions) for extension

3. Disadvantages

1) The latest version and the historical version are not stored separately, which leads to more scanning when cleaning up the old version. The cost is relatively high, but the general database has a peak period. If VACUUM is properly arranged , this is not a big problem, and In PostgreSQL 9.0, VACUUM has been further enhanced. 2) In PostgreSQL, because the index has no version information at all, Coverage index scan cannot be implemented, that is, the query only scans the index and cannot directly return the required attributes from the index. It also needs to access the table. , While Oracle and Innodb can.

4. Composition

1) Page management sub-module: define the organizational structure of PostgreSQL buffer pages and provide page operation methods 2) Buffer management sub-module: manage PostgreSQL buffers, including local buffers and shared buffers 3) Storage device management Sub-module: The database records are stored on the storage medium. The storage device management sub-module will shield the difference in interface functions of different physical storage devices (block devices, stream devices), and provide a unified access interface function to the upper buffer management sub-module 4 ) File management submodule: The general operating system has a limit on the number of files allowed to be opened by a process, and the PostgreSQL server sometimes needs to open a large number of files. Therefore, the PostgreSQL file management submodule itself, in order to break through this bottleneck, encapsulates In order to read and write files, an LRU linked list is established here , and the opened files are managed through a certain replacement algorithm, so that the number of files that can be opened is not limited by the operating system platform.

The header of the page records the usage information of the page, which is composed of the offset address of the tuple record space and the special space, the page distribution format version number, and the transaction log record point of the page, and so on. The tuple record space is the place where the tuple information is stored. Each tuple record is called an ltem. Item is composed of ltemld and tuple data. ltemld defines the offset and ltem of the tuple in the page. The state of the pointer and the bit length of the tuple item; the special space is needed for page operations. In order for other modules to operate on the page, PostgreSQL internally defines some page operation functions. The related operations of the page include page initialization, page addition, repair, and deletion. For other sub-modules to call. What is worth paying attention here is the operation function of page repair and page batch deletion. In order to realize these two operation functions, PostgreSQL specifically defines a data structure itemldSortData, which is defined to facilitate the descending sorting of the tuple items in these two functions.

5. Difference from mySQL

https://blog.csdn.net/tiandao2009/article/details/79839037

https://blog.csdn.net/helloworld_dream/article/details/85860941

Guess you like

Origin blog.csdn.net/qq_35789421/article/details/115015524