Re: how do you write aggregate function

From: "Webb Sprague" <webb(dot)sprague(at)gmail(dot)com>
To: Justin <justin(at)emproshunts(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: how do you write aggregate function
Date: 2008-03-10 18:12:26
Message-ID: b11ea23c0803101112q655783abh19cbc1e9994fb963@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 10, 2008 at 11:00 AM, Justin <justin(at)emproshunts(dot)com> wrote:
>
> That comment was not meant to be an insult or disparaging in any way what
> so ever. If it was taken as such then i'm sorry.

I am sure it would have been fine in person, I just think over email
it sounded abrasive.

But could you stop topquoting please?

> It seems the biggest performance hit is copying of the array content from
> one memory variable to another which is happening allot.

Yeah, I think arrays just can't handle a whole lot of data, that is
all. They are "tricky", and shouldn't be used for heavy lifting (more
than 1k of elements feels like you are asking for trouble).

> I'm not really against using a temp tables to hold onto values. I used to
> do that in Foxpro when i hit the hard limit on its array but other problems
> start popping up. If we use a temp table keeping track what going with
> other users can make life fun.

I think temp tables have scope, though you should test this, so that
you can use them with impunity in functions and not worry with
multiple users.

> I really want to figure this out how to speed it up. I have to write allot
> more aggregate functions to analyze R&D data which will happen latter this
> year. right now this function will be used in calculating manufacturing
> cost.

I think a combination of aggregate functions along with some more
design would be best. For example: can you have a trigger calculate
the normalized weight of a row on insert? Have triggers keep another
table with summary information updated as you modify the data? Etc.
There is a lot to PG that would help for this kind of thing.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Harald Fuchs 2008-03-10 19:03:03 Re: ISO something like "#if 0 ... #endif" for SQL code
Previous Message Justin 2008-03-10 18:03:54 Re: how do you write aggregate function