rrs-commit: r15 - trunk

decibel at decibel.org decibel at decibel.org
Fri Jan 21 21:44:48 GMT 2005


Author: decibel
Date: Fri Jan 21 21:44:47 2005
New Revision: 15

Modified:
   trunk/TODO
   trunk/rrs_functions.sql
Log:
update_buckets was to aggresive with deletes

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Fri Jan 21 21:44:47 2005
@@ -1,3 +1,7 @@
 $Id$
 
+An initial run can take a huge amount of time if there's existing data to
+process. It would be good if there was a way to speed this up. It also results
+in a lot of dead tuples.
+
 Add field comments as part of our documentation.

Modified: trunk/rrs_functions.sql
==============================================================================
--- trunk/rrs_functions.sql	(original)
+++ trunk/rrs_functions.sql	Fri Jan 21 21:44:47 2005
@@ -172,10 +172,11 @@
     -- we do an outer join.
     -- We also need to take our parent RRDs into account.
     SELECT INTO v_min_end_time
-            min(last_end_time)
-        FROM rrs.source_status ss
-            JOIN rrs.rrs r ON (ss.rrs_id = r.rrs_id)
-            RIGHT JOIN rrs.source s ON (ss.source_id = s.source_id)
+            -- coalesce before min otherwise NULLs are ignored
+            min(coalesce(last_end_time, ''1970-01-01 00:00:00-00''))
+        FROM source s
+            JOIN rrs r ON (1=1)
+            LEFT JOIN source_status ss ON (ss.source_id = s.source_id AND ss.rrs_id = r.rrs_id)
         WHERE r.rrs_id = p_rrs_id
             OR r.parent = p_rrs_id
     ;
@@ -237,6 +238,7 @@
     v_buckets_added int := 0;
 BEGIN
     --debug.f(''update_buckets enter'');
+
     -- Run through each RRD
     FOR v_rrs IN SELECT * FROM rrs.rrs ORDER BY coalesce( parent, -1 ), rrs_id
     LOOP
@@ -364,7 +366,6 @@
 END;
 '
     LANGUAGE plpgsql;
-
 
 --
 -- TOC entry 19 (OID 591228977)


More information about the rrs-commit mailing list