diff -Naur -x'*.info' media_mover-patched/media_mover_api.install media_mover/media_mover_api.install
--- media_mover-patched/media_mover_api.install	2011-07-02 16:42:53.000000000 +0200
+++ media_mover/media_mover_api.install	2011-07-26 19:22:55.000000000 +0200
@@ -33,11 +33,29 @@
   $schema['media_mover_files'] = array(
     'description' => 'Holds file data for a specific  Media Mover file.',
     'fields' => array(
-      'mmfid' => array('type' => 'serial'),
-      'nid' => array('type' => 'int', 'unsigned' => TRUE),
-      'fid' => array('type' => 'int', 'unsigned' => TRUE, 'description' => 'Drupal file id'),
-      'cid' => array('type' => 'varchar', 'length' => 255, 'default' => '', 'description' => 'Configuration machine name ID'),
-      'step_order' => array('type' => 'int', 'unsigned' => TRUE, 'description' => 'Step order that this file is currently in'),
+      'mmfid' => array(
+        'type' => 'serial',
+        'not null' => TRUE,
+        'unsigned' => TRUE,
+      ),
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+      ),
+      'fid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'description' => 'Drupal file id',
+      ),
+      'cid' => array('type' => 'varchar',
+        'length' => 255,
+        'default' => '',
+        'description' => 'Configuration machine name ID',
+      ),
+      'step_order' => array('type' => 'int',
+        'unsigned' => TRUE,
+        'description' => 'Step order that this file is currently in',
+      ),
       'source_filepath' => array(
         'type' => 'text',
         'size' => 'medium',
@@ -63,13 +81,13 @@
         'description' => 'The Unix timestamp when the file was created.',
         'type' => 'int',
         'not null' => TRUE,
-        'default' => 0
+        'default' => 0,
       ),
       'lock_date' => array(
         'description' => 'The Unix timestamp when the file was locked.',
         'type' => 'int',
         'not null' => TRUE,
-        'default' => 0
+        'default' => 0,
       ),
       'data' => array(
         'type' => 'text',
@@ -80,11 +98,10 @@
       ),
     ),
     'indexes' => array(
-      'mmfid' => array('mmfid'),
       'nid' => array('nid'),
       'cid' => array('cid'),
       'fid' => array('fid'),
-      'cid, fid' => array('cid', 'fid'),
+      'cid_fid' => array('cid', 'fid'),
     ),
     'primary key' => array('mmfid')
   );
@@ -97,23 +114,23 @@
         'length' => 255,
         'default' => '',
         'description' =>
-        'Step machine name ID'
+        'Step machine name ID',
       ),
       'name' => array(
         'type' => 'varchar',
         'length' => 255,
         'default' => '',
-        'description' => 'Name of the step'
+        'description' => 'Name of the step',
       ),
       'module'  => array(
         'type' => 'varchar',
         'length' => 255,
-        'default' => ''
+        'default' => '',
       ),
       'action_id'  => array(
         'type' => 'varchar',
         'length' => 255,
-        'default' => ''
+        'default' => '',
       ),
       'settings'  => array(
         'serialize' => TRUE,
@@ -146,25 +163,26 @@
     'fields' => array(
       'step_map_id' => array(
         'type' => 'serial',
-        'description' => 'Unique identifier for this step/configuration pair'
+        'not null' => TRUE,
+        'description' => 'Unique identifier for this step/configuration pair',
       ),
       'sid' => array(
         'type' => 'varchar',
         'length' => 255,
         'default' => '',
-        'description' => 'Step machine name ID'
+        'description' => 'Step machine name ID',
       ),
       'cid' => array(
         'type' => 'varchar',
         'length' => 255,
         'default' => '',
-        'description' => 'Configuration machine name ID'
+        'description' => 'Configuration machine name ID',
       ),
       'step_order' => array(
         'type' => 'int',
         'unsigned' => TRUE,
         'description' =>
-        'Order that this step is in the configuration'
+        'Order that this step is in the configuration',
       ),
       'status' => array(
         'type' => 'varchar',
@@ -174,12 +192,12 @@
       'start_time'  => array(
         'type' => 'int',
         'not null' => TRUE,
-        'default' => 0
+        'default' => 0,
       ),
       'stop_time'  => array(
         'type' => 'int',
         'not null' => TRUE,
-        'default' => 0
+        'default' => 0,
       ),
     ),
     'export' => array(
@@ -293,4 +311,24 @@
   Update media_mover_files - move all files into a serialized files col
 
    */
+}
+
+/**
+ * Add more indexes to table media_mover_files for better performance.
+ */
+function media_mover_api_update_6201() {
+  $ret = array();
+
+  db_add_index($ret, 'media_mover_files', 'cid_fid', array('cid','fid'));
+  db_add_index($ret, 'media_mover_files', 'cid', array('cid'));
+  
+  $field_mmfid = array(
+    'type' => 'serial',
+    'not null' => TRUE,
+    'unsigned' => TRUE,
+  );
+  
+  db_change_field($ret, 'media_mover_files', 'mmfid', 'mmfid', $field_mmfid);  
+
+  return $ret;
 }
\ No newline at end of file
