Changeset 143a7f5401614fa0dcc032e7a584d559ac74def5

Show
Ignore:
Timestamp:
05/13/08 21:53:09 (10 years ago)
Author:
Denish Patel <denish@omniti.com>
git-committer:
Denish Patel <denish@omniti.com> 1210715589 +0000
git-parent:

[e435c5bf61eb1f943d440e635521d9ce21e78a2d]

git-author:
Denish Patel <denish@omniti.com> 1210715589 +0000
Message:

updated 6 hours and 12 hours roll up functions and modify column name for metric_name_summary table.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/schema.sql

    rc1fcb76 r143a7f5  
    135135CREATE TABLE stratcon.metric_name_summary ( 
    136136  sid integer NOT NULL, 
    137   name text NOT NULL, 
    138   type character varying(22), 
     137  metric_name text NOT NULL, 
     138  metric_type character varying(22), 
    139139  active boolean default 'true', 
    140140  PRIMARY KEY (sid,name) 
     
    266266    END IF; 
    267267     
    268     SELECT sid,name FROM stratcon.metric_name_summary WHERE sid=NEW.sid  and name=NEW.name 
     268    SELECT sid,metric_name FROM stratcon.metric_name_summary WHERE sid=NEW.sid  and metric_name=NEW.metric_name 
    269269         INTO v_sid,v_name; 
    270270       IF NOT FOUND THEN 
    271            INSERT INTO  stratcon.metric_name_summary VALUES(NEW.sid,NEW.name,'text'); 
     271           INSERT INTO  stratcon.metric_name_summary(sid,metric_name,metric_type)  VALUES(NEW.sid,NEW.metric_name,'text'); 
    272272    END IF; 
    273273 
     
    299299    END IF; 
    300300 
    301    SELECT sid,name FROM stratcon.metric_name_summary WHERE sid=NEW.sid  and name=NEW.name 
     301   SELECT sid,metric_name FROM stratcon.metric_name_summary WHERE sid=NEW.sid  and metric_name=NEW.metric_name 
    302302     INTO v_sid,v_name; 
    303303   IF NOT FOUND THEN 
    304        INSERT INTO  stratcon.metric_name_summary VALUES(NEW.sid,NEW.name,'numeric'); 
     304       INSERT INTO  stratcon.metric_name_summary VALUES(NEW.sid,NEW.metric_name,'numeric'); 
    305305    END IF; 
    306306 
     
    553553-- Insert Log for 6 Hour rollup 
    554554    
    555    SELECT whence FROM stratcon.log_whence_s WHERE whence=date_trunc('H',v_min_whence) and interval='6 hours' 
     555   SELECT whence FROM stratcon.log_whence_s WHERE whence=date_trunc('day', v_min_whence) + (floor(extract('hour' from v_min_whence)/6)*6) * '1 hour'::interval and interval='6 hours' 
    556556           INTO v_whence; 
    557557      IF NOT FOUND THEN 
    558        INSERT INTO  stratcon.log_whence_s VALUES(date_trunc('H',v_min_whence),'6 hours'); 
     558       INSERT INTO  stratcon.log_whence_s VALUES(date_trunc('day', v_min_whence) + (floor(extract('hour' from v_min_whence)/6)*6) * '1 hour'::interval,'6 hours'); 
    559559   END IF; 
    560560    
     
    646646-- Insert Log for 12 Hours rollup 
    647647    
    648    SELECT whence FROM stratcon.log_whence_s WHERE whence=date_trunc('H',v_min_whence) and interval='12 hours' 
     648   SELECT whence FROM stratcon.log_whence_s WHERE whence=date_trunc('day', v_min_whence) + (floor(extract('hour' from v_min_whence)/12)*12) * '1 hour'::interval and interval='12 hours' 
    649649           INTO v_whence; 
    650650      IF NOT FOUND THEN 
    651        INSERT INTO  stratcon.log_whence_s VALUES(date_trunc('H',v_min_whence),'12 hours'); 
     651       INSERT INTO  stratcon.log_whence_s VALUES(date_trunc('day', v_min_whence) + (floor(extract('hour' from v_min_whence)/12)*12) * '1 hour'::interval,'12 hours'); 
    652652   END IF; 
    653653    
     
    741741/*-- Insert Log for 24 Hours rollup 
    742742    
    743    SELECT whence FROM stratcon.log_whence_s WHERE whence=date_trunc('H',v_min_whence) and interval='24 hours' 
     743   SELECT whence FROM stratcon.log_whence_s WHERE whence=date_trunc('day', v_min_whence) + (floor(extract('hour' from v_min_whence)/24)*24) * '1 hour'::interval and interval='24 hours' 
    744744           INTO v_whence; 
    745745      IF NOT FOUND THEN 
    746        INSERT INTO  stratcon.log_whence_s VALUES(date_trunc('H',v_min_whence),'24 hours'); 
     746       INSERT INTO  stratcon.log_whence_s VALUES(date_trunc('day', v_min_whence) + (floor(extract('hour' from v_min_whence)/24)*24) * '1 hour'::interval,'24 hours'); 
    747747   END IF; 
    748748   */