Changeset 356779758e509ee0f1a2f419e9fab1d48fdc3c33

Show
Ignore:
Timestamp:
07/12/08 15:13:51 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1215875631 +0000
git-parent:

[5b508a1274eabf41cc517df3d0fa2c0070868ad6]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1215875631 +0000
Message:

implement a materialized view on the most recent metric_text change (need speed!)

Files:

Legend:

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

    r47b88b0 r3567797  
    6565    value text, 
    6666    PRIMARY KEY(whence,sid,name) 
     67); 
     68 
     69CREATE TABLE stratcon.current_metric_text 
     70( 
     71  sid integer NOT NULL, 
     72  whence timestamp with time zone NOT NULL, 
     73  name text NOT NULL, 
     74  value text, 
     75  PRIMARY KEY (sid, name) 
    6776); 
    6877 
     
    186195 GRANT SELECT,INSERT,DELETE ON stratcon.loading_dock_metric_numeric_s TO stratcon; 
    187196 GRANT SELECT,INSERT,DELETE ON stratcon.loading_dock_metric_text_s_change_log TO stratcon; 
     197 GRANT SELECT,INSERT,DELETE ON stratcon.current_metric_text TO stratcon; 
    188198 GRANT SELECT,INSERT,DELETE ON stratcon.log_whence_s TO stratcon; 
    189199 GRANT SELECT,INSERT,DELETE ON stratcon.loading_dock_metric_text_s TO stratcon; 
     
    370380                        INSERT INTO stratcon.loading_dock_metric_text_s_change_log (sid,whence,name,value) 
    371381                            VALUES (NEW.sid, NEW.whence, NEW.name, NEW.value);  
     382                        DELETE FROM stratcon.current_metric_text 
     383                                WHERE sid = NEW.sid and name = NEW.name; 
     384                        INSERT INTO stratcon.current_metric_text (sid,whence,name,value) 
     385                                VALUES (NEW.sid, NEW.whence, NEW.name, NEW.value); 
    372386                    END IF; 
    373387