From: Andreas Gaab <A.Gaab@scanlab.de>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Running mean filtering using Window Functions?
Date: Thu, 26 Apr 2012 11:22:44 +0200
Message-ID: <48DA836F3865C54B8FBF424A3B775AF6674B452B86@Exchange-Server> (raw)
Hi,
can I realize a running mean filter using window functions?
What I can think of is:
SELECT avg(random) OVER (PARTITION BY floor(time_s / 60) ORDER BY floor(time_s / 60))
FROM (
SELECT generate_series(0,600,20) time_s, random()
) as data;
which averages all measurements in one minute, but not every line with its following two lines.
Any suggestions?
Best regards
Andreas
___________________________________________________________________________
SCANLAB AG
Dr. Andreas Simon Gaab
Entwicklung * R & D
Siemensstr. 2a * 82178 Puchheim * Germany
Tel. +49 (89) 800 746-513 * Fax +49 (89) 800 746-199
mailto:a.gaab@scanlab.de * www.scanlab.de<http://www.scanlab.de;
Amtsgericht München: HRB 124707 * USt-IdNr.: DE 129 456 351
Vorstand: Georg Hofner (Sprecher), Christian Huttenloher, Norbert Petschik
Aufsichtsrat (Vorsitz): Dr. Hans J. Langer
___________________________________________________________________________
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: A.Gaab@scanlab.de
Subject: Re: Running mean filtering using Window Functions?
In-Reply-To: <48DA836F3865C54B8FBF424A3B775AF6674B452B86@Exchange-Server>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox