Re: LIKE and REGEX optimization

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: Chris Browne <cbbrowne(at)acm(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: LIKE and REGEX optimization
Date: 2008-01-17 12:10:18
Message-ID: 20080117121018.GA30338@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 15, 2008 at 04:49:41PM -0600, Scott Marlowe wrote:
> This query is not capable of using an index on name, since you can't
> use an index with a like beginning with a %... So

actually you can. you just can't use index for like %something%, but it
can be solved using trigrams or another approaches. for example:
http://www.depesz.com/index.php/2007/09/15/speeding-up-like-xxx/

depesz

--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA. here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sebastián Baioni 2008-01-17 12:26:10 Re: Can't make backup (again)
Previous Message Richard Huxton 2008-01-17 12:00:35 Re: Can't make backup (again)