Re: PostGIS 3.5.2 ST_Contains() query on gist is slow

Paul Ramsey via postgis-users <[email protected]> Wed, 10 Sep 2025 09:05:38 -0700
Newsgroups gmane.comp.gis.postgis
Message-ID <[email protected]>
Because the core of your query is “find this small handful of records that meet the unique key constraints, and then filter them with ST_Contains”, and that query cannot make use of the spatial index, so for that query the index is superfluous. You might have other queries that *do* need the index, but the one you’re getting the bad plan on does not.

P

> On Sep 10, 2025, at 8:21 AM, Sebastiaan Couwenberg via postgis-users <[email protected]> wrote:
> 
> Why would I want to drop the idx_nodes_geom? Or did you mean the btree_gist (ix_id_nodes_geom)?