| 33 | |
| 34 | |
| 35 | |
| 36 | == CalibPmtSpec + SimPmtSpec : varchar PMTDESCRIB == |
| 37 | |
| 38 | Varchar Descriptions do not belong in '''hot''' DB tables , |
| 39 | * more efficient + useful approach : store integer codes ('''enums''' ) into DB |
| 40 | * derive description from them by adding methods to Data Object classes |
| 41 | * use of strings when enums are more appropriate is '''profligate''' |
| 42 | |
| 43 | {{{ |
| 44 | mysql> select distinct(PMTDESCRIB) from CalibPmtSpec ; |
| 45 | +------------------------+ |
| 46 | | PMTDESCRIB | |
| 47 | +------------------------+ |
| 48 | | SABAD1-ring01-column01 | |
| 49 | | SABAD1-ring02-column01 | |
| 50 | | SABAD1-ring03-column01 | |
| 51 | ... |
| 52 | | SABAD1-ring00-column14 | |
| 53 | | SABAD1-ring00-column15 | |
| 54 | | SABAD1-ring00-column16 | |
| 55 | +------------------------+ |
| 56 | 208 rows in set (0.00 sec) |
| 57 | }}} |
| 58 | |
| 59 | * inefficient storage and usage ... split into 2 or 3 fields |
| 60 | |
| 61 | == FeeCableMap : varchar CHANNELDESC, CHANHRDWDESC, SENSORDESC == |
| 62 | |
| 63 | {{{ |
| 64 | mysql> select * from FeeCableMap limit 10 ; |
| 65 | +-------+-------------+-----------+--------------------------------+---------------+--------------+----------+----------------------------+---------------+-------------+ |
| 66 | | SEQNO | ROW_COUNTER | CHANNELID | CHANNELDESC | FEEHARDWAREID | CHANHRDWDESC | SENSORID | SENSORDESC | PMTHARDWAREID | PMTHRDWDESC | |
| 67 | +-------+-------------+-----------+--------------------------------+---------------+--------------+----------+----------------------------+---------------+-------------+ |
| 68 | | 1 | 1 | 16843009 | DayaBayAD1-board01-connector01 | 67109121 | Fee-1 | 16843009 | DayaBayAD1-ring01-column01 | 16777217 | Pmt8inch-1 | |
| 69 | | 1 | 2 | 16843010 | DayaBayAD1-board01-connector02 | 67109122 | Fee-1 | 16843010 | DayaBayAD1-ring01-column02 | 16777218 | Pmt8inch-2 | |
| 70 | | 1 | 3 | 16843011 | DayaBayAD1-board01-connector03 | 67109123 | Fee-1 | 16843011 | DayaBayAD1-ring01-column03 | 16777219 | Pmt8inch-3 | |
| 71 | | 1 | 4 | 16843012 | DayaBayAD1-board01-connector04 | 67109124 | Fee-1 | 16843012 | DayaBayAD1-ring01-column04 | 16777220 | Pmt8inch-4 | |
| 72 | | 1 | 5 | 16843013 | DayaBayAD1-board01-connector05 | 67109125 | Fee-1 | 16843013 | DayaBayAD1-ring01-column05 | 16777221 | Pmt8inch-5 | |
| 73 | | 1 | 6 | 16843014 | DayaBayAD1-board01-connector06 | 67109126 | Fee-1 | 16843014 | DayaBayAD1-ring01-column06 | 16777222 | Pmt8inch-6 | |
| 74 | | 1 | 7 | 16843015 | DayaBayAD1-board01-connector07 | 67109127 | Fee-1 | 16843015 | DayaBayAD1-ring01-column07 | 16777223 | Pmt8inch-7 | |
| 75 | | 1 | 8 | 16843016 | DayaBayAD1-board01-connector08 | 67109128 | Fee-1 | 16843016 | DayaBayAD1-ring01-column08 | 16777224 | Pmt8inch-8 | |
| 76 | | 1 | 9 | 16843017 | DayaBayAD1-board01-connector09 | 67109129 | Fee-1 | 16843017 | DayaBayAD1-ring01-column09 | 16777225 | Pmt8inch-9 | |
| 77 | | 1 | 10 | 16843018 | DayaBayAD1-board01-connector10 | 67109130 | Fee-1 | 16843018 | DayaBayAD1-ring01-column10 | 16777226 | Pmt8inch-10 | |
| 78 | +-------+-------------+-----------+--------------------------------+---------------+--------------+----------+----------------------------+---------------+-------------+ |
| 79 | 10 rows in set (0.00 sec) |
| 80 | }}} |
| 81 | |
| 82 | |
| 83 | == DaqRawDataFileInfo : rethink needed == |
| 84 | |
| 85 | * transferState/fileState ... changes (does not fit with DBI philosophy) |
| 86 | * varchar : streamType, stream, fileState, checksum , transferState |
| 87 | * none need to be using varchar '''varchar''' BUT not a '''hot''' object so does not matter ? |
| 88 | |
| 89 | * although not a '''hot''' table, use of enums/int is still preferable for greater usability |
| 90 | |
| 91 | {{{ |
| 92 | |
| 93 | mysql> describe DaqRawDataFileInfo ; |
| 94 | +---------------+------------------+------+-----+---------+----------------+ |
| 95 | | Field | Type | Null | Key | Default | Extra | |
| 96 | +---------------+------------------+------+-----+---------+----------------+ |
| 97 | | SEQNO | int(11) | NO | PRI | | | |
| 98 | | ROW_COUNTER | int(11) | NO | PRI | NULL | auto_increment | |
| 99 | | runNo | int(10) unsigned | YES | | NULL | | |
| 100 | | fileNo | int(10) unsigned | YES | | NULL | | |
| 101 | | fileName | tinytext | YES | | NULL | | |
| 102 | | streamType | varchar(32) | YES | | NULL | | |
| 103 | | stream | varchar(32) | YES | | NULL | | |
| 104 | | fileState | varchar(32) | YES | | NULL | | |
| 105 | | fileSize | int(11) | YES | | NULL | | |
| 106 | | checksum | varchar(64) | YES | | NULL | | |
| 107 | | transferState | varchar(32) | YES | | NULL | | |
| 108 | +---------------+------------------+------+-----+---------+----------------+ |
| 109 | 11 rows in set (0.00 sec) |
| 110 | |
| 111 | |
| 112 | mysql> select * from DaqRawDataFileInfo limit 10 ; |
| 113 | +-------+-------------+-------+--------+-----------------------------------------------------+------------+---------+-----------+-----------+----------+---------------+ |
| 114 | | SEQNO | ROW_COUNTER | runNo | fileNo | fileName | streamType | stream | fileState | fileSize | checksum | transferState | |
| 115 | +-------+-------------+-------+--------+-----------------------------------------------------+------------+---------+-----------+-----------+----------+---------------+ |
| 116 | | 1 | 1 | 6 | 1 | daq.NoTag.0000006.Pedestal.TST-AD1.SFO-1._0001.data | Pedestal | TST-AD1 | CLOSED | 233513220 | 4C98F617 | TRANSFERRED | |
| 117 | | 2 | 1 | 7 | 1 | daq.NoTag.0000007.FEEDiag.TST-AD1.SFO-1._0001.data | FEEDiag | TST-AD1 | CLOSED | 131074920 | 3994B4E8 | TRANSFERRED | |
| 118 | | 3 | 1 | 9 | 1 | daq.NoTag.0000009.FEEDiag.SAB-AD1.SFO-1._0001.data | FEEDiag | SAB-AD1 | CLOSED | 11360220 | 6D83A03B | TRANSFERRED | |
| 119 | | 4 | 1 | 10 | 1 | daq.NoTag.0000010.Pedestal.SAB-AD1.SFO-1._0001.data | Pedestal | SAB-AD1 | CLOSED | 11200220 | 42DD5FD5 | TRANSFERRED | |
| 120 | | 5 | 1 | 11 | 1 | daq.NoTag.0000011.Physics.SAB-AD1.SFO-1._0001.data | Physics | SAB-AD1 | CLOSED | 473592276 | 70065B17 | TRANSFERRED | |
| 121 | | 6 | 1 | 12 | 1 | daq.NoTag.0000012.Physics.SAB-AD1.SFO-1._0001.data | Physics | SAB-AD1 | CLOSED | 108200292 | FEB524EC | TRANSFERRED | |
| 122 | | 7 | 1 | 13 | 1 | daq.NoTag.0000013.Physics.SAB-AD1.SFO-1._0001.data | Physics | SAB-AD1 | CLOSED | 128677660 | 539F47D1 | TRANSFERRED | |
| 123 | | 8 | 1 | 14 | 1 | daq.NoTag.0000014.Physics.SAB-AD1.SFO-1._0001.data | Physics | SAB-AD1 | CLOSED | 248492412 | 6CB379D1 | TRANSFERRED | |
| 124 | | 9 | 1 | 15 | 1 | daq.NoTag.0000015.Physics.SAB-AD1.SFO-1._0001.data | Physics | SAB-AD1 | CLOSED | 47866220 | 6B3C78EA | TRANSFERRED | |
| 125 | | 10 | 1 | 16 | 1 | daq.NoTag.0000016.Physics.SAB-AD1.SFO-1._0001.data | Physics | SAB-AD1 | CLOSED | 11077284 | 80CF0F36 | TRANSFERRED | |
| 126 | +-------+-------------+-------+--------+-----------------------------------------------------+------------+---------+-----------+-----------+----------+---------------+ |
| 127 | 10 rows in set (0.01 sec) |
| 128 | |
| 129 | }}} |
| 130 | |
| 131 | == DaqRawInfo : varchars runType, partitionName == |
| 132 | |
| 133 | * although not a '''hot''' table, I think use of enums/int is still preferable for greater usability |
| 134 | |
| 135 | {{{ |
| 136 | mysql> describe DaqRunInfo ; |
| 137 | +---------------+--------------+------+-----+---------+----------------+ |
| 138 | | Field | Type | Null | Key | Default | Extra | |
| 139 | +---------------+--------------+------+-----+---------+----------------+ |
| 140 | | SEQNO | int(11) | NO | PRI | | | |
| 141 | | ROW_COUNTER | int(11) | NO | PRI | NULL | auto_increment | |
| 142 | | runNo | int(11) | YES | | NULL | | |
| 143 | | triggerType | bigint(20) | YES | | NULL | | |
| 144 | | runType | varchar(32) | YES | | NULL | | |
| 145 | | detectorMask | int(11) | YES | | NULL | | |
| 146 | | partitionName | varchar(255) | YES | | NULL | | |
| 147 | | schemaVersion | int(11) | YES | | NULL | | |
| 148 | | dataVersion | int(11) | YES | | NULL | | |
| 149 | | baseVersion | int(11) | YES | | NULL | | |
| 150 | +---------------+--------------+------+-----+---------+----------------+ |
| 151 | 10 rows in set (0.00 sec) |
| 152 | }}} |
| 153 | |
| 154 | {{{ |
| 155 | mysql> select distinct(runType) from DaqRunInfo ; |
| 156 | +----------+ |
| 157 | | runType | |
| 158 | +----------+ |
| 159 | | Pedestal | |
| 160 | | FEEDiag | |
| 161 | | Physics | |
| 162 | | ADCalib | |
| 163 | +----------+ |
| 164 | 4 rows in set (0.01 sec) |
| 165 | }}} |
| 166 | |
| 167 | {{{ |
| 168 | mysql> select distinct(partitionName) from DaqRunInfo ; |
| 169 | +---------------+ |
| 170 | | partitionName | |
| 171 | +---------------+ |
| 172 | | part_tst-ad1 | |
| 173 | | part_sab-ad1 | |
| 174 | +---------------+ |
| 175 | 2 rows in set (0.00 sec) |
| 176 | }}} |
| 177 | |
| 178 | |