It would appear that quite often we join versioncontrol_item_revisions against versioncontrol_operations to get full commit info. This join is usually done ON vc_op_id, but there is no index on versioncontrol_item_revisions.vc_op_id. We should add one, as without it we tend to have a full table scan on item_revisions. Example:

Before

| id | select_type | table                         | type   | possible_keys | key          | key_len | ref                                            | rows | Extra       |
|  1 | SIMPLE      | versioncontrol_repositories   | index  | PRIMARY       | PRIMARY      | 4       | NULL                                           | 9016 | Using index |
|  1 | SIMPLE      | versioncontrol_item_revisions | ref    | repo_id_path  | repo_id_path | 4       | git_dev.versioncontrol_repositories.repo_id    |   48 | Using where |
|  1 | SIMPLE      | versioncontrol_operations     | eq_ref | PRIMARY       | PRIMARY      | 4       | git_dev.versioncontrol_item_revisions.vc_op_id |    1 | Using index |

After

| id | select_type | table                         | type   | possible_keys     | key     | key_len | ref                                            | rows | Extra       |
|  1 | SIMPLE      | versioncontrol_item_revisions | range  | repo_id_path,test | test    | 4       | NULL                                           |   14 | Using where |
|  1 | SIMPLE      | versioncontrol_operations     | eq_ref | PRIMARY           | PRIMARY | 4       | git_dev.versioncontrol_item_revisions.vc_op_id |    1 | Using index |
|  1 | SIMPLE      | versioncontrol_repositories   | eq_ref | PRIMARY           | PRIMARY | 4       | git_dev.versioncontrol_item_revisions.repo_id  |    1 |             |

Comments

halstead’s picture

Status: Active » Needs review
Issue tags: +git phase 2
StatusFileSize
new972 bytes

Here is a quick patch to add the index.

dww’s picture

Assigned: sdboyer » halstead
Status: Needs review » Fixed
Issue tags: +git sprint 10

#1 had some trivial whitespace bugs. Fixed here. Tested locally and works fine. Committed to HEAD: http://drupal.org/cvs?commit=501772

Thanks!
-Derek

halstead’s picture

Komodo always snips off the trailing new line. Thanks for catching that.

dww’s picture

@halstead: That wasn't the only one. There was also a missing space before $ret. I also reformatted the PHPDoc block to follow our coding standards...

Cheers,
-Derek

halstead’s picture

Assigned: halstead » sdboyer
StatusFileSize
new1.43 KB

Here is dww's cleaned up version that was actually committed.

halstead’s picture

Assigned: sdboyer » halstead

I didn't mean to change the assignment just provide the patch.

Status: Fixed » Closed (fixed)
Issue tags: -git phase 2, -git sprint 10

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit d46f8cb on repository-families, drush-vc-sync-unlock by dww:
    #1065304 by halstead, dww: Added missing index on {...

  • Commit d46f8cb on repository-families by dww:
    #1065304 by halstead, dww: Added missing index on {...