Skip site navigation (1) Skip section navigation (2)

Re: Deletes hurt

From: Paul Lambert <paul(dot)lambert(at)autoledgers(dot)com(dot)au>
To: Chris Hoover <revoohc(at)gmail(dot)com>
Cc: Jim Nasby <decibel(at)decibel(dot)org>,"pgsql-admin(at)postgresql(dot)org Admin" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Deletes hurt
Date: 2007-05-31 22:42:04
Message-ID: 465F4F3C.6060709@autoledgers.com.au (view raw or flat)
Thread:
Lists: pgsql-admin
Chris Hoover wrote:
> Just curious, what sort of field do they use to mark the rows?  I'm 
> assuming a timestamp since it would half to be part of the primary key, 
> or am I way off?  This has really gotten me thinking about how I might 
> implement this in my database.
> 
> Thanks,
> 
> Chris
> 

I do this on a number of tables in my database, I use a byte to store a 
status, with each 'bit' meaning something, usually the 128 bit indicates 
deleted, so any value over 128 means the record is not current and that 
is tested for in any standard queries.

This doesn't get around allowing multiple rows with the same data, with 
one being current and the rest deleted - but that's not an issue in my 
system. If it's deleted it's deleted, it doesn't get recreated, but can 
be restored, thus not using an actual delete fits my scenario quite well.	


-- 
Paul Lambert
Database Administrator
AutoLedgers


In response to

pgsql-admin by date

Next:From: Robert TreatDate: 2007-06-01 02:30:50
Subject: Re: PostgreSQL Training?
Previous:From: Chris HooverDate: 2007-05-31 19:10:13
Subject: Re: Deletes hurt

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group