pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <ajs@crankycanuck.ca>
To: pgsql-sql@postgresql.org
Subject: Re: best index for ~ ordering?
Date: Tue, 6 Mar 2007 17:28:02 -0500
Message-ID: <20070306222802.GA16606@phlogiston.dyndns.org> (raw)
In-Reply-To: <45EDDE5F.2030303@fmed.uba.ar>
References: <45EDDE5F.2030303@fmed.uba.ar>

On Tue, Mar 06, 2007 at 06:34:23PM -0300, Gerardo Herzig wrote:
> Hi all, i have a large table with one varchar field, and im triyng to 
> get information about what index should i use in order to using that 
> index (if this is possible) for ~ searching, and/or using LIKE searching.

What sort of match are you doing?  If you're doing left-anchored
searches (LIKE 'blah%') then your standard btree is good.  If you're
doing unanchored searches (LIKE '%blah%' or similar) you're best doing
tsearch.  If it's right-anchored, you can do an index on the reverse
of the string.

A 

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
Unfortunately reformatting the Internet is a little more painful 
than reformatting your hard drive when it gets out of whack.
		--Scott Morris



view thread (4+ messages)  latest in thread

Message-ID: <20070306222802.GA16606@phlogiston.dyndns.org>
Permalink:  ../20070306222802.GA16606@phlogiston.dyndns.org/
Also on:    postgresql.org/message-id/20070306222802.GA16606@phlogiston.dyndns.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ajs@crankycanuck.ca
  Subject: Re: best index for ~ ordering?
  In-Reply-To: <20070306222802.GA16606@phlogiston.dyndns.org>

* 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