dbinit.py (1772:a3a83e812a5e) | dbinit.py (2343:a2b4a6ccee56) |
---|---|
1# Copyright (c) 2003-2004 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 84 unchanged lines hidden (view full) --- 93 rn_project VARCHAR(100) NOT NULL, 94 rn_date TIMESTAMP NOT NULL, 95 rn_expire TIMESTAMP NOT NULL, 96 PRIMARY KEY (rn_id), 97 UNIQUE (rn_name,rn_sample) 98 ) TYPE=InnoDB''') 99 100 # | 1# Copyright (c) 2003-2004 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 84 unchanged lines hidden (view full) --- 93 rn_project VARCHAR(100) NOT NULL, 94 rn_date TIMESTAMP NOT NULL, 95 rn_expire TIMESTAMP NOT NULL, 96 PRIMARY KEY (rn_id), 97 UNIQUE (rn_name,rn_sample) 98 ) TYPE=InnoDB''') 99 100 # |
101 # We keep the bin names separate so that the data table doesn't get 102 # huge since bin names are frequently repeated. 103 # 104 # COLUMNS: 105 # 'id' is the unique bin identifer. 106 # 'name' is the string name for the bin. 107 # 108 # INDEXES: 109 # 'bin' is indexed to get the name of a bin when data is retrieved 110 # via the data table. 111 # 'name' is indexed to get the bin id for a named bin when you want 112 # to search the data table based on a specific bin. 113 # 114 self.query(''' 115 CREATE TABLE bins( 116 bn_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, 117 bn_name VARCHAR(255) NOT NULL, 118 PRIMARY KEY(bn_id), 119 UNIQUE (bn_name) 120 ) TYPE=InnoDB''') 121 122 # | |
123 # The stat table gives us all of the data for a particular stat. 124 # 125 # COLUMNS: 126 # 'stat' is a unique identifier for each stat to be used in other 127 # tables for references. 128 # 'name' is simply the simulator derived name for a given 129 # statistic. 130 # 'descr' is the description of the statistic and what it tells --- 84 unchanged lines hidden (view full) --- 215 # -5: maximum value 216 # -6: underflow 217 # -7: overflow 218 # 'y' is used by a VECTORDIST and the VECTOR2D to describe the second 219 # dimension. 220 # 'run' is the run that the data was generated from. Details up in 221 # the run table 222 # 'tick' is a timestamp generated by the simulator. | 101 # The stat table gives us all of the data for a particular stat. 102 # 103 # COLUMNS: 104 # 'stat' is a unique identifier for each stat to be used in other 105 # tables for references. 106 # 'name' is simply the simulator derived name for a given 107 # statistic. 108 # 'descr' is the description of the statistic and what it tells --- 84 unchanged lines hidden (view full) --- 193 # -5: maximum value 194 # -6: underflow 195 # -7: overflow 196 # 'y' is used by a VECTORDIST and the VECTOR2D to describe the second 197 # dimension. 198 # 'run' is the run that the data was generated from. Details up in 199 # the run table 200 # 'tick' is a timestamp generated by the simulator. |
223 # 'bin' is the name of the bin that the data was generated in, if 224 # any. | |
225 # 'data' is the actual stat value. 226 # 227 # INDEXES: 228 # 'stat' is indexed so that a user can find all of the data for a 229 # particular stat. It is not unique, because that specific stat | 201 # 'data' is the actual stat value. 202 # 203 # INDEXES: 204 # 'stat' is indexed so that a user can find all of the data for a 205 # particular stat. It is not unique, because that specific stat |
230 # can be found in many runs, bins, and samples, in addition to | 206 # can be found in many runs and samples, in addition to |
231 # having entries for the mulidimensional cases. 232 # 'run' is indexed to allow a user to remove all of the data for a 233 # particular execution run. It can also be used to allow the 234 # user to print out all of the data for a given run. 235 # 236 self.query(''' 237 CREATE TABLE data( 238 dt_stat SMALLINT UNSIGNED NOT NULL, 239 dt_x SMALLINT NOT NULL, 240 dt_y SMALLINT NOT NULL, 241 dt_run SMALLINT UNSIGNED NOT NULL, 242 dt_tick BIGINT UNSIGNED NOT NULL, | 207 # having entries for the mulidimensional cases. 208 # 'run' is indexed to allow a user to remove all of the data for a 209 # particular execution run. It can also be used to allow the 210 # user to print out all of the data for a given run. 211 # 212 self.query(''' 213 CREATE TABLE data( 214 dt_stat SMALLINT UNSIGNED NOT NULL, 215 dt_x SMALLINT NOT NULL, 216 dt_y SMALLINT NOT NULL, 217 dt_run SMALLINT UNSIGNED NOT NULL, 218 dt_tick BIGINT UNSIGNED NOT NULL, |
243 dt_bin SMALLINT UNSIGNED NOT NULL, | |
244 dt_data DOUBLE NOT NULL, 245 INDEX (dt_stat), 246 INDEX (dt_run), | 219 dt_data DOUBLE NOT NULL, 220 INDEX (dt_stat), 221 INDEX (dt_run), |
247 UNIQUE (dt_stat,dt_x,dt_y,dt_run,dt_tick,dt_bin) | 222 UNIQUE (dt_stat,dt_x,dt_y,dt_run,dt_tick) |
248 ) TYPE=InnoDB;''') 249 250 # 251 # Names and descriptions for multi-dimensional stats (vectors, etc.) 252 # are stored here instead of having their own entry in the statistics 253 # table. This allows all parts of a single stat to easily share a 254 # single id. 255 # --- 135 unchanged lines hidden (view full) --- 391 392 self.query(''' 393 DELETE subdata 394 FROM subdata 395 LEFT JOIN data ON sd_stat=dt_stat 396 WHERE dt_stat IS NULL''') 397 398 self.query(''' | 223 ) TYPE=InnoDB;''') 224 225 # 226 # Names and descriptions for multi-dimensional stats (vectors, etc.) 227 # are stored here instead of having their own entry in the statistics 228 # table. This allows all parts of a single stat to easily share a 229 # single id. 230 # --- 135 unchanged lines hidden (view full) --- 366 367 self.query(''' 368 DELETE subdata 369 FROM subdata 370 LEFT JOIN data ON sd_stat=dt_stat 371 WHERE dt_stat IS NULL''') 372 373 self.query(''' |
399 DELETE bins 400 FROM bins 401 LEFT JOIN data ON bn_id=dt_bin 402 WHERE dt_bin IS NULL''') 403 404 self.query(''' | |
405 DELETE events 406 FROM events 407 LEFT JOIN runs ON ev_run=rn_id 408 WHERE rn_id IS NULL''') 409 410 self.query(''' 411 DELETE event_names 412 FROM event_names 413 LEFT JOIN events ON en_id=ev_event 414 WHERE ev_event IS NULL''') | 374 DELETE events 375 FROM events 376 LEFT JOIN runs ON ev_run=rn_id 377 WHERE rn_id IS NULL''') 378 379 self.query(''' 380 DELETE event_names 381 FROM event_names 382 LEFT JOIN events ON en_id=ev_event 383 WHERE ev_event IS NULL''') |