From 6e4b1d6fe3d71a60ebd172779c0e25fb06a6a5ef Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Thu, 4 Aug 2011 12:31:09 +0000 Subject: [PATCH] 2011-08-04 Ramon Novoa * pandoradb.sql, extras/pandoradb_migrate_v3.2_to_v4.0.sql: Added two indexes to the database schema to improve queries on talert_template_modules and tserver_export. Thanks to Manuel Arostegui. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4666 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 +++++++ .../extras/pandoradb_migrate_v3.2_to_v4.0.sql | 11 +++++++++++ pandora_console/pandoradb.sql | 6 ++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index aae08a32f9..d2f67772f4 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2011-08-04 Ramon Novoa + + * pandoradb.sql, + extras/pandoradb_migrate_v3.2_to_v4.0.sql: Added two indexes to the + database schema to improve queries on talert_template_modules and + tserver_export. Thanks to Manuel Arostegui. + 2011-08-04 Javier Lanz * godmode/modules/manage_nc_groups.php: Fixed creating & updating diff --git a/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql b/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql index f38353a8dd..29d608b0a4 100644 --- a/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql +++ b/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql @@ -216,3 +216,14 @@ ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max' UPDATE tagente_modulo SET prediction_module = 2 WHERE custom_integer_1 <> 0 AND prediction_module <> 0; UPDATE tagente_modulo SET custom_integer_1 = prediction_module AND prediction_module = 1 WHERE custom_integer_1 = 0 AND prediction_module <> 0; + +-- ----------------------------------------------------- +-- Table `talert_template_modules` +-- ----------------------------------------------------- +ALTER TABLE talert_template_modules ADD INDEX force_execution (`force_execution`); + +-- ----------------------------------------------------- +-- Table `tserver_export_data` +-- ----------------------------------------------------- +ALTER TABLE tserver_export ADD INDEX id_export_server (`id_export_server`); + diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index dfe57c1928..9c748ff281 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -302,7 +302,8 @@ CREATE TABLE IF NOT EXISTS `talert_template_modules` ( ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`id_alert_template`) REFERENCES talert_templates(`id`) ON DELETE CASCADE ON UPDATE CASCADE, - UNIQUE (`id_agent_module`, `id_alert_template`) + UNIQUE (`id_agent_module`, `id_alert_template`), + INDEX force_execution (`force_execution`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `talert_template_module_actions` ( @@ -945,7 +946,8 @@ CREATE TABLE IF NOT EXISTS `tserver_export` ( `directory` varchar(100) NOT NULL default '', `options` varchar(100) NOT NULL default '', `timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'Number of hours of diference with the server timezone' , - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + INDEX id_export_server (`id_export_server`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- id_export_server is real pandora fms export server process that manages this server