1

I am trying to run the following query thousands of times per second to determine which is any polygon contains the passed in point.

SELECT * from areas WHERE poly @> ?

Poly is the name of the polygon field and it has a GIST index on it.

I am wondering if I would see any performance benefit from using PostGIS over the regular postgress geospatial index for this simple query. I am using Amazon RDS to host postgress and with 3 xl read replicas I can only get about 20,000 transactions per second and I need to triple that. I have a webapp that makes the requests to postgres. At 20k tps all the postgress replicas are at 100% cpu.

2

The index in native PostgreSQL is basically the same as that in PostGIS (except for selectivity estimates, where PostGIS is better) so there will be no real performance change on such a simple query. Because you're testing one point/poly combination at a time and not doing any repeats of the same poly in the same query (as would be the case on a spatial join) you won't get any leverage from the PostGIS caching features either. Just eyeballing I'd guess that for your use case there's no benefit, unless the native PostgreSQL point-in-poly implementation is braindead in some way.

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.