Skip to content

Commit

Permalink
optimization apolloconfigdb-v190-v200-after.sql (#4470)
Browse files Browse the repository at this point in the history
* add tech-support-qq-4.png

* Update README.md

* Enhance the user experience in the scenario of submitting duplicate keys

* Modify the key-value conflict exception prompt, adjust the code style

* optimization apolloconfigdb-v190-v200-after.sql

Co-authored-by: Jason Song <nobodyiam@gmail.com>
  • Loading branch information
klboke and nobodyiam authored Jul 21, 2022
1 parent 2d74140 commit 0ca7eb0
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

Use ApolloConfigDB;

-- Begin:Create indexes to solve the problem of updating large tables
ALTER TABLE `Commit` ADD INDEX `idx_IsDeleted_DeletedAt` (`IsDeleted`, `DeletedAt`);
ALTER TABLE `Release` ADD INDEX `idx_IsDeleted_DeletedAt` (`IsDeleted`, `DeletedAt`);

-- the follow DML won't change the `DataChange_LastTime` field
UPDATE `AccessKey` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0;
UPDATE `App` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0;
Expand Down Expand Up @@ -74,3 +78,7 @@ ALTER TABLE `Release`
ALTER TABLE `ServerConfig`
ADD UNIQUE INDEX `UK_Key_Cluster_DeletedAt` (`Key`,`Cluster`,`DeletedAt`),
DROP INDEX `IX_Key`;

-- End:Delete temporarily created indexes
ALTER TABLE `Commit` DROP INDEX `idx_IsDeleted_DeletedAt`;
ALTER TABLE `Release` DROP INDEX `idx_IsDeleted_DeletedAt`;

0 comments on commit 0ca7eb0

Please sign in to comment.