Re: Partition insert trigger using C language

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Partition insert trigger using C language
Дата
Msg-id 50EF0E81.1010808@vmware.com
обсуждение исходный текст
Ответ на Partition insert trigger using C language  (Matheus de Oliveira <matioli.matheus@gmail.com>)
Ответы Re: Partition insert trigger using C language  (Matheus de Oliveira <matioli.matheus@gmail.com>)
Re: Partition insert trigger using C language  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-performance
On 10.01.2013 20:45, Matheus de Oliveira wrote:
> Inspired by Charles' thread and the work of Emmanuel [1], I have made some
> experiments trying to create a trigger to make partitioning using C
> language.
>
> The first attempt was not good, I tried to use SPI [2] to create a query to
> insert into the correct child table, but it took almost no improvement
> compared with the PL/pgSQL code.

The right way to do this with SPI is to prepare each insert-statement on
first invocation (SPI_prepare + SPI_keepplan), and reuse the plan after
that (SPI_execute_with_args).

If you construct and plan the query on every invocation, it's not
surprising that it's no different from PL/pgSQL performance.

- Heikki


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

Предыдущее
От: Matheus de Oliveira
Дата:
Сообщение: Re: Slow query after upgrade from 9.0 to 9.2
Следующее
От: Matheus de Oliveira
Дата:
Сообщение: Re: Partition insert trigger using C language