- Learning PostgreSQL 10(Second Edition)
- Salahaldin Juba Andrey Volkov
- 364字
- 2021-07-02 22:42:09
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: B-Tree, hash, generalized inverted index (GIN), and 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, B-tree can be used for equality and range queries efficiently. 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 an SQL statement. One 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 the creation of tables with the same structure easily. Those tables are used to store subsets of data based on a 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; in release 9.6, three SQL clauses were added: GROUPING SETS, CUBE, and ROLLUP.
推薦閱讀
- 嵌入式系統(tǒng)及其開發(fā)應(yīng)用
- 高性能混合信號(hào)ARM:ADuC7xxx原理與應(yīng)用開發(fā)
- Excel 2007函數(shù)與公式自學(xué)寶典
- 西門子PLC與InTouch綜合應(yīng)用
- CSS全程指南
- 80x86/Pentium微型計(jì)算機(jī)原理及應(yīng)用
- 大數(shù)據(jù)驅(qū)動(dòng)的設(shè)備健康預(yù)測(cè)及維護(hù)決策優(yōu)化
- 工業(yè)控制系統(tǒng)測(cè)試與評(píng)價(jià)技術(shù)
- 項(xiàng)目管理成功利器Project 2007全程解析
- 從零開始學(xué)C++
- 多媒體制作與應(yīng)用
- 電氣控制與PLC原理及應(yīng)用(歐姆龍機(jī)型)
- Hands-On Business Intelligence with Qlik Sense
- Effective Business Intelligence with QuickSight
- JSP通用范例開發(fā)金典