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

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Ivan Voras <ivoras(at)freebsd(dot)org>
Cc: Moshe Jacobson <moshe(at)neadwerx(dot)com>, 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 13:55:18
Message-ID: CAHyXU0zVRmYP+6j6R5Q960sowodsGRzX+ZPtWRo6nfZWbTuK-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 5, 2012 at 3:09 AM, Ivan Voras <ivoras(at)freebsd(dot)org> wrote:
> I think I can make a fairly educated guess that catching exceptions
> while dealing with session variables should be much, much faster than
> creating any kind of a table :)

That is true, but it's not clear how using session variables keeps you
from having to create the table. If the table is already there, a
session variable guarding the table construction shouldn't be any
faster/better than a simple 'create if not exists'. A catalog scan is
basically boils down to a query. So I'm not sure that actually helps.

On the other hand, if the temp table can be completely ditched for a
session variable or two, then yeah, that would be much better since
you'd avoid the overhead of creating the table completely.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Moshe Jacobson 2012-10-05 14:29:54 Counting all results before LIMIT
Previous Message Shaun Thomas 2012-10-05 13:43:17 Re: Trajectory of a [Pg] DBA