Re: Functional index and string concatenation - Mailing list pgsql-sql

From Tom Lane
Subject Re: Functional index and string concatenation
Date
Msg-id 4125.1078760915@sss.pgh.pa.us
Whole thread Raw
In response to Re: Functional index and string concatenation  (Edmund Bacon <ebacon@onesystem.com>)
List pgsql-sql
Edmund Bacon <ebacon@onesystem.com> writes:
> On Mon, 2004-03-08 at 08:19, Daniel Henrique Alves Lima wrote:
>> Is there a way to create a "functional index" over a string 
>> concatenation of two columns ?

> test=# create index str_idx on strtable( textcat(str1, str2) );

As of 7.4 you can do it more directly:

create index str_idx on strtable( (str1 || str2) );

The disadvantage of the textcat() locution is that the planner will only
match it up to queries that also say textcat().
        regards, tom lane


pgsql-sql by date:

Previous
From: Edmund Bacon
Date:
Subject: Re: Functional index and string concatenation
Next
From: Daniel Henrique Alves Lima
Date:
Subject: Re: Functional index and string concatenation