optimizing SELECT with LIKE

From: Jorge Sarmiento <jsarmiento(at)ccom(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: optimizing SELECT with LIKE
Date: 2002-06-12 15:43:25
Message-ID: 200206121143.25428.jsarmiento@ccom.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have 3000000 rows in a database where I have to make a:

SELECT name FROM table WHERE name LIKE '%firstname%' AND name LIKE
'%secondname%';

to obtain the data I need.

Due to the data nature, there is no other way to look for the data, it's old
data that was registered in paper years ago, with no searchable index... just
names, that sometimes are wrote like: JORGE SARMIENTO, other times like:
SARMIENTO, JORGE and other times like JORGE LUIS SARMIENTO. and due to legal
reasons, the data must be entered the exact way it was wroten.

Is there any way to optimize postgres for doing this kind of SELECT?

thanx in advance!

Jorge S.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paulo Sergio Fernandes Parola (Keyword) 2002-06-12 15:49:22 JOIN performance + exporting/importing text files (how to do bett er than with \copy?)
Previous Message Martijn van Oosterhout 2002-06-12 15:38:06 Re: Help understanding indexes