GitHub PushEvent at 2014-02-26 10:54:52
Repository: release
Actor: alext
Payload: {"shas":[["2325a893baf4d71c15eea8730ad682e01e7b81a9","6518d16a85396e511b329a97b21dda0c9acebabc@digital.cabinet-office.gov.uk","Moar index speedup.\n\nAdd a db index to the deployments table.  The index view results in lots of queries of the deployments table which currently doesn't have any indices.\n\nPrior to the index:\n```\nmysql> explain SELECT `deployments`.* FROM `deployments` WHERE `deployments`.`application_id` = 7 AND `deployments`.`environment` = 'staging' ORDER BY created_at DESC LIMIT 1\\G\n*************************** 1. row ***************************\n           id: 1\n  select_type: SIMPLE\n        table: deployments\n         type: ALL\npossible_keys: NULL\n          key: NULL\n      key_len: NULL\n          ref: NULL\n         rows: 16742\n        Extra: Using where; Using filesort\n1 row in set (0.00 sec)\n```\n\nWith the index:\n```\nmysql> explain SELECT `deployments`.* FROM `deployments` WHERE `deployments`.`application_id` = 7 AND `deployments`.`environment` = 'staging' ORDER BY created_at DESC LIMIT 1\\G\n*************************** 1. row ***************************\n           id: 1\n  select_type: SIMPLE\n        table: deployments\n         type: ref\npossible_keys: index_deployments_on_application_id_etc\n          key: index_deployments_on_application_id_etc\n      key_len: 263\n          ref: const,const\n         rows: 21\n        Extra: Using where\n1 row in set (0.01 sec)\n```","Alex Tomlins",true]],"size":1,"ref":"refs/heads/index_speedup","head":"2325a893baf4d71c15eea8730ad682e01e7b81a9"}