Mysql 去掉dateTime列,但在可视化/处理数据时,我必须处理每条记录,将UTC更改为本地时区,这需要时间,因此我认为我会保留它。时间戳值不能每年重复一小时,如日期时间。需要时,可以将时间戳转换为本地时间(以说明DST)。我主张去掉任何声明为DATETIME的
Mysql 去掉dateTime列,但在可视化/处理数据时,我必须处理每条记录,将UTC更改为本地时区,这需要时间,因此我认为我会保留它。时间戳值不能每年重复一小时,如日期时间。需要时,可以将时间戳转换为本地时间(以说明DST)。我主张去掉任何声明为DATETIME的,mysql,multithreading,indexing,Mysql,Multithreading,Indexing,去掉dateTime列,但在可视化/处理数据时,我必须处理每条记录,将UTC更改为本地时区,这需要时间,因此我认为我会保留它。时间戳值不能每年重复一小时,如日期时间。需要时,可以将时间戳转换为本地时间(以说明DST)。我主张去掉任何声明为DATETIME的列。 CREATE TABLE `sensordata` ( `userID` varchar(45) DEFAULT NULL, `instrumentID` varchar(10) DEFAULT NULL, `utcDateT
去掉dateTime列,但在可视化/处理数据时,我必须处理每条记录,将UTC更改为本地时区,这需要时间,因此我认为我会保留它。
时间戳
值不能每年重复一小时,如日期时间
。需要时,可以将时间戳
转换为本地时间(以说明DST)。我主张去掉任何声明为DATETIME
的列。
CREATE TABLE `sensordata` (
`userID` varchar(45) DEFAULT NULL,
`instrumentID` varchar(10) DEFAULT NULL,
`utcDateTime` datetime DEFAULT NULL,
`dateTime` datetime DEFAULT NULL,
`data` varchar(200) DEFAULT NULL,
`dataState` varchar(45) NOT NULL DEFAULT 'Original',
`gps` varchar(45) DEFAULT NULL,
`location` varchar(45) DEFAULT NULL,
`speed` varchar(20) NOT NULL DEFAULT '0',
`unitID` varchar(5) NOT NULL DEFAULT '1',
`parameterID` varchar(5) NOT NULL DEFAULT '1',
`originalData` varchar(200) DEFAULT NULL,
`comments` varchar(45) DEFAULT NULL,
`channelHashcode` varchar(12) DEFAULT NULL,
`settingHashcode` varchar(12) DEFAULT NULL,
`status` varchar(7) DEFAULT 'Offline',
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=98772 DEFAULT CHARSET=utf8
Select dateTime from sensordata WHERE userID = 'someUserID' AND instrumentID = 'someInstrumentID' AND dateTime between 'startDate' AND 'endDate' order by dateTime asc;
CREATE TABLE `sensordata` (
`userID` int, /* shouldn't this have a foreign key constraint? */
`instrumentID` int,
`utcDateTime` datetime DEFAULT NULL,
`dateTime` datetime DEFAULT NULL,
/* what exactly are you putting here? Are you sure it's not causing any reduncy? */
`data` varchar(200) DEFAULT NULL,
/* your states will be a finite number of elements. They can be represented by constants in your code or a set of values in a related table */
`dataState` int,
/* what's this? Sounds like what you are saving in location */
`gps` varchar(45) DEFAULT NULL,
`location` point,
`speed` float,
`unitID` int DEFAULT '1',
/* as above */
`parameterID` int NOT NULL DEFAULT '1',
/* are you sure this is different from data? */
`originalData` varchar(200) DEFAULT NULL,
`comments` varchar(45) DEFAULT NULL,
`channelHashcode` varchar(12) DEFAULT NULL,
`settingHashcode` varchar(12) DEFAULT NULL,
/* as above and isn't this the same as */
`status` int,
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=98772 DEFAULT CHARSET=utf8
PRIMARY KEY ( userID, instrumentID, utcDateTime)