Re: looking for a faster way to do that

From: Alban Hertroys <haramrae(at)gmail(dot)com>
To: hamann(dot)w(at)t-online(dot)de
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: looking for a faster way to do that
Date: 2011-09-22 12:32:06
Message-ID: CAF-3MvP2YqTVDhUmYdFL+8n0=3UjEGQYAAm6f4QDczf7ebjsmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 21 September 2011 17:59, <hamann(dot)w(at)t-online(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2011-09-22 12:50:06 Re: why VOLATILE attribute is required?
Previous Message Ondrej Ivanič 2011-09-22 12:31:58 Re: limitby without orderby