# Looking for a technical term

**URL:** <https://www.ruby-forum.com/t/looking-for-a-technical-term/187833>\
**Category:** Rails\
**Created:** [April 30, 2010, 2:17am UTC](https://www.ruby-forum.com/t/looking-for-a-technical-term/187833 "2010-04-30T02:17:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![msmsms](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/34f0e0/32.png) [@msmsms](https://www.ruby-forum.com/u/msmsms)\
**Post date:** [April 30, 2010, 2:17am UTC](https://www.ruby-forum.com/t/looking-for-a-technical-term/187833/1 "2010-04-30T02:17:39Z")

</div>

Hi,

thank you for reading my post. I’ve got s simple question: What’s the  
correct technical term for data which IS NOT calculated and data which  
IS calculated regarding database design.

Simple example: saving a user message in a corresponding table vs.  
counting all messages of a user.

If you also know the german expressions, you’re welcome to post them,  
too. 🙂

Thanks for your help,  
ms

---

<div class="post-metadata">

**Author:** ![msmsms](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/34f0e0/32.png) [@msmsms](https://www.ruby-forum.com/u/msmsms)\
**Post date:** [April 30, 2010, 11:37am UTC](https://www.ruby-forum.com/t/looking-for-a-technical-term/187833/2 "2010-04-30T11:37:12Z")

</div>

I’m not sure if this answers your question in regards to your specific  
example, but let’s say you have a simple table with just two numerical  
columns, say two integers.

SELECT i1, i2, i1+i2 AS “Sum” FROM MyTable  
will show three columns, two of them real columns from the table and one  
computed.

So the term in this case is a COMPUTED column.

Best regards,  
Rolf

---

<div class="post-metadata">

**Author:** ![msmsms](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/34f0e0/32.png) [@msmsms](https://www.ruby-forum.com/u/msmsms)\
**Post date:** [April 30, 2010, 1:48pm UTC](https://www.ruby-forum.com/t/looking-for-a-technical-term/187833/3 "2010-04-30T13:48:53Z")

</div>

Rolf P. wrote:

> I’m not sure if this answers your question in regards to your specific  
> example, but let’s say you have a simple table with just two numerical  
> columns, say two integers.
> 
> SELECT i1, i2, i1+i2 AS “Sum” FROM MyTable  
> will show three columns, two of them real columns from the table and one  
> computed.
> 
> So the term in this case is a COMPUTED column.

The term “derived column” is technically (slightly) more accurate.

ms wrote:

> Simple example: saving a user message in a corresponding table vs.  
> counting all messages of a user.

1. Saving user messages in a corresponding table.

This would be called a “one-to-many relationship,” or “association” for  
short.

Example:  
user = User.first  
user.messages

1. Counting all messages of a user.

These types of calculations are called called “aggregate functions.”

Example:  
user = User.first  
user.messages.count

2a. Caching aggregate functions.

It’s also possible to store the results of aggregate functions in a  
column on the parent model. Rails has built-in support for this pattern,  
which is called a “counter cache.”

AFAIK Rails support the counter cache only. I’ve occasionally wished it  
had direct support for caching “sum” and “average” (avg) aggregate  
functions as well, but it can still be doe manually in a similar pattern  
as counter cache.
