Re: Re: What's faster? BEGIN ... EXCEPTION or CREATE TEMP TABLE IF NOT EXISTS? - Mailing list pgsql-general

From Moshe Jacobson
Subject Re: Re: What's faster? BEGIN ... EXCEPTION or CREATE TEMP TABLE IF NOT EXISTS?
Date
Msg-id CAJ4CxLm5ndT=9TFmiToCVOwPp7E0y9W2pBk8pNKNxJx5iNK4xA@mail.gmail.com
Whole thread Raw
In response to Re: What's faster? BEGIN ... EXCEPTION or CREATE TEMP TABLE IF NOT EXISTS?  (Ivan Voras <ivoras@freebsd.org>)
Responses Re: Re: What's faster? BEGIN ... EXCEPTION or CREATE TEMP TABLE IF NOT EXISTS?  (Ivan Voras <ivoras@freebsd.org>)
List pgsql-general
On Thu, Oct 4, 2012 at 6:12 AM, Ivan Voras <ivoras@freebsd.org> wrote:
On 01/10/2012 15:36, Moshe Jacobson wrote:
> I am working on an audit logging trigger that gets called for every row
> inserted, updated or deleted on any table.
> For this, I need to store a couple of temporary session variables such as
> the ID of the user performing the change, which can be set at the start of
> the session.

Do you know about session variables? 
The major benefit here is that it doesn't touch the table engines,
temporary or not.

This sounds incredibly useful. Why have I not heard of this until today??
In your example you still had to use a BEGIN...EXCEPTION block. Is that faster than a create temp table?

--
Moshe Jacobson
Nead Werx, Inc. | Senior Systems Engineer
2323 Cumberland Parkway, Suite 201 | Atlanta, GA 30339
moshe@neadwerx.com | 
www.neadwerx.com

pgsql-general by date:

Previous
From: serraios
Date:
Subject: Re: Building an home computer for best Poker Tracker performance
Next
From: Craig Ringer
Date:
Subject: Re: Building an home computer for best Poker Tracker performance