Re: Index on substring?

From: "Roderick A(dot) Anderson" <raanders(at)altoplanos(dot)net>
To: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index on substring?
Date: 2000-10-12 14:53:20
Message-ID: Pine.LNX.4.10.10010120745360.14583-100000@altoplanos.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 12 Oct 2000, Tom Lane wrote:

> Jeff Eckermann <jeckermann(at)verio(dot)net> writes:
> > extracts=# create index c_namesum_i on customers (substr(bill_company,1,5));
> > ERROR: parser: parse error at or near "1"
>
> The functional-index syntax only allows a function name applied to
> simple column names.
>
> You can work around this by defining a function that handles any
> additional computation needed, eg,

I can't help but think this is a table design issue. Maybe not fully
normalized or needs to be de-normalized some. If the index is part of a
continuing need I'd suggest adding a column made up of the substring and
indexing on it instead. If the design isn't too far along review the
bill_company attribute (column) and see it it should be two columns.
It's always been easier for me to tie pieces together (views) than to
break them out of chunks.

Rod
--
Roderick A. Anderson
raanders(at)altoplanos(dot)net Altoplanos Information Systems, Inc.
Voice: 208.765.6149 212 S. 11th Street, Suite 5
FAX: 208.664.5299 Coeur d'Alene, ID 83814

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin Tomes 2000-10-12 15:09:52 Query optimisation on two machines is different.
Previous Message Peter Eisentraut 2000-10-12 14:51:57 Re: [HACKERS] Re: postgresql 7.1