You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/01/20 10:10:21 UTC

[GitHub] [shardingsphere-elasticjob] skaic opened a new issue #1818: [Job trace] id-uuid('varchar') in mysql table PRIMARY KEY (`id`) is not a good idea

skaic opened a new issue #1818:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1818


   ## Question
   
   [Job trace] 'varchar'  in mysql table PRIMARY KEY (`id`)  is not a good idea。
   
   e.g.
   
   REATE TABLE `JOB_STATUS_TRACE_LOG` (
     `id` varchar(40) NOT NULL,
     `job_name` varchar(100) NOT NULL,
     `original_task_id` varchar(255) NOT NULL,
     `task_id` varchar(255) NOT NULL,
     `slave_id` varchar(50) NOT NULL,
     `source` varchar(50) NOT NULL,
     `execution_type` varchar(20) NOT NULL,
     `sharding_item` varchar(100) NOT NULL,
     `state` varchar(20) NOT NULL,
     `message` varchar(4000) DEFAULT NULL,
     `creation_time` timestamp NULL DEFAULT NULL,
     PRIMARY KEY (`id`),
     KEY `TASK_ID_STATE_INDEX` (`task_id`(128),`state`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
   
   CREATE TABLE `JOB_EXECUTION_LOG` (
     `id` varchar(40) NOT NULL,
     `job_name` varchar(100) NOT NULL,
     `task_id` varchar(255) NOT NULL,
     `hostname` varchar(255) NOT NULL,
     `ip` varchar(50) NOT NULL,
     `sharding_item` int(11) NOT NULL,
     `execution_source` varchar(20) NOT NULL,
     `failure_cause` varchar(4000) DEFAULT NULL,
     `is_success` int(11) NOT NULL,
     `start_time` timestamp NULL DEFAULT NULL,
     `complete_time` timestamp NULL DEFAULT NULL,
     PRIMARY KEY (`id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
   
   Because: 
   1.  Mysql InnoDB table PRIMARY KEY need a auto increment  unique identity.
   2.  We need  to analyze a log in reverse order , use  auto increment  unique identity can be fast.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- closed issue #1818: [Job trace] id-uuid('varchar') in mysql table PRIMARY KEY (`id`) is not a good idea

Posted by GitBox <gi...@apache.org>.
Technoboy- closed issue #1818:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1818


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org