[Openvas-commits] r6138 - in trunk/openvas-manager: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Dec 15 20:13:27 CET 2009


Author: mattm
Date: 2009-12-15 20:13:24 +0100 (Tue, 15 Dec 2009)
New Revision: 6138

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/tasks_sql.h
Log:
	* src/tasks_sql.h: Put nvt_selectors before nvts when joining these tables
	in SQL, as suggested by Michael Wiegand.
	(create_tables): Add indexes on nvt_selectors and nvts.  ANALYZE after
	creating table.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-12-15 18:11:56 UTC (rev 6137)
+++ trunk/openvas-manager/ChangeLog	2009-12-15 19:13:24 UTC (rev 6138)
@@ -1,3 +1,10 @@
+2009-12-15  Matthew Mundell <matthew.mundell at intevation.de>
+
+	* src/tasks_sql.h: Put nvt_selectors before nvts when joining these tables
+	in SQL, as suggested by Michael Wiegand.
+	(create_tables): Add indexes on nvt_selectors and nvts.  ANALYZE after
+	creating table.
+
 2009-12-15  Felix Wolfsteller <felix.wolfsteller at intevation.de>
 
 	Made the openvasmd and doxygen- generated documentation aware of the
@@ -152,7 +159,7 @@
 
 2009-11-27  Felix Wolfsteller <felix.wolfsteller at intevation.de>
 
-	* src/task_sql.h: Minor doc improvement.
+	* src/tasks_sql.h: Minor doc improvement.
 
 2009-11-27  Felix Wolfsteller <felix.wolfsteller at intevation.de>
 
@@ -3914,7 +3921,7 @@
 
 	Reset task running information before starting the task.
 
-	* src/task_sql.h (reset_task): New function.
+	* src/tasks_sql.h (reset_task): New function.
 	* src/manage.h (reset_task): New header.
 
 	* src/manage.c (start_task): Call reset_task before starting the task.

Modified: trunk/openvas-manager/src/tasks_sql.h
===================================================================
--- trunk/openvas-manager/src/tasks_sql.h	2009-12-15 18:11:56 UTC (rev 6137)
+++ trunk/openvas-manager/src/tasks_sql.h	2009-12-15 19:13:24 UTC (rev 6138)
@@ -461,7 +461,12 @@
   sql ("CREATE TABLE IF NOT EXISTS nvt_preferences (id INTEGER PRIMARY KEY, name, value);");
   /* nvt_selectors types: 0 all, 1 family, 2 NVT (NVT_SELECTOR_TYPE_* above). */
   sql ("CREATE TABLE IF NOT EXISTS nvt_selectors (id INTEGER PRIMARY KEY, name, exclude INTEGER, type INTEGER, family_or_nvt, family);");
+  sql ("CREATE INDEX IF NOT EXISTS nvt_selectors_by_name ON nvt_selectors (name);");
+  sql ("CREATE INDEX IF NOT EXISTS nvt_selectors_by_family_or_nvt ON nvt_selectors (type, family_or_nvt);");
   sql ("CREATE TABLE IF NOT EXISTS nvts (id INTEGER PRIMARY KEY, oid, version, name, summary, description, copyright, cve, bid, xref, tag, sign_key_ids, category INTEGER, family);");
+  sql ("CREATE INDEX IF NOT EXISTS nvts_by_oid ON nvts (oid);");
+  sql ("CREATE INDEX IF NOT EXISTS nvts_by_name ON nvts (name);");
+  sql ("CREATE INDEX IF NOT EXISTS nvts_by_family ON nvts (family);");
   sql ("CREATE TABLE IF NOT EXISTS report_hosts (id INTEGER PRIMARY KEY, report INTEGER, host, start_time, end_time, attack_state, current_port, max_port);");
   sql ("CREATE TABLE IF NOT EXISTS report_results (id INTEGER PRIMARY KEY, report INTEGER, result INTEGER);");
   sql ("CREATE TABLE IF NOT EXISTS reports (id INTEGER PRIMARY KEY, uuid, hidden INTEGER, task INTEGER, date INTEGER, start_time, end_time, nbefile, comment, scan_run_status INTEGER);");
@@ -470,6 +475,8 @@
   sql ("CREATE TABLE IF NOT EXISTS task_files (id INTEGER PRIMARY KEY, task INTEGER, name, content);");
   sql ("CREATE TABLE IF NOT EXISTS tasks   (id INTEGER PRIMARY KEY, uuid, name, hidden INTEGER, time, comment, description, owner" /** @todo INTEGER */ ", run_status INTEGER, start_time, end_time, config, target);");
   sql ("CREATE TABLE IF NOT EXISTS users   (id INTEGER PRIMARY KEY, name UNIQUE, password);");
+
+  sql ("ANALYZE;");
 }
 
 /**
@@ -7160,7 +7167,7 @@
                    " SELECT oid, version, nvts.name, summary, description,"
                    " copyright, cve, bid, xref, tag, sign_key_ids,"
                    " category, nvts.family"
-                   " FROM nvts, nvt_selectors"
+                   " FROM nvt_selectors, nvts"
                    " WHERE"
                    " nvts.family = '%s'"
                    " AND nvt_selectors.name = '%s'"
@@ -7201,7 +7208,7 @@
                      " SELECT oid, version, nvts.name, summary, description,"
                      " copyright, cve, bid, xref, tag, sign_key_ids,"
                      " category, nvts.family"
-                     " FROM nvts, nvt_selectors"
+                     " FROM nvt_selectors, nvts"
                      " WHERE"
                      " nvts.family = '%s'"
                      " AND nvt_selectors.name = '%s'"
@@ -7219,7 +7226,7 @@
                   (" SELECT oid, version, nvts.name, summary, description,"
                    " copyright, cve, bid, xref, tag, sign_key_ids,"
                    " category, nvts.family"
-                   " FROM nvts, nvt_selectors"
+                   " FROM nvt_selectors, nvts"
                    " WHERE"
                    " nvts.family = '%s'"
                    " AND nvt_selectors.name = '%s'"
@@ -7246,7 +7253,7 @@
              ("SELECT oid, version, nvts.name, summary, description,"
               " copyright, cve, bid, xref, tag, sign_key_ids,"
               " category, nvts.family"
-              " FROM nvts, nvt_selectors"
+              " FROM nvt_selectors, nvts"
               " WHERE nvts.family = '%s'"
               " AND nvt_selectors.exclude = 0"
               " AND nvt_selectors.type = " G_STRINGIFY (NVT_SELECTOR_TYPE_NVT)



More information about the Openvas-commits mailing list