optimizing SELECT with LIKE - Mailing list pgsql-general

From Jorge Sarmiento
Subject optimizing SELECT with LIKE
Date
Msg-id 200206121143.25428.jsarmiento@ccom.org
Whole thread Raw
Responses Re: optimizing SELECT with LIKE  (Ericson Smith <eric@did-it.com>)
Re: optimizing SELECT with LIKE  (Steve Atkins <steve@blighty.com>)
List 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.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Help understanding indexes
Next
From: "Nigel J. Andrews"
Date:
Subject: Re: [BUGS] createdb comments