Re: Suggestion to improve query performance for GIS query.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: postgann2020 s <postgann2020(at)gmail(dot)com>
Cc: "postgis-users(at)lists(dot)osgeo(dot)org" <postgis-users(at)lists(dot)osgeo(dot)org>, PostgreSQL mailing lists <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Suggestion to improve query performance for GIS query.
Date: 2020-05-22 07:14:57
Message-ID: CAKFQuwaKE4mieDL+V-Ek2Mu2OrfWC5+wNA9bqGf0=Ok6uEt60Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-performance

On Thursday, May 21, 2020, postgann2020 s <postgann2020(at)gmail(dot)com> wrote:

>
> 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 ;
>
>
> Could you please suggest a better way to execute the query
>

Add a trigger to the table to normalize the contents of column1 upon insert
and then rewrite your query to reference the newly created normalized
fields.

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Mohammed Afsar 2020-05-22 07:16:36 Re: Suggestion to improve query performance for GIS query.
Previous Message David G. Johnston 2020-05-22 07:06:05 Re: Suggestion to improve query performance of data validation in proc.

Browse pgsql-performance by date

  From Date Subject
Next Message Mohammed Afsar 2020-05-22 07:16:36 Re: Suggestion to improve query performance for GIS query.
Previous Message David G. Johnston 2020-05-22 07:06:05 Re: Suggestion to improve query performance of data validation in proc.