summaryrefslogtreecommitdiff
path: root/tko/migrations
diff options
context:
space:
mode:
authormbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2008-10-21 16:26:47 +0000
committermbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2008-10-21 16:26:47 +0000
commit9ad0ebe3b01a5eec5c99d8409e11e7edc20bfaea (patch)
treec28c6d192ad8dad5e09f8cf9dca419a327d1eda5 /tko/migrations
parent1bd181367ab3a0efb4ff184d9373b5c2fdc5d636 (diff)
Add indices to TKO. These range from absolutely performance critical
indices (like tests.job_idx) to ones that might help a little bit (kernels.printable). This change will help mysql performance dramatically in large installations. Risk: Low Visibility: Things will be faster. Signed-off-by: Jeremy Orlow <jorlow@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@2313 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/migrations')
-rw-r--r--tko/migrations/018_add_indexes.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tko/migrations/018_add_indexes.py b/tko/migrations/018_add_indexes.py
new file mode 100644
index 00000000..2bbbfc9a
--- /dev/null
+++ b/tko/migrations/018_add_indexes.py
@@ -0,0 +1,34 @@
+def migrate_up(manager):
+ manager.execute_script(CREATE_INDICES)
+
+
+def migrate_down(manager):
+ manager.execute_script(DROP_INDICES)
+
+
+CREATE_INDICES = """
+CREATE INDEX job_idx ON tests (job_idx);
+CREATE INDEX reason ON tests (reason);
+CREATE INDEX test ON tests (test);
+CREATE INDEX subdir ON tests (subdir);
+CREATE INDEX printable ON kernels (printable);
+CREATE INDEX word ON status (word);
+CREATE INDEX attribute ON test_attributes (attribute);
+CREATE INDEX value ON test_attributes (value);
+CREATE INDEX attribute ON iteration_result (attribute);
+CREATE INDEX value ON iteration_result (value);
+"""
+
+
+DROP_INDICES = """
+DROP INDEX job_idx ON tests;
+DROP INDEX reason ON tests;
+DROP INDEX test ON tests;
+DROP INDEX subdir ON tests;
+DROP INDEX printable ON kernels;
+DROP INDEX word ON status;
+DROP INDEX attribute ON test_attributes;
+DROP INDEX value ON test_attributes;
+DROP INDEX attribute ON iteration_result;
+DROP INDEX value ON iteration_result;
+"""