Suggestion to improve query performance for GIS query.

postgann2020 s <[email protected]> Fri, 22 May 2020 12:29:16 +0530
Newsgroups gmane.comp.gis.postgis,gmane.comp.db.postgresql.performance,gmane.comp.db.postgresql.admin
Message-ID <CANynezMGfmZbJ4EDFJoDRDzwJAGd0jCUtpTLFeP==ZgUOaFhyA@mail.gmail.com>
--===============4457750099661700314==
Content-Type: multipart/alternative; boundary="00000000000034947705a6372d4e"

--00000000000034947705a6372d4e
Content-Type: text/plain; charset="UTF-8"

Hi Team,

Thanks for your support.

Could you please suggest on below query.

EnvironmentPostgreSQL: 9.5.15
Postgis: 2.2.7

The table contains GIS data which is fiber data(underground routes).

We are using the below query inside the proc which is taking a long time to
complete.

*************************************************************

SELECT seq_no+1 INTO pair_seq_no FROM SCHEMA.TABLE WHERE (Column1 like
'%,sheath--'||cable_seq_id ||',%' or Column1 like 'sheath--'||cable_seq_id
||',%' or Column1 like '%,sheath--'||cable_seq_id  or
Column1='sheath--'||cable_seq_id) order by seq_no desc limit 1 ;

****************************************************************

We have created an index on parental_path Column1 still it is taking 4secs
to get the results.

Could you please suggest a better way to execute the query.

Thanks for your support.

Regards,
PostgAnn.

--00000000000034947705a6372d4e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Team,<br><br>Thanks for your support.<br><br>Could you =
please suggest on below query.<br><br>EnvironmentPostgreSQL: 9.5.15<br>Post=
gis: 2.2.7<br><br>The table contains GIS data which is fiber data(undergrou=
nd routes).<br><br>We are using the below query inside the proc which is ta=
king a long time to complete.<div><br></div><div>**************************=
***********************************<br><br>SELECT seq_no+1 INTO pair_seq_no=
 FROM SCHEMA.TABLE WHERE (Column1 like &#39;%,sheath--&#39;||cable_seq_id |=
|&#39;,%&#39; or Column1 like &#39;sheath--&#39;||cable_seq_id ||&#39;,%&#3=
9; or Column1 like &#39;%,sheath--&#39;||cable_seq_id =C2=A0or Column1=3D&#=
39;sheath--&#39;||cable_seq_id) order by seq_no desc limit 1 ;<br><br>*****=
***********************************************************<br><br>We have =
created an index on parental_path Column1 still it is taking 4secs to get t=
he results.<br><br>Could you please suggest a better way to execute the que=
ry.<br><br>Thanks for your support.<br><br>Regards,<br>PostgAnn.<br></div><=
/div>

--00000000000034947705a6372d4e--

--===============4457750099661700314==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KcG9zdGdpcy11
c2VycyBtYWlsaW5nIGxpc3QKcG9zdGdpcy11c2Vyc0BsaXN0cy5vc2dlby5vcmcKaHR0cHM6Ly9s
aXN0cy5vc2dlby5vcmcvbWFpbG1hbi9saXN0aW5mby9wb3N0Z2lzLXVzZXJz

--===============4457750099661700314==--