Re: optimizing LIKE '%2345' queries - Mailing list pgsql-performance

From Mario Weilguni
Subject Re: optimizing LIKE '%2345' queries
Date
Msg-id 200607030933.53373.mweilguni@sime.com
Whole thread Raw
In response to optimizing LIKE '%2345' queries  (Gene <genekhart@gmail.com>)
Responses Is postgresql ca do the job for software deployed in ASP ou SaaS mode?  (David Gagnon <dgagnon@siunik.com>)
List pgsql-performance
Am Sonntag, 2. Juli 2006 23:50 schrieb Gene:
> Is there any way to create a reverse index on string columns so that
> queries of the form:
>
> where column like '%2345';
>
> can use an index and perform as fast as searching with like '2345%'?
>
> Is the only way to create a reverse function and create an index using
> the reverse function and modify queries to use:
>
> where reverse(column) like reverse('%2345') ?
>
> thanks

create a trigger that computes this at insert/update time, index this fix, and
rewrite the query this way:
where inverted_column like '5432%';


pgsql-performance by date:

Previous
From: satishchandra999@gmail.com
Date:
Subject: Calling a SP from Curosor loop
Next
From: David Gagnon
Date:
Subject: Is postgresql ca do the job for software deployed in ASP ou SaaS mode?