pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: josh@agliodbs.com
Cc: David Olbersen <DOlbersen@stbernard.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Help with LIKE
Date: Thu, 20 Mar 2003 21:06:21 -0500
Message-ID: <8915.1048212381@sss.pgh.pa.us> (raw)
In-Reply-To: <200303201727.21401.josh@agliodbs.com>
References: <E7E213858379814A9AE48CA6754F5ECB0D6C33@mail01.stbernard.com>
	<200303201727.21401.josh@agliodbs.com>

Josh Berkus <josh@agliodbs.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



view thread (6+ messages)

Message-ID: <8915.1048212381@sss.pgh.pa.us>
Permalink:  ../8915.1048212381@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8915.1048212381@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, josh@agliodbs.com, DOlbersen@stbernard.com
  Subject: Re: Help with LIKE
  In-Reply-To: <8915.1048212381@sss.pgh.pa.us>
  References: <E7E213858379814A9AE48CA6754F5ECB0D6C33@mail01.stbernard.com> <200303201727.21401.josh@agliodbs.com> <8915.1048212381@sss.pgh.pa.us>

* 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