The intersect function does not utilize indexes

Dapeng Wang wangdapeng20191008 at gmail.com
Fri Feb 23 17:25:05 PST 2024


The executed SQL is very simple, and I executed the command explain
(analyze, Buffers, verbose) select a.id from random_2point_lines a join t1
b on public.st_intersects(a.geom, b.geom);.
While printing the planner's data in the PostgreSQL database, I encountered
an error message "cache lookup failed for operator family 0."
In a PostgreSQL database, it would calculate the time for sequential scans
and index scans to choose the one with minimal time consumption. However,
in the customer's development database, there was an error encountered
while scanning the index, displaying the mentioned error message.

Regina Obe <lr at pcorp.us> 于2024年2月23日周五 10:23写道:

> You have an example query where you are seeing this behavior?
>
>
>
> *From:* Dapeng Wang <wangdapeng20191008 at gmail.com>
> *Sent:* Thursday, February 22, 2024 8:57 PM
> *To:* PostGIS Users Discussion <postgis-users at lists.osgeo.org>
> *Subject:* The intersect function does not utilize indexes
>
>
>
> Hello everyone,
>
>
>
> I have a client with a database developed on PostgreSQL 12, with both
> Windows and Linux versions. Everything is normal with the Linux version,
> but there are anomalies with the Windows version.
>
> While the Windows database can have the PostGIS extension installed,
> create indexes, and execute SQL queries correctly, spatial functions do not
> utilize indexes, such as intersection and containment.
>
> Here's what I've investigated so far (using the same DDL):
> On the Windows system, PostgreSQL 12 is installed along with PostGIS
> versions 3.3.0 to 3.4.1, and everything works fine. Spatial functions can
> utilize indexes.
> On the Windows system, the client's developed database is installed with
> PostGIS versions 3.3.0 to 3.4.1. Queries using the && operator utilize
> indexes, but spatial functions (such as st_intersects and ST_Contains) do
> not utilize indexes.
> Vacuum analyze has been performed, and I've attempted to disable
> sequential scans and force index scans, but to no avail.
> Do you have any good suggestions?
>
>
>
> Thanks,
>
> Dapeng
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240224/aec84ecc/attachment.htm>


More information about the postgis-users mailing list