1

The 9.0 release notes for PostgreSQL states the following change:

Add point_ops operator class for GiST (Teodor Sigaev)

This feature permits GiST indexing of point columns. The index can be used for several types of queries such as point <@ polygon (point is in polygon). This should make many PostGIS queries faster.

I have a very large table (millions of rows) with a GEOMETRY(POINT,[SRID]) column that I sometimes compare to polygons. Do I need to do anything to enable this when creating the index? Do I have to use the operator they indicate, or would this work with ST_Contains?

(I'm sure the answer is in the docs somewhere, but I can't find it.)

1 Answer 1

5

It's an opclass, so you specify it in the CREATE INDEX command:

CREATE INDEX idx_name ON tablename USING GiST (col_name point_ops);
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! That helped. I went and read the PostgreSQL documentation on operator classes, but I'm still a bit lost as to how this works with PostGIS. What operators can use indexes created with point_ops? Can ST_Contains (which uses && internally), or do I need to use the <@ operator? Googling about it, this question is the first thing that comes up, so it doesn't look like there's much info out there to be found.
@jpmc26 I haven't worked enough with PostGIS... I'd recommend posting on the PostGIS mailing list or pgsql-general. Link to this question if you do.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.