Re: Very slow search using basic pattern matching - Mailing list pgsql-sql

From Karsten Hilbert
Subject Re: Very slow search using basic pattern matching
Date
Msg-id 20040518191504.C607@hermes.hilbert.loc
Whole thread Raw
In response to Very slow search using basic pattern matching  (Dan Field <dof@llgc.org.uk>)
List 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


pgsql-sql by date:

Previous
From: hook
Date:
Subject: I'm baffled
Next
From: Ricardo Maia
Date:
Subject: Re: I'M Sorry!