pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Matheus de Oliveira <matioli.matheus@gmail.com>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Cc: Charles Gomes <charlesrg@outlook.com>
Subject: Re: Partition insert trigger using C language
Date: Fri, 11 Jan 2013 12:19:55 +0200
Message-ID: <50EFE74B.9040007@vmware.com> (raw)
In-Reply-To: <CAJghg4LwS_2+987yDvDW3+Hc2u-t1CW-9uOrd-QS870piJ8S_A@mail.gmail.com>
References: <CAJghg4KJToKVdr=uecKyOYUjx5h3iNdxYPyhLst=8Lv78Oac+w@mail.gmail.com>
	<50EF0E81.1010808@vmware.com>
	<CAJghg4LeodBzGa=9D11HK+v2+ttiFFQtxKwEBKMo-3RDPNQiyg@mail.gmail.com>
	<50EF14F1.5070901@vmware.com>
	<CAJghg4LwS_2+987yDvDW3+Hc2u-t1CW-9uOrd-QS870piJ8S_A@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (15+ messages)  latest in thread

Message-ID: <50EFE74B.9040007@vmware.com>
Permalink:  ../50EFE74B.9040007@vmware.com/
Also on:    postgresql.org/message-id/50EFE74B.9040007@vmware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: hlinnakangas@vmware.com, matioli.matheus@gmail.com, charlesrg@outlook.com
  Subject: Re: Partition insert trigger using C language
  In-Reply-To: <50EFE74B.9040007@vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox