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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-sql by date

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