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: Thu, 10 Jan 2013 21:22:25 +0200
Message-ID: <50EF14F1.5070901@vmware.com> (raw)
In-Reply-To: <CAJghg4LeodBzGa=9D11HK+v2+ttiFFQtxKwEBKMo-3RDPNQiyg@mail.gmail.com>
References: <CAJghg4KJToKVdr=uecKyOYUjx5h3iNdxYPyhLst=8Lv78Oac+w@mail.gmail.com>
	<50EF0E81.1010808@vmware.com>
	<CAJghg4LeodBzGa=9D11HK+v2+ttiFFQtxKwEBKMo-3RDPNQiyg@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 10.01.2013 21:11, Matheus de Oliveira wrote:
> On Thu, Jan 10, 2013 at 4:54 PM, Heikki Linnakangas<hlinnakangas@vmware.com
>> wrote:
>
>> 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.
>
> Yeah. I thought about that, but the problem was that I assumed the INSERTs
> came with random date, so in the worst scenario I would have to keep the
> plans of all of the child partitions. Am I wrong?
>
> But thinking better, even with hundreds of partitions, it wouldn't use to
> much memory/resource, would it?

Right, a few hundred saved plans would probably still be ok. And if that 
ever becomes a problem, you could keep the plans in a LRU list and only 
keep the last 100 plans or so.

- 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: <50EF14F1.5070901@vmware.com>
Permalink:  ../50EF14F1.5070901@vmware.com/
Also on:    postgresql.org/message-id/50EF14F1.5070901@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: <50EF14F1.5070901@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