Search code examples
postgresqlpgadmin-4spatial-index

How to create a Gin index on a geometry column in Postgresql?


According to pgAdmin 4 4.21 documentation » Creating or Modifying a Table »

Select gin to create a GIN index. A GIN index may improve performance when managing two-dimensional geometric data types and nearest-neighbor searches

We should create a Gin index for geometric column if we intend to use Nearest-neighbor searches, Which I do!

However, when defining Gin index it asks for Operator Class and there are two options there (jsonb_path_obs and gin_int_ops) but none of them works with Geometry type.

Could someone please tell me how to create a Gin index on a Geometry type column?

P.S by geometry I mean PostGIS's geometry column type


Solution

  • Please link to the thing you are quoting so we don't have to go searching for it.

    That looks like a bug in the pgadmin4 docs. They seem to have the GIN and GiST labels reversed in those descriptions. GIN supports multiple keys better than GiST does, but doesn't support nearest-neighbor or spatial. You want a GiST index.