dbTalk Databases Forums  

Need feedback on db design

comp.databases comp.databases


Discuss Need feedback on db design in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Need feedback on db design - 05-03-2006 , 08:22 AM






I'm working on a dual entry bookkeeping system, and want to track
transactions (not the db kind) occuring on accounts. I group these
transactions in 'entries', to add common attributes and so on, but
that's probably not relevant for this discussion.

Thing is, I'd like to structure my chart of accounts as a hierarchy,
e.g. Expenses / Cars / Volvo / Gas, and whenever i tank up the Volvo,
I'd also like the expenses total to change.

To make this happen, I'm thinking a view that duplicate transactions
for all of the accounts' ancestors might do the trick? Updating
multiple locations certainly isn't an option.

Which data structure would you suggest for my chart of accounts? I
assume that being able to efficiently select all ancestors for a node
is fairly important? Perhaps there are even better structures than a
tree for grouping accounts?

This is the kind of thing views are used for, right, and performance
shouldn't be too bad? I'm using postgres 8.1.something.

On a final note; how should I go about being 100% sure the transactions
in an 'entry' sum up to zero? (yup, this belongs on the application
level, but nm that for now)

Any replies appreciated,
Isak


Reply With Quote
  #2  
Old   
David Cressey
 
Posts: n/a

Default Re: Need feedback on db design - 05-04-2006 , 06:47 AM







<isak.hansen (AT) gmail (DOT) com> wrote

Quote:
I'm working on a dual entry bookkeeping system, and want to track
transactions (not the db kind) occuring on accounts. I group these
transactions in 'entries', to add common attributes and so on, but
that's probably not relevant for this discussion.

Thing is, I'd like to structure my chart of accounts as a hierarchy,
e.g. Expenses / Cars / Volvo / Gas, and whenever i tank up the Volvo,
I'd also like the expenses total to change.

To make this happen, I'm thinking a view that duplicate transactions
for all of the accounts' ancestors might do the trick? Updating
multiple locations certainly isn't an option.

Which data structure would you suggest for my chart of accounts? I
assume that being able to efficiently select all ancestors for a node
is fairly important? Perhaps there are even better structures than a
tree for grouping accounts?

This is the kind of thing views are used for, right, and performance
shouldn't be too bad? I'm using postgres 8.1.something.

On a final note; how should I go about being 100% sure the transactions
in an 'entry' sum up to zero? (yup, this belongs on the application
level, but nm that for now)

Any replies appreciated,
Isak

I suggest you look into the "nested sets" model of expressing the hierarchy
of accounts. You may find it relevant to
what I'm going to call "rolling up" the balances in individual accounts to
balances of group accounts. Excuse me if my terminology is wrong, here.

Speaking of terminology, I would have used the term "transaction", where
you used the word "entry". And I would have used the term "transaction
item" where you used the term "transaction". I wonder which set of
terminology an accountant would use.




Reply With Quote
  #3  
Old   
TKnTexas
 
Posts: n/a

Default Re: Need feedback on db design - 05-09-2006 , 08:31 PM



As an accountant, I use the term transaction for items posted to the
general ledger.


Reply With Quote
  #4  
Old   
TKnTexas
 
Posts: n/a

Default Re: Need feedback on db design - 05-09-2006 , 08:31 PM



As an accountant, I use the term transaction for items posted to the
general ledger.


Reply With Quote
  #5  
Old   
TKnTexas
 
Posts: n/a

Default Re: Need feedback on db design - 05-09-2006 , 08:31 PM



As an accountant, I use the term transaction for items posted to the
general ledger.


Reply With Quote
  #6  
Old   
David Cressey
 
Posts: n/a

Default Re: Need feedback on db design - 05-10-2006 , 12:40 PM




"TKnTexas" <tkntexas55 (AT) aol (DOT) com> wrote

Quote:
As an accountant, I use the term transaction for items posted to the
general ledger.

Let me make sure I understand. If I use an ATM to transfer $100 from
savings to checking, that results in TWO transactions: One to debit my
savings account, and the other to credit my checking account.

Am I understanding you right?




Reply With Quote
  #7  
Old   
Isak Hansen
 
Posts: n/a

Default Re: Need feedback on db design - 05-15-2006 , 08:12 AM



Thanks for the feedback, we are experimenting with nested sets at the
moment.

And while we're on the topic of terminology; what word would you use
for those two transactions in the example above as a single entity (or
any set of transactions that belong together).


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.