7

I want to know if PostGIS has a separate implementation of GIST index or it reuses the GIST index implementation provided by Postgresql?

8

There's two things going on here: the GIST API in PostgreSQL and the bindings of types to that API for the purposes of building an R-Tree.

PostGIS necessarily uses the PostgreSQL GIST API. That's what it's for. That way we don't have to worry about transaction management or writing things to disk or all the other messy important things involved in maintaining your own index.

PostGIS has its own code to use the GIST API. There is code for building r-trees-on-gist in the PostgreSQL code base, but PostGIS does not use that code, we have our own, which is very similar (it's still aiming for an r-tree structure), but not identical.

2

In the PostGIS documentation it says:

PostgreSQL supports three kinds of indexes by default: B-Tree indexes, R-Tree indexes, and GiST indexes.

...

GiST (Generalized Search Trees) indexes break up data into "things to one side", "things which overlap", "things which are inside" and can be used on a wide range of data-types, including GIS data. PostGIS uses an R-Tree index implemented on top of GiST to index GIS data.

To me this says that PostGIS re-uses the GiST index implementation provided by PostgreSQL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.