Merge pull request #1387 from remibergsma/CLOUDSTACK-8300

CLOUDSTACK-8300: Set indexes on event tableWhen there are many events in the cloud.event table, the UI throws an SQL exception and the management server spikes at 100% CPU for minutes. That causes other API calls to fail with 530 errors.

It seems an index on the 'archived' field is missing (since it is used in the WHERE clause).

We have 1.4M events in the table:
`select count(*) from event;`
1497838

This PR adds the index to the `archived` field and the `state` field.

* pr/1387:
  CLOUDSTACK-8300: Set indexes on event table

Signed-off-by: Remi Bergsma <github@remi.nl>
This commit is contained in:
Remi Bergsma 2016-01-31 18:59:23 +01:00
commit 476e9f0210

View File

@ -18,3 +18,6 @@
--;
-- Schema upgrade from 4.8.1 to 4.9.0;
--;
ALTER TABLE `event` ADD INDEX `archived` (`archived`);
ALTER TABLE `event` ADD INDEX `state` (`state`);