pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gene <genekhart@gmail.com>
To: pgsql-performance@postgresql.org
Subject: optimizing LIKE '%2345' queries
Date: Sun, 2 Jul 2006 17:50:37 -0400
Message-ID: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com> (raw)

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

-- 
Eugene Hart
Cell: 443-604-2679



view thread (5+ messages)  latest in thread

Message-ID: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com>
Permalink:  ../430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com/
Also on:    postgresql.org/message-id/430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: genekhart@gmail.com
  Subject: Re: optimizing LIKE '%2345' queries
  In-Reply-To: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com>
  References: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.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