Skip site navigation (1) Skip section navigation (2)

Re: Very slow search using basic pattern matching

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Very slow search using basic pattern matching
Date: 2004-05-18 17:15:04
Message-ID: 20040518191504.C607@hermes.hilbert.loc (view raw or flat)
Thread:
Lists: pgsql-sql
> WHERE  
> 	da_records.DESCRIPTION_CY ~* '.*Aberystwyth*.' 
>  OR  
> 	da_records.TITLE_CY ~* '.*Aberystwyth*.'  
> limit 100 
> 
> Is there a better way of matching the string? (Must be case 
> insensitive) 
Are you sure you can't anchor the search pattern ?

eg  ~* '^' || lower('Aberystwyth') || '.*'

That'd allow for use of (functional) indices.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

In response to

pgsql-sql by date

Next:From: Ricardo MaiaDate: 2004-05-18 18:30:29
Subject: Re: I'M Sorry!
Previous:From: Hans de BruinDate: 2004-05-18 16:56:45
Subject: Re: How to speed up a time dimension query

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group