Re: Re: What's faster? BEGIN ... EXCEPTION or CREATE TEMP TABLE IF NOT EXISTS?

From: Moshe Jacobson <moshe(at)neadwerx(dot)com>
To: Ivan Voras <ivoras(at)freebsd(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: What's faster? BEGIN ... EXCEPTION or CREATE TEMP TABLE IF NOT EXISTS?
Date: 2012-10-05 02:53:09
Message-ID: CAJ4CxLm5ndT=9TFmiToCVOwPp7E0y9W2pBk8pNKNxJx5iNK4xA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Oct 4, 2012 at 6:12 AM, Ivan Voras <ivoras(at)freebsd(dot)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(at)neadwerx(dot)com | www.neadwerx.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2012-10-05 03:45:04 Re: Building an home computer for best Poker Tracker performance
Previous Message Tom Lane 2012-10-04 23:14:31 Re: Thousands of schemas and ANALYZE goes out of memory