<div dir="ltr">I am very happy to have found the reason.<br><br>The client's development database is based on pg12. They modified the nodes.h file and added two enumerations above T_SupportRequestIndexCondition. Since the client downloaded pg12-postgis from <a href="http://postgis.org">postgis.org</a>, the installation file is based on the pg12 version, and the corresponding .h file value is 416. However, the client's version is 418 (because they customized two enumerations). Adjusting the order of the enumerations and recompiling should resolve the issue.<br><br>I would like to ask, how to compile postgis on Windows, and if you can provide a batch file or instructions.<br><br>Thanks,<br>Dapeng<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Regina Obe <<a href="mailto:lr@pcorp.us">lr@pcorp.us</a>> 于2024年2月26日周一 03:06写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-311840653651624371"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="m_-311840653651624371WordSection1"><p class="MsoNormal">But do the version()  numbers agree?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">SELECT version();<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I recall that issue being in PostgreSQL itself.  So a difference in version there might explain things.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The other place I’ve see that kind of issue is with foreign tables, but I assume you are not using any of those.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt"><div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in"><p class="MsoNormal"><b>From:</b> Dapeng Wang <<a href="mailto:wangdapeng20191008@gmail.com" target="_blank">wangdapeng20191008@gmail.com</a>> <br><b>Sent:</b> Sunday, February 25, 2024 9:09 AM<br><b>To:</b> Regina Obe <<a href="mailto:lr@pcorp.us" target="_blank">lr@pcorp.us</a>><br><b>Cc:</b> PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a>><br><b>Subject:</b> Re: The intersect function does not utilize indexes<u></u><u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">The version installed is 3.4.1, which is already the latest version. I'll navigate upwards from the "Cache Lookup Error" location to identify the cause. <br>Since it's a client development version of the database, any scenario could have occurred.<br>After identifying the cause, I will reply to the email.<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">Regina Obe <<a href="mailto:lr@pcorp.us" target="_blank">lr@pcorp.us</a>> <span style="font-family:"MS Gothic"">于</span>2024<span style="font-family:"MS Gothic"">年</span>2<span style="font-family:"MS Gothic"">月</span>24<span style="font-family:"MS Gothic"">日周六</span> 10:18<span style="font-family:"MS Gothic"">写道:</span><u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><div><div><p class="MsoNormal">I’ve seen that cached lookup error before but can’t recall when.  It might have been a bug in a micro release fixed in a later.<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Verify that<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">SELECT version();<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Returns the same or higher version number on your windows system than your Linux.<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Also make sure<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">SELECT postgis_full_version(); <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Doesn’t say you need updates.  If it does make sure to run<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">SELECT postgis_extensions_upgrade();<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt"><div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in"><p class="MsoNormal"><b>From:</b> Dapeng Wang <<a href="mailto:wangdapeng20191008@gmail.com" target="_blank">wangdapeng20191008@gmail.com</a>> <br><b>Sent:</b> Friday, February 23, 2024 8:25 PM<br><b>To:</b> Regina Obe <<a href="mailto:lr@pcorp.us" target="_blank">lr@pcorp.us</a>><br><b>Cc:</b> PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a>><br><b>Subject:</b> Re: The intersect function does not utilize indexes<u></u><u></u></p></div></div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">The executed SQL is very simple, and I executed the command explain (analyze, Buffers, verbose) select <a href="http://a.id" target="_blank">a.id</a> from random_2point_lines a join t1 b on public.st_intersects(a.geom, b.geom);. <br>While printing the planner's data in the PostgreSQL database, I encountered an error message "cache lookup failed for operator family 0."<br>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.<u></u><u></u></p></div><p class="MsoNormal"> <u></u><u></u></p><div><div><p class="MsoNormal">Regina Obe <<a href="mailto:lr@pcorp.us" target="_blank">lr@pcorp.us</a>> <span style="font-family:"MS Gothic"">于</span>2024<span style="font-family:"MS Gothic"">年</span>2<span style="font-family:"MS Gothic"">月</span>23<span style="font-family:"MS Gothic"">日周五</span> 10:23<span style="font-family:"MS Gothic"">写道:</span><u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><div><p class="MsoNormal">You have an example query where you are seeing this behavior?<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt"><div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in"><p class="MsoNormal"><b>From:</b> Dapeng Wang <<a href="mailto:wangdapeng20191008@gmail.com" target="_blank">wangdapeng20191008@gmail.com</a>> <br><b>Sent:</b> Thursday, February 22, 2024 8:57 PM<br><b>To:</b> PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a>><br><b>Subject:</b> The intersect function does not utilize indexes<u></u><u></u></p></div></div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">Hello everyone,<u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">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.<br><br>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.<br><br>Here's what I've investigated so far (using the same DDL):<br>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.<br>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.<br>Vacuum analyze has been performed, and I've attempted to disable sequential scans and force index scans, but to no avail.<br>Do you have any good suggestions?<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Thanks,<u></u><u></u></p></div><div><p class="MsoNormal">Dapeng<u></u><u></u></p></div></div></div></div></div></div></blockquote></div></div></div></div></div></blockquote></div></div></div></div></div></blockquote></div>