- Mastering PostgreSQL 9.6
- Hans Jurgen Schonig
- 252字
- 2021-07-09 19:57:20
Understanding PostgreSQL index types
So far only binary trees have been discussed. However, in many cases B-trees are just not enough. Why is that the case? As discussed in this chapter, B-trees are basically based on sorting. Operators <, <=, =, >= and > can be handled using B-trees. The trouble is: not all data types can be sorted in a useful way. Just imagine a polygon. How would you sort those objects in a useful way? Sure, you can sort by the area covered, its length or so, but doing that won't allow you to actually find them using a geometric search.
The solution to the problem is to provide more than just one index type. Each index will serve a special purpose and do exactly what is needed. The following index types are available (as of PostgreSQL 9.6):
test=# SELECT * FROM pg_am;
amname | amhandler | amtype
--------+-------------+--------
btree | bthandler | i
hash | hashhandler | i
GiST | GiSThandler | i
gin | ginhandler | i
spGiST | spghandler | i
brin | brinhandler | i
(6 rows)
There are six types of indexes. B-trees have already been discussed in great detail but what are those other index types good for? The following sections will outline the purpose of each index type available in PostgreSQL.
Note that there are some extensions out there that can be used on top of what you can see here. Additional index types available on the web are rum, vodka, and in future, cognac.
- 現代測控系統典型應用實例
- Dreamweaver CS3 Ajax網頁設計入門與實例詳解
- 網絡綜合布線設計與施工技術
- 大數據驅動的設備健康預測及維護決策優化
- Lightning Fast Animation in Element 3D
- 電氣控制與PLC原理及應用(歐姆龍機型)
- 計算機組裝與維修實訓
- 貫通Java Web輕量級應用開發
- 菜鳥起飛五筆打字高手
- 網絡安全原理與應用
- Windows Server 2012 Automation with PowerShell Cookbook
- Hands-On Neural Networks with TensorFlow 2.0
- 群體智能與智能網聯:原理、算法與應用
- 關節故障空間機械臂容錯運動控制技術
- DevOps:Puppet,Docker,and Kubernetes