From: Mario Weilguni <mweilguni@sime.com>
To: pgsql-performance@postgresql.org
To: genekhart@gmail.com
Subject: Re: optimizing LIKE '%2345' queries
Date: Mon, 3 Jul 2006 09:33:53 +0200
Message-ID: <200607030933.53373.mweilguni@sime.com> (raw)
In-Reply-To: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com>
References: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com>
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%';
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: mweilguni@sime.com, genekhart@gmail.com
Subject: Re: optimizing LIKE '%2345' queries
In-Reply-To: <200607030933.53373.mweilguni@sime.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox