From 85bc77de28460cb10f079df4f015b6100417ea51 Mon Sep 17 00:00:00 2001 From: mghio <43461943+mghio@users.noreply.github.com> Date: Mon, 5 Sep 2022 14:11:48 +0800 Subject: [PATCH] Add index for table ReleaseHistory (#4550) * add index for table ReleaseHistory * update CHANGES.md * add delta SQL --- CHANGES.md | 1 + scripts/sql/apolloconfigdb.sql | 3 ++- .../v200-v210/apolloconfigdb-v200-v210.sql | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 scripts/sql/delta/v200-v210/apolloconfigdb-v200-v210.sql diff --git a/CHANGES.md b/CHANGES.md index b1536cafcc0..fa6cc3b31f0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,7 @@ Apollo 2.1.0 * [fix the deleted at timestamp issue](https://github.com/apolloconfig/apollo/pull/4493) * [add configuration processor for portal developers](https://github.com/apolloconfig/apollo/pull/4521) * [Add a potential json value check feature](https://github.com/apolloconfig/apollo/pull/4519) +* [Add index for table ReleaseHistory](https://github.com/apolloconfig/apollo/pull/4550) ------------------ All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/11?closed=1) diff --git a/scripts/sql/apolloconfigdb.sql b/scripts/sql/apolloconfigdb.sql index 60c497f60e7..d0f9aa56e44 100644 --- a/scripts/sql/apolloconfigdb.sql +++ b/scripts/sql/apolloconfigdb.sql @@ -345,7 +345,8 @@ CREATE TABLE `ReleaseHistory` ( PRIMARY KEY (`Id`), KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`,`BranchName`), KEY `IX_ReleaseId` (`ReleaseId`), - KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) + KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), + KEY `IX_PreviousReleaseId` (`PreviousReleaseId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布历史'; diff --git a/scripts/sql/delta/v200-v210/apolloconfigdb-v200-v210.sql b/scripts/sql/delta/v200-v210/apolloconfigdb-v200-v210.sql new file mode 100644 index 00000000000..72ca890beb1 --- /dev/null +++ b/scripts/sql/delta/v200-v210/apolloconfigdb-v200-v210.sql @@ -0,0 +1,21 @@ +-- +-- Copyright 2022 Apollo Authors +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +# delta schema to upgrade apollo config db from v2.0.0 to v2.1.0 + +Use ApolloConfigDB; + +-- add INDEX for ReleaseHistory table +CREATE INDEX IX_PreviousReleaseId ON ReleaseHistory(PreviousReleaseId); \ No newline at end of file