tags:

views:

215

answers:

7

For compliance reasons, when I delete a user's personal information from the database in my current project, the relevant rows need to be really, irrecoverably deleted.

The database we are using is postgres 8.x,

Is there anything I can do, beyond running COMPACT/VACUUM regularly?

Thankfully, our backups will be held by others, and they are allowed to keep the deleted information.

+1  A: 

"Irrecoverable deletion" is harder than it sounds, and extends beyond your database. For example, are you planning on going back to all previous instances of your database on tape/backup where this row also exists, and deleting it there too?

Consider a regular deletion and the periodic VACUUMing that you mentioned before.

John Feminella
+1  A: 

Do you back up your database? - If Yes, make sure you delete it from Back ups too.

Is that because of security risk? In that case, I'd change the data in the row and then delete the row.

Skuta
My understanding is editing a row creates a new copy of the row in the db, and marks the old row as obsolete, this would be worse than simply deleting the row
NSherwin
A: 

This is not something that you can do on the software side. Its a hardware issue to really delete it you need to physically destroy the drive.

Andrew Clark
+1  A: 

This thread had some good answers in it which may apply to you

DJ
Thats very helpfull, Thank you
NSherwin
+1  A: 

Perhaps I'm off on a tangent, but do you really want to delete users like that? Most identity & access management approaches recommend keeping users around but in a flagged-as-deleted state, in order not to lose auditing ability (what has this user been up to in the previous five years)?

Deleting user information might be needed for integrity compliance reasons, or for nefarious black-hat purposes. In neither case is there a deletion method which guarantees that no traces could be left of the user's existence, as has been noted in other posts.

Perhaps you should elaborate as to why such an irrevocable delete is desirable...?

Pontus Gagge
I agree with this going this route as well. If office politics get involved, then have a look at this article... http://www.adaptivepath.com/ideas/essays/archives/000251.php
invenetix
European directive on data protection mandates that personal data be deleted when no longer necessary. Keeping it "just in case" is therefore prohibited. This directive is implemented in the law of all European Union members. It may be his case.
bortzmeyer
A: 

To accomplish the "D" in ACID, relational databases use a transaction log type system for changes to the database. When a delete is made that delete is made to a memory copy of the data (buffer cache) and then written to a transaction log file in synchronous mode. If the database were to crash the transaction log would be replayed to bring the system back to the correct state. So a delete exists in multiple locations where it would have to be removed. Only at some later time is the record "deleted" from the actual data file on disk (and any indexes). This amount of time varies depending on the database.

Logicalmind
A: 

How about overwriting the record with random characters/dates/numbers etc?

David Aldridge
My understanding is this will create a new row on disk, and mark the old row as obsolete, not overwrite the existing row.
NSherwin
An update in Postgres creates a new row?
David Aldridge