<div dir="ltr">Hi All,<div>   Previously we were using Postgres 10 + Postgis 2.5.3.  Now we are planning to upgrade to Postgres 12 + Postgis 3.0.1.  Previously the query was taking 20 sec but now it is taking 45 sec.  I have pasted the query and output of explain below:</div><div><br></div><div><div>Note : port 5434 is postgresql12  and 5433 is postgresql10</div><div><br></div><div><b>-bash-4.2$ psql -p 5434</b><br>psql (12.3)<br>Type "help" for help.<br><br>postgres=# \c IPDS_KSEB<br>You are now connected to database "IPDS_KSEB" as user "postgres".<br>IPDS_KSEB=# explain analyze select object_name, objectid, ST_AsText(shape) as geom, gisid from kseb_geometry_trace_with_barrier_v1(453, 'htline', 2, null, null, null, false, true);<br>                                                                     QUERY PLAN<br>----------------------------------------------------------------------------------------------------------------------------------------------------<br> Function Scan on kseb_geometry_trace_with_barrier_v1  (cost=0.25..2510.25 rows=1000 width=100) (actual time=44246.596..44247.349 rows=252 loops=1)<br> Planning Time: 0.254 ms<br> Execution Time: 44308.083 ms<br>(3 rows)<br><br>IPDS_KSEB=# \q</div><div><br></div><div><b>-bash-4.2$ psql -p 5433</b><br>psql (12.3, server 10.11)<br>Type "help" for help.<br><br>postgres=# \c IPDS_KSEB<br>psql (12.3, server 10.11)<br>You are now connected to database "IPDS_KSEB" as user "postgres".<br>IPDS_KSEB=# explain analyze select object_name, objectid, ST_AsText(shape) as geom, gisid from kseb_geometry_trace_with_barrier_v1(453, 'htline', 2, null, null, null, false, true);<br>                                                                     QUERY PLAN<br>----------------------------------------------------------------------------------------------------------------------------------------------------<br> Function Scan on kseb_geometry_trace_with_barrier_v1  (cost=0.25..1885.25 rows=1000 width=100) (actual time=19901.708..19902.453 rows=252 loops=1)<br> Planning time: 0.154 ms<br> Execution time: 19951.016 ms<br>(3 rows)<br><br>IPDS_KSEB=#</div><div><br></div><div><br></div><div>   Any suggestions on why it is taking lot of time and what has to be done to improve?</div><div><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Regards,<div>Seenu.</div></div></div></div></div></div>