<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black; background-color: rgb(255, 255, 255);"><br>
Resending this since it was too large the first time</span></div>
<div style="text-align: left; background-color: rgb(255, 255, 255); margin: 0px;">
<span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
Thanks to everyone for their help so far.</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">There are only 3 things that changed when we upgraded. 
 One, the Postgres version, two, the PostGIS version and three, we went from Aurora serverless v1 to serverless v2.  MapServer itself runs on Amazon ECS which in this case has 8 Fargate instances all running an identical version of MapServer in a Docker container. 
 These instances are load balanced.  The table in question has 3479 rows.  I am not clear how to determine how many features it has.  Is it one per row?<br>
<br>
My URLs look like</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><a href="https://mapserver.mydomain.org/?map=/path/to/my/mapfile.map" target="_blank" id="OWAccc0e2c1-f249-42fa-e324-e764fabd8485" class="OWAAutoLink" rel="noopener noreferrer" data-auth="NotApplicable" data-loopstyle="linkonly" data-linkindex="0" style="margin: 0px;">https://mapserver.mydomain.org/?map=/path/to/my/mapfile.map</a></span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">I actually made two copies of the original map file
 and changed the config for where the MS_ERRORFILE should be written and added DEBUG 2.</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">One of those copies had the CONNECTION string set
 to point at the old db.<br>
<br>
The extent listed in the map section of the .map file is</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">  EXTENT -11871597.4858696 2978893.85839647 -10409341.4604357
 4369793.96473184</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">It does seem to zoom in a little as it loads, but
 I am not sure where it's getting the polygon information in the queries it's generating.</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">I hit the two URLs again, and this time got a debug
 file from the .mapfile pointed at the old db that is 226 lines long and one from the one pointed at the new db that is almost 24,000 lines long.  The map file for the new db has  thousands of lines like this (as did the .map file pointed at the old db the
 1<sup>st</sup> time I ran it):</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">[Tue Feb  6 20:37:34 2024].128829 msPostGISLayerNextShape
 called.</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">[Tue Feb  6 20:37:34 2024].128833 msPostGISReadShape
 called.</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">[Tue Feb  6 20:37:34 2024].128838 msPostGISLayerNextShape
 called.</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">[Tue Feb  6 20:37:34 2024].128842 msPostGISReadShape
 called.</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">[Tue Feb  6 20:37:34 2024].129474 msPostGISLayerNextShape
 called.</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">[Tue Feb  6 20:37:34 2024].129480 msPostGISReadShape
 called.</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">The queries are the same for the new db as the were
 the last time I loaded the page although they occur in a different order for each.   However, the .map file pointed at the old db had different values for the polygons and all the queries returned 0 rows, even though the map rendered was fine.  To be clear,
 running either set in pgAdmin is much slower against the new db compared to the old.  Additionally, the set of old queries which all return 0 results took less than 1 sec on the old db and about 15 on the new.  Additinonally, I tried adding an index in the
 new db, but while it seems slightly faster, it still takes twice as long as the old db does without a spatial index.  Here's what I ran:</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">CREATE INDEX idx_the_table_in_question_geom ON the_table_in_question
 USING gist (geom);<br>
<br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;"><br>
</span></div>
<div style="background-color: white; margin: 0px; border-width: 2pt; border-style: solid; border-color: rgb(244, 58, 19);">
</div>
<div style="background-color: white; margin: 0px; padding-top: 3pt; border-top: 1pt solid rgb(225, 225, 225);">
</div>
<p style="text-align: left; background-color: white; margin: 0px;"><span style="font-family: Aptos, sans-serif; font-size: 12pt; color: black;">Thanks,</span></p>
<p style="text-align: left; background-color: white; margin: 0px;" class="elementToProof">
<span style="font-family: Aptos, sans-serif; font-size: 12pt; color: black;">Rob</span></p>
<div style="background-color: white; margin: 0px; border-width: 2pt; border-style: solid; border-color: rgb(244, 58, 19);">
</div>
<div style="background-color: rgb(255, 255, 255); margin: 0px; padding-top: 3pt; border-top: 1pt solid rgb(225, 225, 225);">
</div>
<div style="background-color: rgb(255, 255, 255); border-width: 2pt; border-style: solid; border-color: rgb(244, 58, 19);">
</div>
<div style="padding: 3pt 0cm 0cm; border-top: 1pt solid rgb(225, 225, 225);"></div>
</body>
</html>