Re: Help with LIKE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: josh(at)agliodbs(dot)com
Cc: "David Olbersen" <DOlbersen(at)stbernard(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Help with LIKE
Date: 2003-03-21 02:06:21
Message-ID: 8915.1048212381@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Josh Berkus <josh(at)agliodbs(dot)com> writes:
>> SELECT * FROM table WHERE url ~ '^http://.*something.*$';

> That search still requires a seq scan, since it has "gaps" in the seqence of
> characters. That is,

> url ~ '^http://www.something.*' could use an index, but your search above
> cannot.

Actually, it *can* use an index ... but the index condition will only
use the characters before the ".*", ie, "http://". Which is just about
useless if you're searching a column of URLs :-(

I agree that tsearch or OpenFTS are the tools to be looking at.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Shridhar Daithankar<shridhar_daithankar@persistent.co.in> 2003-03-21 03:39:56 Re: Page Size in Future Releases
Previous Message Josh Berkus 2003-03-21 01:27:21 Re: Help with LIKE