- Mastering PostgreSQL 10
- Hans Jürgen Sch?nig
- 256字
- 2021-06-30 19:03:56
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 these objects in a useful way? Sure, you can sort by the area covered, its length or so, but doing this 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 10.0):
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 the future, cognac.
- 數據庫原理與應用技術學習指導
- Hands-On Machine Learning with TensorFlow.js
- 深度學習中的圖像分類與對抗技術
- INSTANT Varnish Cache How-to
- 傳感器與物聯網技術
- 電氣控制與PLC技術應用
- Mastering Exploratory Analysis with pandas
- 一步步寫嵌入式操作系統
- 未來學徒:讀懂人工智能飛馳時代
- 生成對抗網絡項目實戰
- 電腦故障排除與維護終極技巧金典
- Learn Microsoft Azure
- 筆記本電腦使用與維護
- Hands-On Artificial Intelligence for Beginners
- 仿蛇機器人的設計與制作