Re: Is there a way?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Bob,

I would agree that there are instances when storing a computed value
actually does make sense.

Another good example would be an inventory database. I could always
calculate the expected number of items on hand on a given date, but to do so,
across an enterprise would be time consuming. So, occassionally, we store
the expected inventory, along with the actual inventory in a table. That
way, I don't have to compute all of the purchases and sales up to that date
when I want to analyze the difference between expected and actual inventories
(over time).

--
Dale

email address is invalid
Please reply to newsgroup only.



"Bob Barrows [MVP]" wrote:

True, for birth date. For historical age, however, storing the record's
creation date would require calculating the age on the fly, which might
impair performance.
What I'm arguing for of course, is the idea that storing the result of a
calculation whose result will never change is not necessarily a bad
thing. Especially if the calculation is time-consuming.

Michel Walsh wrote:
Sorting on age would be the same as sorting on date of birth.
Filtering is another matter, but you can filter on a computed
expression NOT involving the field:

Instead of

WHERE DateAdd("yyyy", 18, dateOfBirth) <= Now( )

can be

WHERE dateOfBirth <= DateAdd("yyyy", -18, Now( ) )

which and make the computation just once, and will be able to use
index, if any, on dateOfBirth.


Vanderghast, Access MVP


"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:ORJeEmlHJHA.4600@xxxxxxxxxxxxxxxxxxxxxxx
Tom Lake wrote:
"deepak" <deepak@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3CB45E3C-8D62-4CC3-A411-A06FB592FBE8@xxxxxxxxxxxxxxxx
Hi!
Sppose I make two tables tblName and tblAge. tblName has two
fields name and address. And tblAge has two fields age and
telephone no.

I wouldn't store Age in a table. You'd have to update it every
year! You should probably store a date and calculate Age as you
need it.

... unless
a) you need to know the Age at the time the record was created, or
b) you need to filter/sort data by age. Having the age stored vs
having to calculate it can potentially make a large difference to
performance

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



.



Relevant Pages

  • Re: Please suggest relationships model
    ... FREE newsgroup then I, along with folks much more qualified, assist him. ... an inventory database and go to the newsgroups, ...
    (microsoft.public.access.queries)
  • Re: Please suggest relationships model
    ... newsgroup was not the place to find it. ... Database design is FUN and it is EASY, but if anyone does not have the time ... If you saw a post by a business owner where it is obvious he has only ... an inventory database and go to the newsgroups, ...
    (microsoft.public.access.queries)
  • Re: Survivor in trouble at work
    ... Thanks for the stats - I can guarantee you that there is no offence ... My father had a traumatic moment when he passed his father's age. ... So a question for the newsgroup - has any Survivor contestant yet ... I'm surprised not to have heard such news of ...
    (alt.tv.survivor)
  • Re: Good topic of conversation
    ... not trying to take over the newsgroup but we do feel free to express ... in defence of his character. ... Many men in his age category are super sensitive to what they see ... approaching harmony they must not directly confront them but find ...
    (soc.senior.issues)
  • Re: Age distribution of todays Bridge players?
    ... What is the age distribution of today's Bridge players? ... Please reply in this newsgroup. ... I can say that my partner and I went to the bridge club earlier this ...
    (rec.games.bridge)