Re: looking for a faster way to do that - Mailing list pgsql-general

From Alban Hertroys
Subject Re: looking for a faster way to do that
Date
Msg-id CAF-3MvP2YqTVDhUmYdFL+8n0=3UjEGQYAAm6f4QDczf7ebjsmQ@mail.gmail.com
Whole thread Raw
In response to looking for a faster way to do that  (hamann.w@t-online.de)
List pgsql-general
On 21 September 2011 17:59, <hamann.w@t-online.de> wrote:
If I try to get many items on a prefix match
select code .... where code ~ wantcode
things go very slow. Explain shows a nested loop, so seemingly the table is rescanned
for every wanted item in the other table. A test run (3000 wanted codes against a
shortened table of 10000 ones) took about 200 seconds to complete

What is the output of explain?

You say 'the other table', so presumably we're dealing with a foreign key here. Is there an index on that column?

--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

pgsql-general by date:

Previous
From: Ondrej Ivanič
Date:
Subject: Re: limitby without orderby
Next
From: "Reuven M. Lerner"
Date:
Subject: Speed of lo_unlink vs. DELETE on BYTEA