Re: Best way to use indexes for partial match at beginning - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Best way to use indexes for partial match at beginning
Date
Msg-id 200511100147.00215.peter_e@gmx.net
Whole thread Raw
In response to Re: Best way to use indexes for partial match at beginning  ("Andrus" <eetasoft@online.ee>)
List pgsql-general
Andrus wrote:
> > SELECT * FROM foo WHERE bar::CHAR(1) = 'A';
> > SELECT * FROM foo WHERE bar::CHAR(1) = 'B';
> > SELECT * FROM foo WHERE bar::CHAR(2) = 'BC';
> > SELECT * FROM foo WHERE bar::CHAR(3) = 'ABC';

> Can you confirm that in this case Postgres 8.1 can use index created
> by
> CREATE TABLE foo ( bar CHAR(10) PRIMARY KEY );
> even on non-C locale ?

It will not use the index no matter what locale.  You would in these
cases need to create additional expression indexes on bar::char(1) etc.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

pgsql-general by date:

Previous
From: Andreas
Date:
Subject: Re: Schemas shown in ODBC
Next
From: Alex
Date:
Subject: Re: Question on Insert / Update