Aggregate functions on ordered data?

From: Andreas Lehrbaum <andreas(dot)lehrbaum(at)kabelweb(dot)at>
To: pgsql-general(at)postgresql(dot)org
Subject: Aggregate functions on ordered data?
Date: 2003-06-22 19:53:55
Message-ID: 200306222153.55653.andreas.lehrbaum@kabelweb.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is it possible in _any_ way to control the order of the rows passed to an
aggregate function?

My problem is the following: I have tables with timestamps (PK) and bigint
values (gathered from snmp Counter32 entries) and I want to write an
aggregate function which sums over the differences between two entries which
follow one another in time and also accounts for range-wraps of the 32bit
values.

I have come up with a plpgsql version which does exactly that but as far as I
understand I can not be sure that the rows reach the aggregate sfunc in the
order of the timestamps. Is this order indetermined or is it always the order
of the rows in the table?

Anyway my problem remains: how to make sure the aggregate sfunc gets called in
the order I want?

Any help would be greatly appreciated!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message MT 2003-06-22 20:17:13 Re: Running pg_dump under vcron
Previous Message Matthew T. O'Connor 2003-06-22 19:13:08 Re: How to process mail using pgSQL?