summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 54a5ed5)
raw | patch | inline | side by side (parent: 54a5ed5)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 25 Oct 2012 10:37:02 +0000 (12:37 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 14 Nov 2012 18:45:13 +0000 (19:45 +0100) |
This view provides a join of the 'identifiers' and 'values' tables plus an
additional column with the serialized collectd identifier.
additional column with the serialized collectd identifier.
contrib/postgresql/collectd_insert.sql | patch | blob | history |
index e20b0bf1e64b1ab3f3024c936f0e3db8dc9484fb..7ccd909a7a2feffcee87f7aee580b5ae17fb6340 100644 (file)
value double precision NOT NULL
);
+CREATE OR REPLACE VIEW collectd
+ AS SELECT host, plugin, plugin_inst, type, type_inst,
+ host
+ || '/' || plugin
+ || CASE
+ WHEN plugin_inst IS NOT NULL THEN '-'
+ ELSE ''
+ END
+ || coalesce(plugin_inst, '')
+ || '/' || type
+ || CASE
+ WHEN type_inst IS NOT NULL THEN '-'
+ ELSE ''
+ END
+ || coalesce(plugin_inst, '') AS identifier,
+ tstamp, name, value
+ FROM identifiers
+ JOIN values
+ ON values.id = identifiers.id;
+
-- partition "values" by day (or week, month, ...)
-- create the child tables for today and the next 'days' days: