Re: partial index on a text field

From: "Chris" <chris(at)interspire(dot)com>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: partial index on a text field
Date: 2004-10-25 04:05:01
Message-ID: 001d01c4ba47$dec71590$0d00a8c0@chris
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Tom,

Perfect, thanks :)

I'll have another look at FTI now to see how it works (though from
memory it's a tedious process to get up and running).

Chris.

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Monday, October 25, 2004 1:57 PM
To: Chris
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] partial index on a text field

"Chris" <chris(at)interspire(dot)com> writes:
> chris=> create index blah on ff_index(substring(icontent, 0, 200));
> ERROR: syntax error at or near "(" at character 40

> I'm running v7.4.5.

Put an extra set of parens around it:

create index blah on ff_index((substring(icontent, 0, 200)));

"substring" looks like a function invocation but it isn't exactly, so
you have to treat this as a general expression index. (This little
inconsistency is fixed for 8.0, btw.)

Note that the index will only do you any good if your queries are
specifically written as "substring(icontent, 0, 200) LIKE 'pattern'". I
suspect that you should instead be looking at full-text-indexing methods
(see contrib/tsearch2, for instance).

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ken Tozier 2004-10-25 04:06:48 Complex query need help with OR condition.
Previous Message Tom Lane 2004-10-25 03:56:43 Re: partial index on a text field