pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Klemme <shortcutter@googlemail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Postgres for a "data warehouse", 5-10 TB
Date: Tue, 13 Sep 2011 22:26:04 +0200
Message-ID: <j4oe90$1i3$2@dough.gmane.org> (raw)
In-Reply-To: <CAFcOn2_PA=e4fbhfgRrzov8_OTyzmk7mrpii-NeuCXA7XuJ9wA@mail.gmail.com>
References: <CAMhtkAbK7saRO_Tayb1nS3YLWN=Wns=Ci47qs-3YbX0T2+hkpA@mail.gmail.com>
	<CAOR=d=0zmw-EGRJyYmwCTxR5g6osbFLS5i-3kzjG05j7S=1JaA@mail.gmail.com>
	<CAMhtkAah2c4XfSec=OtgL1V51wpD=jygbZnBVBRYCV02MscebQ@mail.gmail.com>
	<4E6CC458.4010206@squeakycode.net>
	<CABRT9RB-etP-K-0u0y-Wv+BysSd9ToZm71BqcY7hFQZC2tmjYQ@mail.gmail.com>
	<j4lens$hp0$1@dough.gmane.org>
	<4E6E3FE8.5070609@squeakycode.net>
	<j4ltdo$r65$1@dough.gmane.org>
	<CABRT9RAJvq0bzBnqtEzc=80H7oYPYC4LggKWZOYcDbRRMnskJA@mail.gmail.com>
	<CAM9pMnMFXPnvVt9GR2iUfJoP-c4gpiQCVQFDPc1EFH+wxTGUhg@mail.gmail.com>
	<CABRT9RAKjmoa91sOBySx97=0ZKv64sD7miY0ZgUDu9dK0rQygw@mail.gmail.com>
	<CAFcOn2_PA=e4fbhfgRrzov8_OTyzmk7mrpii-NeuCXA7XuJ9wA@mail.gmail.com>

On 13.09.2011 20:57, Stefan Keller wrote:
> Interesting debate.

Indeed.

> 2011/9/13 Marti Raudsepp<marti@juffo.org>:
>> Yes, every BEGIN/EXCEPTION block creates a subtransaction -- like a
>> SAVEPOINT it can roll back to in case of an error.
>
> Are you sure? In theory I always understood that there are no
> "subtransactions".

What theory are you referring to?

> In fact when looking at the docs there is chapter 39.6.6. saying "By
> default, any error occurring in a PL/pgSQL function aborts execution
> of the function, and indeed of the surrounding transaction as well.
> You can trap errors and recover from them by using a BEGIN block with
> an EXCEPTION clause."
> (http://www.postgresql.org/docs/current/interactive/plpgsql-control-structures.html
> )
>
> So the doc isn't totally explicit about this. But whatever: What would
> be the the function of a subtransaction? To give the possibility to
> recover and continue within the surrounding transaction?

I find this pretty explicit:

It is important not to confuse the use of BEGIN/END for grouping 
statements in PL/pgSQL with the similarly-named SQL commands for 
transaction control. PL/pgSQL's BEGIN/END are only for grouping; they do 
not start or end a transaction. Functions and trigger procedures are 
always executed within a transaction established by an outer query — 
they cannot start or commit that transaction, since there would be no 
context for them to execute in. However, a block containing an EXCEPTION 
clause effectively forms a subtransaction that can be rolled back 
without affecting the outer transaction. For more about that see Section 
38.6.5.

http://www.postgresql.org/docs/8.4/interactive/plpgsql-structure.html

Cheers

	robert






view thread (48+ messages)  latest in thread

Message-ID: <j4oe90$1i3$2@dough.gmane.org>
Permalink:  ../j4oe90$1i3$2@dough.gmane.org/
Also on:    postgresql.org/message-id/j4oe90$1i3$2@dough.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: shortcutter@googlemail.com
  Subject: Re: Postgres for a "data warehouse", 5-10 TB
  In-Reply-To: <j4oe90$1i3$2@dough.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox