Re: Xpath Index in PostgreSQL

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Xpath Index in PostgreSQL
Дата
Msg-id 29360.1267795352@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Xpath Index in PostgreSQL  (Chris Roffler <croffler@earthlink.net>)
Ответы Re: Xpath Index in PostgreSQL  (Chris Roffler <croffler@earthlink.net>)
Список pgsql-general
Chris Roffler <croffler@earthlink.net> writes:
> I am trying to setup an index on an xpath expression but the query never
> uses the index.
> Could someone enlighten me please ?

> Here is the setup :

> CREATE INDEX xml_index
>   ON time_series
>   USING btree
>   ((xpath('/AttributeList/Attributes/Attribute/Name/text()'::text,
> external_attributes)::text[]));

> And here is the query :

> select id, name
>  from
>   time_series
>  where
>  (xpath('/AttributeList/Attributes/Attribute/Name/text()',
> external_attributes))[1]::text='Attribute100'

Doesn't work that way --- subscripting isn't an indexable operation.
To make that query fast with a standard index, you'd need the index to
be on
    (xpath('/AttributeList/Attributes/Attribute/Name/text()',
    external_attributes))[1]::text

            regards, tom lane

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

Предыдущее
От: Chris Roffler
Дата:
Сообщение: Xpath Index in PostgreSQL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ERROR: row is too big: size 8176, maximum size 8160