Re: Functional index and string concatenation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Edmund Bacon <ebacon(at)onesystem(dot)com>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Functional index and string concatenation
Date: 2004-03-08 15:48:35
Message-ID: 4125.1078760915@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Edmund Bacon <ebacon(at)onesystem(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message terry 2004-03-08 16:02:13 Trying to make efficient "all vendors who can provide all items"
Previous Message Edmund Bacon 2004-03-08 15:28:07 Re: Functional index and string concatenation