Changeset ee0d0b765f3a51e1790b26901b54a3c6ac408722
 Timestamp:
 03/28/08 19:38:56
(10 years ago)
 Author:
 Denish Patel <denish@omniti.com>
 gitcommitter:
 Denish Patel <denish@omniti.com> 1206733136 +0000
 gitparent:
[5eaa1785247692fe06e4dffe28ec8abdf751865a]
 gitauthor:
 Denish Patel <denish@omniti.com> 1206733136 +0000
 Message:
Final 5 minutes and 1 hour rollup functions

Files:

Legend:
 Unmodified
 Added
 Removed
 Modified
 Copied
 Moved
r5eaa178 
ree0d0b7 

210  210  v_max_rollup_5 TIMESTAMPTZ; 

211  211  v_whence TIMESTAMPTZ; 

 212  rows INT; 

212  213  

213  214  BEGIN 

…  …  
219  220  INTO v_max_rollup_5; 

220  221  

221   IF v_min_whence < v_max_rollup_5 THEN 

 222   Insert Log for Hourly rollup 

 223  

 224  SELECT whence FROM stratcon.log_whence_s WHERE whence=date_trunc('H',v_min_whence) and interval='1 hour' 

 225  INTO v_whence; 

 226  IF NOT FOUND THEN 

 227  INSERT INTO stratcon.log_whence_s VALUES(date_trunc('H',v_min_whence),'1 hour'); 

 228  END IF; 

 229  

 230  IF v_min_whence <= v_max_rollup_5 THEN 

222  231  

223  232  DELETE FROM stratcon.rollup_matrix_numeric_5m 

224  233  WHERE rollup_time = v_min_whence; 

225   

226   ELSIF v_min_whence = v_max_rollup_5 THEN 

227   

228   DELETE FROM stratcon.log_whence_s 

229   WHERE WHENCE=v_min_whence AND INTERVAL='5 minutes'; 

230   

231   RETURN; 

232   

 234  

233  235  END IF; 

234  236  

…  …  
242  244  LOOP 

243  245  

 246  

244  247  INSERT INTO stratcon.rollup_matrix_numeric_5m 

245  248  (sid,name,rollup_time,count_rows,avg_value,stddev_value,min_value,max_value) VALUES 

…  …  
248  251  END LOOP; 

249  252  

250    Insert Log for Hourly rollup 

251   

252   SELECT whence FROM stratcon.log_whence_s WHERE whence=date_trunc('H',v_min_whence) and interval='1 hour' 

253   INTO v_whence; 

254   IF NOT FOUND THEN 

255   INSERT INTO stratcon.log_whence_s VALUES(date_trunc('H',v_min_whence),'1 hour'); 

256   END IF; 

257   

258   

259  253   Delete from whence log table 

260  254  

…  …  
270  264  END 

271  265  $$ LANGUAGE plpgsql; 

272   

273  266   1 hourl rollup 

274  267  
