Re: PG won't use index on ORDER BY <expression>

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Andreas Joseph Krogh" <andreak(at)officenet(dot)no>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: PG won't use index on ORDER BY <expression>
Date: 2007-08-10 03:10:47
Message-ID: 87abt0rsnc.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Andreas Joseph Krogh" <andreak(at)officenet(dot)no> writes:

> Ooops, just fugured that out. But - it still doesn't use the index if I remove
> the "varchar_pattern_ops". I solved it by adding a function:

Hm, well it does for me, you would have to post your explain analyze to see
what's going on.

> Another question then: Why doesn't "varchar_pattern_ops" handle ordering? This
> means I need 2 indexes on the columns I want to match with LIKE and ORDER BY.
> Just doesn't seem right to need 2 "similar" indexes...

If you initd in the C locale you only need one index. In other locales the
collation order and the pattern order are different.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christian Kindler 2007-08-10 05:57:46 Returnd Refcurser (<unnamed portal x> not fetchable
Previous Message Tom Lane 2007-08-10 01:35:13 Re: PG won't use index on ORDER BY <expression>