pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Dan Field <dof@llgc.org.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Very slow search using basic pattern matching
Date: Tue, 18 May 2004 11:12:56 -0500
Message-ID: <20040518161256.GA911@wolff.to> (raw)
In-Reply-To: <A02B0582-A8E2-11D8-9565-000A958E367A@llgc.org.uk>
References: <A02B0582-A8E2-11D8-9565-000A958E367A@llgc.org.uk>

On Tue, May 18, 2004 at 16:47:11 +0100,
  Dan Field <dof@llgc.org.uk> wrote:
> FROM
> 	da_records
> 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)

This is going to require a sequential scan and if you aren't going to
hit 100 entries near the beginning of the table, you will be effectively
doing a full scan of the table.

You might try looking at the tsearch2 contrib entry (a package for full text
searching) as that will likely be able to help you out.



view thread (5+ messages)  latest in thread

Message-ID: <20040518161256.GA911@wolff.to>
Permalink:  ../20040518161256.GA911@wolff.to/
Also on:    postgresql.org/message-id/20040518161256.GA911@wolff.to

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, dof@llgc.org.uk
  Subject: Re: Very slow search using basic pattern matching
  In-Reply-To: <20040518161256.GA911@wolff.to>

* 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