Re: Joins on many-to-many relations.

From: Rodrigo De León <rdeleonp(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Cc: "Wiebe Cazemier" <halfgaar(at)gmx(dot)net>
Subject: Re: Joins on many-to-many relations.
Date: 2007-03-15 14:05:45
Message-ID: a55915760703150705j3b4c2b3esd94d4a27d31ee658@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 3/14/07, Wiebe Cazemier <halfgaar(at)gmx(dot)net> wrote:
> I discovered that removing the subselect (the entire second condition of
> the join actually) is not the only thing that speeds it up. If I remove
> the LIKE check on account.description, it's also a lot faster (152 ms
> as opposed to 2915 ms), although not as fast as without the subselect.
> I don't understand why that makes such a big difference. There is an
> index on upper() on the field.

From http://www.postgresql.org/docs/8.2/static/indexes-types.html :

"The optimizer can also use a B-tree index for queries involving the
pattern matching operators LIKE and ~ if the pattern is a constant and
is anchored to the beginning of the string — for example, col LIKE
'foo%' or col ~ '^foo', but not col LIKE '%bar'."

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Wiebe Cazemier 2007-03-15 14:16:07 Re: Joins on many-to-many relations.
Previous Message A. Kretschmer 2007-03-15 13:46:41 Re: Alter Table