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 ...

Get Mastering PostgreSQL 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.