From: | Camm Maguire <camm(at)enhanced(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Calculated values |
Date: | 2001-01-26 17:44:31 |
Message-ID: | 54bssuw6m8.fsf@intech19.enhanced.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Greetings! What is the 'best way' or 'guiding philosophy' if there is
one for dealing with calculated values in a pg database? For example,
say you have a table with a column of floats, and you want to make a
view showing this column as a percent of the total across the column.
Should you
a) create another table with the total, and put on triggers on insert,
update, and delete to modify the right total or
b) create the view with a specific subselect to recalculate the total
at select time. This has the disadvantage that the total seems to be
recalculated for each row. Is there any sql syntax which can merge a
dynamically generated aggregate, *calculated only once*, into each
output row?
Thanks!
--
Camm Maguire camm(at)enhanced(dot)com
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas T. Thai | 2001-01-26 17:57:55 | concat for pgsql? |
Previous Message | Gregory Wood | 2001-01-26 17:23:02 | Update Trigger Inconsistency with 7.1? |