Re: best practise/pattern for large OR / LIKE searches - Mailing list pgsql-general

From Christophe Pettus
Subject Re: best practise/pattern for large OR / LIKE searches
Date
Msg-id 27D60055-0159-4254-9107-A7F3E7141F9F@thebuild.com
Whole thread Raw
In response to best practise/pattern for large OR / LIKE searches  (Ries van Twisk <pg@rvt.dds.nl>)
List pgsql-general
> SELECT * FROM tbl WHERE datanumber LIKE '%12345%' OR LIKE '%54321%'
> OR LIKE '%8766%' OR LIKE '%009%', ..
>
> The number of OR/LIKES are in the order of 50-100 items...
> the table tbl is a couple of million rows.

Are the fixed strings in the wildcards "words" (i.e., are they
completely arbitrarily embedded in the text, or are they delimited in
some regular way)? If they are "words," you might consider using the
full text functionality to create an index of them, and searching
using that.

--
-- Christophe Pettus
    xof@thebuild.com


pgsql-general by date:

Previous
From: Vick Khera
Date:
Subject: Re: How to simulate crashes of PostgreSQL?
Next
From: Erwin Brandstetter
Date:
Subject: Import data from XML file