Re: table versioning approach (not auditing)

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: table versioning approach (not auditing)
Дата
Msg-id 54348562.4000200@BlueTreble.com
обсуждение исходный текст
Ответ на Re: table versioning approach (not auditing)  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
Ответы Re: table versioning approach (not auditing)  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
Список pgsql-general
On 10/6/14, 6:10 PM, Gavin Flower wrote:
> Even if timestamps are used extensively, you'd have to be careful joining on them. You may have information valid at
T1and changing at T3, but the transaction has T2, where T1 < T2 < T3 - the appropriate set of data would be associated
withT1, would would not get anywhere trying to find data with a timestamp of T2 (unless you were very lucky!). 

Yeah, this is why I think timestamps need to be shunned in favor of explicit pointers. Anyone that thinks timestamps
aregood enough hasn't thought the problem through completely. :) 

I also think there's potential value to storing full transaction information (presumably in a separate table):
txid_current(),txid_current_snapshot(), now(), current_user, maybe some other stuff (client IP address?). That way you
cantell exactly what created a history record. With appropriate shenanigans you can theoretically determine exactly
whatother history data would be visible at that time without using pointers (but man would that bu ugly!) 

> Actually things like phone numbers are tricky.  Sometimes you may want to use the current phone number, and not the
oneextant at that time (as you want to phone the contact now), or you may still want the old phone number (was the call
toa specific number at date/time legitimate & who do we charge the cost of the call too). 

Yeah, I'm pretty convinced at this point that history/versioning should be built on top of a schema that always
containsthe current information, if for no other reason than so you always have a PK that points to what's current in
additionto your history PKs. 
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com


В списке pgsql-general по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: index behavior question - multicolumn not consulted ?
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Converting char to varchar automatically