From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
---|---|
To: | Brandon Phelps <bphelps(at)gls(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Function Question - Inserting into a table with foreign constraints |
Date: | 2011-11-05 15:24:36 |
Message-ID: | 4EB55534.9000005@iol.ie |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 05/11/2011 14:46, Brandon Phelps wrote:
>
> With the method you outlined will I notice any huge performance
> impacts? The application would be parsing incoming data from another
> 3rd party application and could, at times, be executing the function in
> very fast succession, although never twice at the exact same moment
> (single threaded application, pending events will just block until
> they're up).
I honestly don't know... your best bet would be to benchmark and see.
I'd guess that any changes to the code within the function would have
less effect than local conditions - disk I/O, processor speed, etc.
AIUI, putting your code into a function has the advantage that the
Potgres only has to load pl/pgsql and parse the function once for any
given connection, and then the plan is reused for all subsequent
invocations coming from that connection.
If the function is only going to be called once per connection, then you
have the overhead of loading pl/pgsql each time it is called, on top of
parsing the function; so you might be better off trying to do this
outside of a function altogether.
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie
From | Date | Subject | |
---|---|---|---|
Next Message | Andrus | 2011-11-05 15:36:47 | How to find owning schema in function |
Previous Message | David Johnston | 2011-11-05 15:23:26 | Re: Function Question - Inserting into a table with foreign constraints |