From 021d2e8f30663c74b088abcba02a006617c07aa2 Mon Sep 17 00:00:00 2001
From: Monika Komorowska <mk8@sanger.ac.uk>
Date: Thu, 8 Dec 2011 16:58:34 +0000
Subject: [PATCH] Reorder an index in unmapped_object

---
 sql/patch_65_66_c.sql | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 sql/patch_65_66_c.sql

diff --git a/sql/patch_65_66_c.sql b/sql/patch_65_66_c.sql
new file mode 100644
index 0000000000..e70cf98fc3
--- /dev/null
+++ b/sql/patch_65_66_c.sql
@@ -0,0 +1,19 @@
+# patch_65_66_c.sql
+#
+# Title: Reorder an index in unmapped_object.
+#
+# Description:
+# The unique_unmapped_obj_idx index in the unmapped_object table is
+# ineffective when querying the table.  Its first part, for example,
+# partly overlaps with the id_idx index.  A reordering was suggested by
+# the Ensembl Regulation team.
+
+ALTER TABLE unmapped_object
+  DROP INDEX unique_unmapped_obj_idx,
+  ADD UNIQUE INDEX unique_unmapped_obj_idx
+    (ensembl_id, ensembl_object_type, identifier, unmapped_reason_id,
+    parent, external_db_id);
+
+# Patch identifier:
+INSERT INTO meta (species_id, meta_key, meta_value)
+  VALUES (NULL, 'patch', 'patch_65_66_c.sql|reorder_unmapped_obj_index');
-- 
GitLab