From: Florian Weimer <fw@deneb.enyo.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Index to support LIKE '%suffix' queries
Date: Wed, 01 Mar 2006 08:19:40 +0100
Message-ID: <874q2ik4xf.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <20060225181346.GA6092@surnet.cl>
References: <87mzgfh69m.fsf@mid.deneb.enyo.de>
<11673.1140888147@sss.pgh.pa.us>
<877j7jfhqs.fsf@mid.deneb.enyo.de>
<20060225181346.GA6092@surnet.cl>
* Alvaro Herrera:
>> > Florian Weimer <fw@deneb.enyo.de> writes:
>> >> Is it possible to create an index to support queries of the form
>> >> "column LIKE '%suffix'" (similar to an ordinary index for LIKE
>> >> 'prefix%', which I also need)?
>
> It is possible to create a functional index on the reverse of the
> string.
Okay. Is there a predefined reverse function? I couldn't find one
and I'm wondering if I just missed it.
> Whether or not this beats tsearch2 is something you should investigate ...
It's also possible that for this type of query, sequential scans are
good enough. I forgot that they are quite fast.
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-sql@postgresql.org
Cc: fw@deneb.enyo.de, tgl@sss.pgh.pa.us
Subject: Re: Index to support LIKE '%suffix' queries
In-Reply-To: <874q2ik4xf.fsf@mid.deneb.enyo.de>
* 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