Re: Database Integrity - Mailing list pgsql-novice

From Daniel Staal
Subject Re: Database Integrity
Date
Msg-id 9934586dc368d546f523f9ea71bbfa11.squirrel@www.magehandbook.com
Whole thread Raw
In response to Re: Database Integrity  (Ramy Abdel-Azim <ramy.abdel-azim@startdatelabs.com>)
List pgsql-novice
On Fri, November 18, 2011 2:34 pm, Ramy Abdel-Azim wrote:
> The purpose of using a transaction is so that if you run your delete
> statement and realize that you've deleted the wrong rows, you can roll
> the transaction back and get those rows back. You can then modify your
> query and try again and when you finally get it right, issue a commit
> command.

In other words: What do you mean by 'database integrity'?  If all you are
asking is if the database will still return queries, you don't need the
transaction.  If you need those queries to return some consistent logical
state that the delete would have affected, you probably do need the
transaction.

If your application can run correctly with 'half' of the delete run, you
don't need to be sure the whole delete ran.  If it can't, here's a tool to
make sure either the whole delete ran or none of it did.

The choice for which you need is up to you, and depends on what you are
doing.  ;)

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------


pgsql-novice by date:

Previous
From: "Jean-Yves F. Barbier"
Date:
Subject: Re: Database Integrity
Next
From: "Jean-Yves F. Barbier"
Date:
Subject: Re: Database Integrity