Skip to content

Commit

Permalink
Merge pull request TencentBlueKing#2248 from jsonwan/github_perf/file…
Browse files Browse the repository at this point in the history
…_gateway

perf: 文件源任务数量较多时DB高负载 TencentBlueKing#2246
  • Loading branch information
wangyu096 authored Jul 19, 2023
2 parents ea370a6 + 2a69936 commit 89b7a91
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
USE job_execute;

SET NAMES utf8mb4;

DROP PROCEDURE IF EXISTS job_schema_update;

DELIMITER <JOB_UBF>

CREATE PROCEDURE job_schema_update()
BEGIN

DECLARE db VARCHAR(100);
SET AUTOCOMMIT = 0;
SELECT DATABASE() INTO db;

IF NOT EXISTS(SELECT 1
FROM information_schema.statistics
WHERE TABLE_SCHEMA = db
AND TABLE_NAME = 'file_source_task_log'
AND INDEX_NAME = 'idx_file_source_batch_task_id') THEN
ALTER TABLE file_source_task_log ADD INDEX `idx_file_source_batch_task_id` (file_source_batch_task_id);
END IF;

COMMIT;
END <JOB_UBF>
DELIMITER ;
COMMIT;

CALL job_schema_update();

DROP PROCEDURE IF EXISTS job_schema_update;

0 comments on commit 89b7a91

Please sign in to comment.