MySQL Forums
Forum List  »  General

Re: WHY: Same timestamp for two different records from two different sessions
Posted by: Kristijan Marin
Date: January 27, 2019 04:12AM

Hi,

First, many thanks for your help ...

I added a new col that is of type timestamp(6) ... using sysdate(6) to get a value...

If I run sproc with 10 inserts with no delay ... I get the same "second" but the millisec part is diffrent ... which is expected ...

Then I added a SLEEP(1) for 1 sec between each insert and now all records have different timestamp .. as they should.

and here is my table:

CREATE TABLE `i8_messages` (
  `uid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `shard` mediumint(8) unsigned NOT NULL,
  `title` varchar(1000) DEFAULT NULL,
  `fk_group` int(10) unsigned NOT NULL,
  `creator` bigint(20) unsigned NOT NULL,
  `type` tinyint(1) NOT NULL DEFAULT '0',
  `lastupdate` int(11) unsigned NOT NULL DEFAULT '0',
  `ispermanent` tinyint(1) NOT NULL DEFAULT '0',
  `startdate` int(11) NOT NULL DEFAULT '0',
  `enddate` int(11) NOT NULL DEFAULT '0',
  `scheduled_frequency` tinyint(1) NOT NULL DEFAULT '0',
  `scheduled_every` tinyint(1) NOT NULL DEFAULT '0',
  `scheduled_day` tinyint(1) NOT NULL DEFAULT '0',
  `sum_event_yes` int(11) unsigned NOT NULL DEFAULT '0',
  `sum_event_no` int(11) unsigned NOT NULL DEFAULT '0',
  `event_showresult` tinyint(1) NOT NULL DEFAULT '0',
  `event_date` int(11) NOT NULL DEFAULT '0',
  `event_location` varchar(500) DEFAULT NULL,
  `attachments` json DEFAULT NULL,
  `questions` json DEFAULT NULL,
  `link` json DEFAULT NULL,
  `jsondata` json DEFAULT NULL,
  `deleted` tinyint(1) NOT NULL DEFAULT '0',
  `alreadydispatched` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ibeaconminormajor` varchar(20) DEFAULT NULL,
  `languages` json DEFAULT NULL,
  `jsonconfig` json DEFAULT NULL,
  `body` text,
  PRIMARY KEY (`uid`),
  KEY `fk_group_idx` (`fk_group`),
  KEY `scheduleIdx` (`startdate`,`enddate`,`ispermanent`,`alreadydispatched`,`deleted`),
  KEY `end_sh_delIdx` (`enddate`,`scheduled_frequency`,`ispermanent`,`alreadydispatched`,`deleted`),
  CONSTRAINT `fk_group` FOREIGN KEY (`fk_group`) REFERENCES `i8_groups` (`uid`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

Options: ReplyQuote




Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.