Re: partial index on a text field

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: partial index on a text field
Дата
Msg-id 9988.1098676603@sss.pgh.pa.us
обсуждение исходный текст
Ответ на partial index on a text field  ("Chris" <chris@interspire.com>)
Ответы Re: partial index on a text field  ("Chris" <chris@interspire.com>)
Список pgsql-general
"Chris" <chris@interspire.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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Chris"
Дата:
Сообщение: partial index on a text field
Следующее
От: "Chris"
Дата:
Сообщение: Re: partial index on a text field