Re: Partition insert trigger using C language

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Partition insert trigger using C language
Дата
Msg-id 50EFE74B.9040007@vmware.com
обсуждение исходный текст
Ответ на Re: 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>)
Список pgsql-performance
On 10.01.2013 21:48, Matheus de Oliveira wrote:
> I have made a small modification to keep the plans, and it got from
> 33957.768ms to 43782.376ms.

If I'm reading results.txt correctly, the avg runtimes are:

C and SPI_execute_with_args: 58567.708 ms
C and SPI_(prepare/keepplan/execute_plan): 43782.376 ms
C and heap_insert: 33957.768 ms

So switching to prepared plans helped quite a lot, but it's still slower
than direct heap_inserts.

One thing that caught my eye:

> CREATE OR REPLACE FUNCTION partition_insert_trigger_spi()
> RETURNS trigger
> LANGUAGE C
> VOLATILE STRICT
> AS 'partition_insert_trigger_spi','partition_insert_trigger_spi'
> SET DateStyle TO 'ISO';

Calling a function with SET options has a fair amount of overhead, to
set/restore the GUC on every invocation. That should be avoided in a
performance critical function like this.

- Heikki


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

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