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

  • Learning PostgreSQL 11
  • Salahaldin Juba Andrey Volkov
  • 351字
  • 2021-07-02 13:11:44

Performance

PostgreSQL has a proven performance. It employs several techniques to improve concurrency and scalability, including the following:

  • PostgreSQL locking system: PostgreSQL provides several types of locks at the table and row levels. PostgreSQL is able to use more granular locks that prevent locking/blocking more than necessary; this increases concurrency and decreases the blocking time.
  • Indexes: PostgreSQL provides six types of indexes: btree, hash, Generalized Inverted Index (GIN), the Generalized Search Tree (GiST) index, SP-GiST, and Block Range Indexes (BRIN). Each index type can be used for a certain scenario. For example, btree can be used for efficient equality and range queries. GIST can be used for text search and for geospatial data. PostgreSQL supports partial, unique, and multicolumn indexes. It also supports indexes on expressions and operator classes.
  • Explain, analyze, vacuum, and cluster: PostgreSQL provides several commands to boost performance and provide transparency. The explain command shows the execution plan of a SQL statement. You can change some parameter settings, such as memory settings, and then compare the execution plan before and after the change. The analyze command is used to collect the statistics on tables and columns. The vacuum command is used for garbage collection to reclaim unused hard disk space. The cluster command is used to arrange data physically on the hard disk. All these commands can be configured based on the database workload.
  • Table inheritance and constraint exclusion: Table inheritance allows us to easily create tables with the same structure. Those tables are used to store subsets of data based on certain criteria. This allows a very fast retrieval of information in certain scenarios, because only a subset of data is accessed when answering a query.
  • Very rich SQL constructs: PostgreSQL supports very rich SQL constructs. It supports correlated and uncorrelated subqueries. It supports common table expression (CTE), window functions, and recursive queries. Once developers have learned these SQL constructs, they will be able to write a crisp SQL code very quickly. Moreover, they will be able to write complex queries with minimal effort. The PostgreSQL community keeps adding new SQL features in each release.
主站蜘蛛池模板: 阜新| 乐至县| 定南县| 广德县| 株洲县| 紫阳县| 徐闻县| 社会| 若尔盖县| 罗定市| 贵溪市| 罗平县| 盘山县| 仙游县| 陆川县| 抚远县| 通山县| 河南省| 年辖:市辖区| 正蓝旗| 萝北县| 本溪市| 内黄县| 大连市| 石景山区| 双鸭山市| 兴文县| 玉门市| 城固县| 西盟| 时尚| 吐鲁番市| 阜新| 凤庆县| 宁陵县| 明溪县| 阳城县| 登封市| 镇雄县| 海伦市| 自治县|