diff --git a/uc_attribute/uc_attribute.install b/uc_attribute/uc_attribute.install
index 8b1eed9..ceb22e3 100644
--- a/uc_attribute/uc_attribute.install
+++ b/uc_attribute/uc_attribute.install
@@ -122,6 +122,9 @@ function uc_attribute_schema() {
       ),
     ),
     'primary key' => array('oid'),
+    'indexes' => array(
+      'aid' => array('aid'),
+    ),
     'foreign keys' => array(
       'aid' => array('uc_attributes' => 'aid'),
     ),
@@ -459,3 +462,13 @@ function uc_attribute_update_7001() {
 function uc_attribute_update_7002() {
   db_drop_field('uc_attributes', 'format');
 }
+
+/**
+ * Add index to attribute options table.
+ */
+function uc_attribute_update_7003() {
+  // Indexes may have been added in 6.x-2.x.
+  if (!db_index_exists('uc_attribute_options', 'aid')) {
+    db_add_index('uc_attribute_options', 'aid', array('aid'));
+  }
+}
