pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gregory Stark <stark@enterprisedb.com>
To: Andreas Joseph Krogh <andreak@officenet.no>
Cc: pgsql-sql@postgresql.org
Subject: Re: PG won't use index on ORDER BY <expression>
Date: Fri, 10 Aug 2007 04:10:47 +0100
Message-ID: <87abt0rsnc.fsf@oxford.xeocode.com> (raw)
In-Reply-To: <200708092238.46284.andreak@officenet.no>
References: <200708092018.44111.andreak@officenet.no>
	<87fy2s1nrd.fsf@oxford.xeocode.com>
	<200708092238.46284.andreak@officenet.no>

"Andreas Joseph Krogh" <andreak@officenet.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




view thread (9+ messages)

Message-ID: <87abt0rsnc.fsf@oxford.xeocode.com>
Permalink:  ../87abt0rsnc.fsf@oxford.xeocode.com/
Also on:    postgresql.org/message-id/87abt0rsnc.fsf@oxford.xeocode.com

 · 

reply

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-sql@postgresql.org
  Cc: stark@enterprisedb.com, andreak@officenet.no
  Subject: Re: PG won't use index on ORDER BY <expression>
  In-Reply-To: <87abt0rsnc.fsf@oxford.xeocode.com>

* 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