rrs-commit: r64 - release/rrs-0.4.1

decibel at decibel.org decibel at decibel.org
Tue Apr 19 21:20:15 GMT 2005


Author: decibel
Date: Tue Apr 19 21:20:14 2005
New Revision: 64

Added:
   release/rrs-0.4.1/rrs_views.sql   (contents, props changed)
Log:
Add rrs_views

Added: release/rrs-0.4.1/rrs_views.sql
==============================================================================
--- (empty file)
+++ release/rrs-0.4.1/rrs_views.sql	Tue Apr 19 21:20:14 2005
@@ -0,0 +1,30 @@
+-- Copyright (c) 2004, Jim C. Nasby (decibel at rrs.decibel.org)
+-- All rights reserved.
+--
+-- $Id$
+
+SET client_encoding = 'SQL_ASCII';
+
+SET search_path = rrs, pg_catalog;
+
+CREATE OR REPLACE VIEW rrs.history_data_interval_run_time_v AS
+    SELECT h.*
+            , CASE WHEN run_time_sec > 0
+                THEN rrs.seconds_to_interval(
+                        rrs.interval_to_seconds(data_interval)
+                        * desired_run_time_sec
+                        / run_time_sec
+                    )
+                END AS next_data_interval
+        FROM
+            ( SELECT rrs.interval_to_seconds(
+                                rrs.setting_get('desired run time')::interval
+                        ) AS desired_run_time_sec
+            ) AS s
+            , ( SELECT start_time, end_time, data_interval
+                        , end_time - start_time AS run_time
+                        , rrs.interval_to_seconds( end_time - start_time ) AS run_time_sec
+                    FROM history_data_interval ) h
+;
+
+-- vi: expandtab sw=4 ts=4


More information about the rrs-commit mailing list