Hi,
does anyone hava an idea how to group data e.g by 15 minute steps?
I have the following data in my "data_diff" table
[...]
snmp=# \d data_diff Table "public.data_diff" Column | Type |
Modifiers
-----------------+---------+-----------------------------------------------------------id | integer | not
nulldefault
nextval('public.data_diff_id_seq'::text)device | integer |psqlzeit | integer |snmpzeit | integer
|ifinoctets | bigint |ifoutoctets | bigint |
Indexes: "data_diff_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints: "data_diff_device_fkey" FOREIGN KEY (device) REFERENCES device(id)
ON UPDATE CASCADE ON DELETE CASCADE
[...]
An example query looks like this:
snmp=# select snmpzeit as snmp,ifinoctets,ifoutoctets from data_diff
where device=5 order by psqlzeit desc;
snmp | ifinoctets | ifoutoctets
------------+------------+-------------1111268704 | 111382 | 2805661111268405 | 78874 |
225921111268104| 88645 | 328031111267804 | 76273 | 19024
...
1111255204 | 149963 | 628891111254904 | 164788 | 815941111254604 | 147720 |
620931111254305| 161958 | 788131111254005 | 155495 | 68143
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?
Greetings,
Martin