Re: Performance issues with compaq server

From: John Gray <jgray(at)azuli(dot)co(dot)uk>
To: holger(at)marzen(dot)de
Cc: Doug McNaught <doug(at)wireboard(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, "Samuel J(dot) Sutjiono" <ssutjiono(at)wc-group(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Performance issues with compaq server
Date: 2002-05-09 11:43:33
Message-ID: 1020944616.1592.103.camel@adzuki
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On Thu, 2002-05-09 at 12:23, Holger Marzen wrote:
> On 9 May 2002, Doug McNaught wrote:
>
> > Holger Marzen <holger(at)marzen(dot)de> writes:
> >
> > > Is there a rule in SQL standards that describes what should happen if
> > > some statemens in a transaction fail and the program issues a commit?
> >
> > I think PG's is standard behavior; that's kind of the whole point of
> > having transactions.
>
> - rolling back the whole transaction if you do a COMMIT
> or
> - keeping the changes until the first failing statement and ignoring
> everything that follows if you do a COMMIT
>

I can't speak to the phrasing of the standard, but PG behaviour is:

Everything in the transaction is ignored. All the inserts made before
the error, since the BEGIN, are rolled back. All subsequent inserts are
ignored (generating an error that transaction is in ABORT state). The
subsequent COMMIT will end the transaction (and thus clear the abort
state) but *will not commit anything*.

This means that scripts will work as intended -namely that all or none
of the commands within a transaction block will succeed[*]. So if you
split your insert into blocks, and one block fails, you will only need
to correct that block and try to load it again.

Regards

John

[*] This is handy for doing things like reindexing or drop/recreate
table in a script. The drop table stands a good chance of succeeding,
whereas the prospect of a syntax error in the create table makes it more
likely to fail. A subsequent commit of the DROP TABLE would not produce
the end result you intended....

--
John Gray
Azuli IT
www.azuli.co.uk

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Denis Gasparin 2002-05-09 12:29:50 Re: Performance issues with compaq server
Previous Message Holger Marzen 2002-05-09 11:24:12 Re: Performance issues with compaq server

Browse pgsql-sql by date

  From Date Subject
Next Message Bolek Bakowski 2002-05-09 12:08:49 Re: Connection to multiple databases
Previous Message Holger Marzen 2002-05-09 11:24:12 Re: Performance issues with compaq server