projectbarbel / barbelhisto-core

Lightweight ultra-fast library to store data in bi-temporal format
MIT License
42 stars 0 forks source link

Bitemporal deletes #9

Open vdurbha opened 4 years ago

vdurbha commented 4 years ago

I was going through examples in Snodgrass book on bitemporal deletes and here's how I understood how he was doing them.

Step1: John is a new customer on Jan 1st, 2020 Cust.No Cust Name VT Begin VT End TT Start TT End 1 John 2020-01-01 9999-12-31 2020-01-01 9999-12-31

Step2: John is no more a customer as of Feb 28th, 2020 Cust.No Cust Name VT Begin VT End TT Start TT End 1 John 2020-01-01 9999-12-31 2020-01-01 2020-02-28 1 John 2020-01-01 2020-02-28 2020-02-28 9999-12-31

Is my understanding correct? Can we support deletes in this manner without extra flags/columns in my business entities?

nschlimm commented 4 years ago

Hi mate, if you have some field on your customer object saying if „John“ is a customer or is not a customer (e.g. a boolean field), then you would no longer need any other status field. Hope that helps. Regards, Niklas

vdurbha commented 4 years ago

I understand that. However, most common query that we make is to fetch the current valid records from a table. Introducing a field in each table makes all the queries complicated and joins even more so where we have to have the boolean check every time.

If delete can be done the way of that example, then all common queries will be very simple. Just wanted to know your thoughts.

On Fri, Feb 28, 2020 at 1:15 AM Niklas Schlimm notifications@github.com wrote:

Hi mate, if you have some field on your customer object saying if „John“ is a customer or is not a customer (e.g. a boolean field), then you would no longer need any other status field. Hope that helps. Regards, Niklas

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/projectbarbel/barbelhisto-core/issues/9?email_source=notifications&email_token=AACW44FKFKMLKYBQ76YEUVDRFAJ5PA5CNFSM4K5BVHO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENFWLAQ#issuecomment-592143746, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACW44HJS6AX6ALRJK4KMW3RFAJ5PANCNFSM4K5BVHOQ .

nschlimm commented 4 years ago

The best way to understand the concept is to realize that there is no deletion in bitemporal data. There is just a NEW OBECT STATUS created saying that, from a certain time, this object is „not relevant anymore from a business perspective“. This is usually expressed by a user-defined status field.

vdurbha commented 4 years ago

I apologize if I'm repeating my point again. But if possible, can you walk through some of the slides in this link that talks about bitemporal deletes and how they manipulate end timestamps (effective_end and transaction_end) to perform logical deletes?

https://www.slideshare.net/torp42/temporal-databases-modifications

I was wondering if BarbelHisto can support such functionality. Appreciate your patience in trying to answer my questions.