If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Selecting attributes for an Entity

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-26-04, 13:27
jawwadalam jawwadalam is offline
Registered User
 
Join Date: Dec 2004
Posts: 1
Question Selecting attributes for an Entity

Hi,

My question is about selecting attributes for an Entity, The case is
as follows
Entity is STUDENT
Fee recieved per month is recorded, as well as the total fee recieved
(including the fine) is stored per semester and per year as well.
My Question is should I store the three values in database or should
i simply store the fee recieved per month and display other 2 values
(fee per semester and per year) by calculating using the front end.

Thanks in Advance..!

Jawwad Alam
Reply With Quote
  #2 (permalink)  
Old 12-27-04, 10:20
Ach Ach is offline
Registered User
 
Join Date: Mar 2004
Posts: 370
Hi,
My general rule is: if the frequency of queries which use per semester and per year tuition field is high in other word your clients do this many times (many times is relative for you purpose) then save these columns in table.
Otherwise use computational data and do not save them.It is just for performance and does not anything with database design.
-Best wishes
Reply With Quote
  #3 (permalink)  
Old 12-29-04, 16:11
jawwadalam jawwadalam is offline
Registered User
 
Join Date: Dec 2004
Posts: 1
Quote:
Originally Posted by Ach
Hi,
My general rule is: if the frequency of queries which use per semester and per year tuition field is high in other word your clients do this many times (many times is relative for you purpose) then save these columns in table.
Otherwise use computational data and do not save them.It is just for performance and does not anything with database design.
-Best wishes
Hi Ach,

Thanks for your suggestion. I was also considering the same thing.. frequency of queries for the fields. I have got another idea, that is to make a view rather than calculating using front end... and making the backend design more descriptive.. What do you say about it..?

Waiting for your response
Jawwad Alam
Reply With Quote
  #4 (permalink)  
Old 12-29-04, 16:14
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
Quote:
Originally Posted by Ach
Hi,
My general rule is: if the frequency of queries which use per semester and per year tuition field is high in other word your clients do this many times (many times is relative for you purpose) then save these columns in table.
Otherwise use computational data and do not save them.It is just for performance and does not anything with database design.
-Best wishes
My general rule is: do not introduce the possibility of human error and subsequent integrity issues.

If you can derive the value from existing information, you would be ill-advised to duplicate it elsewhere. A compiled view will most likely be nominal while still providing the "descriptive" backend you apparantly desire.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #5 (permalink)  
Old 01-02-05, 02:21
Ach Ach is offline
Registered User
 
Join Date: Mar 2004
Posts: 370
views?!

Hi,
you are right.You MAY use view but note that a view does not have stored data essentialy so it could not gain performance benefits as computed fields.
but you may use it for design and security and ....
A computed data using a trigger for example is not error prone dear Teddy (LOL)
I suggest you look at something higher than ACCESS
-Best wishes
Reply With Quote
  #6 (permalink)  
Old 01-02-05, 13:04
rajiravi rajiravi is offline
Registered User
 
Join Date: Apr 2004
Location: Toronto, Canada
Posts: 249
I agree with Teddy that other alternatives should be explored before deciding to store computed fields.

There is always a cost with storing computed fields. Every transaction must fire the trigger and that incurs a small cost. The space required to store the field incurs some cost. There is always the possibility that the trigger may become invalid, be dropped, etc. Then, an uninformed developer, believing that everything is fine, will end up displaying wrong results.

With a view, you pay the cost only when the information is requested. Often, the DBMS can optimize the query so the performance hit is negligible.

Look at the performance with a view. if that is slower but acceptable, use it. Else, use the pre-computed field.

It is not a question of Access or Oracle or SQL Server. It is a question of database design principles.

And we'll thank you, Ach, not to resort to crude personal attacks. Debate the merits of the argument. Explain why you disagree with someone. Don't get personal.

Ravi.

Last edited by rajiravi; 01-02-05 at 18:03.
Reply With Quote
  #7 (permalink)  
Old 01-02-05, 14:10
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
Quote:
Originally Posted by Ach
Hi,
you are right.You MAY use view but note that a view does not have stored data essentialy so it could not gain performance benefits as computed fields.
but you may use it for design and security and ....
A computed data using a trigger for example is not error prone dear Teddy (LOL)
I suggest you look at something higher than ACCESS
-Best wishes
I'm running access as a reporting engine to MSSQL2k

If you're going to resort to personal attacks, please be sure you have a solid understanding of the environment you choose to attack. As I'm sure you already knew, adp's use MSSQL and all of it's caveats exclusively with regard to the backend.

I also find that calc'ing values tends to be quicker client-side then any stored procedure or "compiled view" if you will.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On