pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Edmund Bacon <ebacon@onesystem.com>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Functional index and string concatenation
Date: Mon, 08 Mar 2004 10:48:35 -0500
Message-ID: <4125.1078760915@sss.pgh.pa.us> (raw)
In-Reply-To: <1078759686.10233.1.camel@elb_lx.onesystem.ca>
References: <404C8F08.2070403@yahoo.com.br>
	<1078759686.10233.1.camel@elb_lx.onesystem.ca>

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



view thread (5+ messages)  latest in thread

Message-ID: <4125.1078760915@sss.pgh.pa.us>
Permalink:  ../4125.1078760915@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4125.1078760915@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, ebacon@onesystem.com
  Subject: Re: Functional index and string concatenation
  In-Reply-To: <4125.1078760915@sss.pgh.pa.us>

* 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