Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt November 11, 2024
TSP Posted January 16, 2017 Posted January 16, 2017 You've done it again. Can you please group your queries against the same table? On a test database I set up your approach takes approximately 22 minutes. Reinstalling that database however, and then instead making two queries: one for the columns and one for the indexes, makes it take just 6 minutes. Here is the case where I follow your instructions blindly: mysql> ALTER TABLE `core_reputation_index` ADD COLUMN `rep_class` VARCHAR (100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL ; Query OK, 0 rows affected (4 min 41.84 sec) mysql> ALTER TABLE `core_reputation_index` ADD COLUMN `lookup_hash` VARCHAR (32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'MD5 hash of app,type,item_id'; Query OK, 0 rows affected (5 min 0.60 sec) mysql> ALTER TABLE `core_reputation_index` ADD COLUMN `lookup_type_id_hash` VARCHAR (32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'MD5 hash of app, type, type_id'; Query OK, 0 rows affected (4 min 58.45 sec) mysql> ALTER TABLE `core_reputation_index` ADD KEY `rep_class` (`rep_class`); Query OK, 0 rows affected (29.33 sec) mysql> ALTER TABLE `core_reputation_index` ADD COLUMN `item_id` INT (10) UNSIGNED NOT NULL DEFAULT 0 ; Query OK, 0 rows affected (5 min 33.85 sec) mysql> ALTER TABLE `core_reputation_index` ADD KEY `hash_lookup` (`lookup_type_id_hash`,`rep_date`); Query OK, 0 rows affected (38.99 sec) And here it is when I group them: mysql> ALTER TABLE core_reputation_index -> ADD COLUMN `rep_class` VARCHAR (100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL, -> ADD COLUMN `lookup_hash` VARCHAR (32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, -> ADD COLUMN `lookup_type_id_hash` VARCHAR (32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'MD5 hash of app, type, type_id', -> ADD COLUMN `item_id` INT (10) UNSIGNED NOT NULL DEFAULT 0; Query OK, 0 rows affected (4 min 44.09 sec) mysql> ALTER TABLE `core_reputation_index` -> ADD KEY `hash_lookup` (`lookup_type_id_hash`,`rep_date`), -> ADD KEY `rep_class` (`rep_class`); Query OK, 0 rows affected (1 min 6.29 sec)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.