Re: Math Operations - DB or App?

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: <operationsengineer1(at)yahoo(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Math Operations - DB or App?
Date: 2006-05-09 21:32:46
Message-ID: C08682BE.B30F%sdavis2@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 5/9/06 3:44 PM, "operationsengineer1(at)yahoo(dot)com"
<operationsengineer1(at)yahoo(dot)com> wrote:

> i'm in the process of developing some reports for an
> application i'm developing.
>
> i'm curious how the more experienced developers do
> their math operations. do you do it in your select or
> do you do it in your app?
>
> i can't give an example within a select (that's what
> i'm researching next).
>
> an example of doing the math in the app (php) would be
> getting a value $p for number of passed units and a
> value $t for total units and then setting yield to $y
> = $t/$p.
>
> what do you do and why? what are the pluses and
> minuses of each approach?

The biggest plus is that most of the data never leaves the server, so
client-side overhead, memory issues with the client, and network bandwidth
are much less of a problem than it you transfer the who table to the client,
for example, to do a couple of simple sums. There are other advantages,
like being able to adjust the schema or the functions on the database side
and have these changes propagate automatically through to various apps.

Sean

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Andrej Ricnik-Bay 2006-05-09 21:37:52 Re: Math Operations - DB or App?
Previous Message George Weaver 2006-05-09 21:23:38 Re: Math Query Help