forked from TencentBlueKing/bk-job
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request TencentBlueKing#2248 from jsonwan/github_perf/file…
…_gateway perf: 文件源任务数量较多时DB高负载 TencentBlueKing#2246
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
support-files/sql/job-execute/0022_job_execute_20230719-1000_V3.7.6_mysql.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |