Re: Insert Data Into Tables Linked by Foreign Key - Mailing list pgsql-general

From Sam Mason
Subject Re: Insert Data Into Tables Linked by Foreign Key
Date
Msg-id 20100104125927.GV5407@samason.me.uk
Whole thread Raw
In response to Re: Insert Data Into Tables Linked by Foreign Key  (Yan Cheng Cheok <yccheok@yahoo.com>)
List pgsql-general
On Mon, Jan 04, 2010 at 04:53:16AM -0800, Yan Cheng Cheok wrote:
> From general point of view, having 3 SQL statement wrapped in a
> single stored procedure shall perform better due to reduced overhead
> to communicate with SQL server. Is that true? Or that is my false
> assumption?

I'd be tempted to put them into a stored procedure/function.  Less round
trips to server, plan can be cached, and easier code maintenance.  You
also get the option of tightening up security, functions can be defined
as "security definer" and permissions on original tables reduced.

--
  Sam  http://samason.me.uk/

pgsql-general by date:

Previous
From: Yan Cheng Cheok
Date:
Subject: Re: Insert Data Into Tables Linked by Foreign Key
Next
From: Alban Hertroys
Date:
Subject: Re: Insert Data Into Tables Linked by Foreign Key