# Usally, the steps between each entries is 300 seconds. How can I
# group by by 15, 30, 45 minutes so that i can get averages over the
# specified timeframe?
For 15-minute data, I'd compute the "quadrant" of each record and
group by the quadrant number. Anything that occurs from :00 to :14 is
in quadrant zero, :15 - :29 is quadrant 1, etc., yielding quadrants
0-3.
mydb> SELECT (time / (15 * 60)) AS quadrant, SUM(ifinoctets) FROM
mytable GROUP BY quadrant ORDER BY quadrant;
Divide the time by 60 to get minutes and 15 to get quadrants. You can
see how to extend this for other intervals.
-- Jonathan Daugherty Command Prompt, Inc. - http://www.commandprompt.com/ PostgreSQL Replication & Support Services,
(503)667-4564