Last active
September 24, 2019 19:35
-
-
Save dasl-/3eb67edf32ae01062a3a045ed344d6e9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- unsharded database | |
CREATE TABLE `shops_index` ( | |
`shop_id` bigint(20) unsigned NOT NULL, | |
`shop_shard` int(11) NOT NULL, | |
`name` varchar(100) DEFAULT NULL, | |
PRIMARY KEY (`shop_id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; |
This file contains hidden or 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
USE `index_test`; | |
INSERT INTO shops_index (shop_id, shop_shard) VALUES(15, 15); | |
USE `shard_test:-80`; | |
INSERT INTO shop_data (shop_id, k, v) VALUES(1, 'a', 'a'); |
This file contains hidden or 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
-- sharded database | |
CREATE TABLE `shop_data` ( | |
`shop_id` bigint(20) unsigned NOT NULL, | |
`k` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, | |
`v` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, | |
PRIMARY KEY (`shop_id`, `k`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment