Re: Database Integrity

From: "Daniel Staal" <DStaal(at)usa(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Database Integrity
Date: 2011-11-18 19:46:48
Message-ID: 9934586dc368d546f523f9ea71bbfa11.squirrel@www.magehandbook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.
---------------------------------------------------------------

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jean-Yves F. Barbier 2011-11-18 19:48:57 Re: Database Integrity
Previous Message Jean-Yves F. Barbier 2011-11-18 19:44:33 Re: Database Integrity