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

Paul Ramsey via postgis-users <[email protected]> Tue, 9 Sep 2025 10:25:12 -0700
Newsgroups gmane.comp.gis.postgis
Message-ID <CACowWR1OYVpMeKtsCmegesQJQSenptoknPrTjCvh=TvY6kz7Xg@mail.gmail.com>
On Mon, Sep 8, 2025 at 8:34 PM Sebastiaan Couwenberg via postgis-users <
[email protected]> wrote:

>  may be a regression in PostGIS 3.5.2, but I'm at a loss on how to confirm
> and fix that.
>
>
So, this seems to be a change in planning behaviour primarily, and you have
a lot of variability in your upgrade, any piece of which could be
implicated:

- Have you run ANALYZE on the relevant tables?
- You have a PostgreSQL upgrade from 15 to 17, can you hold your
PostGIS version constant while testing PostgreSQL version changes
- You have a PostGIS upgrade from 3.3 to 3.5, can you hold your PostgreSQL
version constant while testing PostGIS version changes
- Can you check the PostGIS selectivity estimate on the old and the new
installations, using

SELECT  _postgis_selectivity ('nodes', 'geom',
ST_GeomFromEWKT('SRID=4326;POLYGON((6.11982 52.6121955,6.11982
53.2038323,7.0927397 53.2038323,7.0927397 52.6121955,6.11982
52.6121955))'), '2');

P