perf: 增加表索引
This commit is contained in:
parent
01b0421cdf
commit
56fb3e2712
|
@ -0,0 +1,13 @@
|
|||
--
|
||||
-- 增加一个索引
|
||||
SELECT IF(EXISTS(SELECT DISTINCT index_name
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = DATABASE()
|
||||
AND table_name = 'api_definition'
|
||||
AND index_name LIKE 'api_definition_module_id_status_index'),
|
||||
'select 1',
|
||||
'ALTER TABLE api_definition ADD INDEX api_definition_module_id_status_index (module_id, status)')
|
||||
INTO @a;
|
||||
PREPARE stmt1 FROM @a;
|
||||
EXECUTE stmt1;
|
||||
DEALLOCATE PREPARE stmt1;
|
|
@ -0,0 +1,13 @@
|
|||
--
|
||||
-- 增加一个索引
|
||||
SELECT IF(EXISTS(SELECT DISTINCT index_name
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = DATABASE()
|
||||
AND table_name = 'load_test_report_detail'
|
||||
AND index_name LIKE 'load_test_report_detail_report_id_part_index'),
|
||||
'select 1',
|
||||
'ALTER TABLE load_test_report_detail ADD INDEX load_test_report_detail_report_id_part_index (report_id, part)')
|
||||
INTO @a;
|
||||
PREPARE stmt1 FROM @a;
|
||||
EXECUTE stmt1;
|
||||
DEALLOCATE PREPARE stmt1;
|
Loading…
Reference in New Issue