Add DB index to Alert.last_sent column to speed up listAlertsCmd.

This commit is contained in:
Min Chen 2013-01-23 12:38:37 -08:00
parent 31a5669c7c
commit 285e8213fe
2 changed files with 3 additions and 0 deletions

View File

@ -1332,6 +1332,7 @@ CREATE TABLE `cloud`.`alert` (
`last_sent` DATETIME NULL COMMENT 'Last time the alert was sent',
`resolved` DATETIME NULL COMMENT 'when the alert status was resolved (available memory no longer at critical level, etc.)',
PRIMARY KEY (`id`),
INDEX `last_sent` (`last_sent` DESC),
CONSTRAINT `uc_alert__uuid` UNIQUE (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -77,6 +77,8 @@ ALTER TABLE `cloud`.`inline_load_balancer_nic_map` DROP COLUMN load_balancer_id;
ALTER TABLE upload ADD uuid VARCHAR(40);
ALTER TABLE async_job modify job_cmd VARCHAR(255);
ALTER TABLE `cloud`.`alert` ADD INDEX `last_sent` (`last_sent` DESC) ;
-- populate uuid column with db id if uuid is null
UPDATE `cloud`.`account` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`alert` set uuid=id WHERE uuid is NULL;