From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dan Kaplan <dkaplan@citizenhawk.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Optimizing t1.col like '%t2.col%'
Date: Wed, 27 Feb 2008 15:26:23 -0500
Message-ID: <7248.1204143983@sss.pgh.pa.us> (raw)
In-Reply-To: <00c801c87979$9f3da480$1d00a8c0@dan>
References: <00c801c87979$9f3da480$1d00a8c0@dan>
"Dan Kaplan" <dkaplan@citizenhawk.com> writes:
> I've got a lot of rows in one table and a lot of rows in another table. I
> want to do a bunch of queries on their join column. One of these is like
> this: t1.col like '%t2.col%'
> I know that always sucks. I'm wondering how I can make it better.
tsearch or pg_trgm could probably help. Are you really after exact
substring-match semantics, or is this actually a poor man's substitute
for full text search? If you just want substrings then see pg_trgm,
if you want text search see tsearch.
regards, tom lane
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-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, dkaplan@citizenhawk.com
Subject: Re: Optimizing t1.col like '%t2.col%'
In-Reply-To: <7248.1204143983@sss.pgh.pa.us>
* 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