Re: Insert Data Into Tables Linked by Foreign Key

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Insert Data Into Tables Linked by Foreign Key
Date: 2010-01-04 12:59:27
Message-ID: 20100104125927.GV5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2010-01-04 13:03:58 Re: Insert Data Into Tables Linked by Foreign Key
Previous Message Yan Cheng Cheok 2010-01-04 12:53:16 Re: Insert Data Into Tables Linked by Foreign Key