{"action":"created","issue":{"url":"https://api.github.com/repos/opencollective/opencollective-api/issues/1531","repository_url":"https://api.github.com/repos/opencollective/opencollective-api","labels_url":"https://api.github.com/repos/opencollective/opencollective-api/issues/1531/labels{/name}","comments_url":"https://api.github.com/repos/opencollective/opencollective-api/issues/1531/comments","events_url":"https://api.github.com/repos/opencollective/opencollective-api/issues/1531/events","html_url":"https://github.com/opencollective/opencollective-api/pull/1531","id":382934432,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMyNTIzODYw","number":1531,"title":"fix(paymentMethod): Add index to Transaction table to speed up balance computation","user":{"login":"xdamman","id":74358,"node_id":"MDQ6VXNlcjc0MzU4","avatar_url":"https://avatars2.githubusercontent.com/u/74358?v=4","gravatar_id":"","url":"https://api.github.com/users/xdamman","html_url":"https://github.com/xdamman","followers_url":"https://api.github.com/users/xdamman/followers","following_url":"https://api.github.com/users/xdamman/following{/other_user}","gists_url":"https://api.github.com/users/xdamman/gists{/gist_id}","starred_url":"https://api.github.com/users/xdamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xdamman/subscriptions","organizations_url":"https://api.github.com/users/xdamman/orgs","repos_url":"https://api.github.com/users/xdamman/repos","events_url":"https://api.github.com/users/xdamman/events{/privacy}","received_events_url":"https://api.github.com/users/xdamman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-21T02:58:58Z","updated_at":"2018-11-21T08:33:42Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/opencollective/opencollective-api/pulls/1531","html_url":"https://github.com/opencollective/opencollective-api/pull/1531","diff_url":"https://github.com/opencollective/opencollective-api/pull/1531.diff","patch_url":"https://github.com/opencollective/opencollective-api/pull/1531.patch"},"body":"Fetching my logged in user take 30s locally.\r\nThe reason being that for every single collective I'm an admin of, it fetches all payment methods and for each, it has to compute the balance, which takes 400+ms a piece.\r\nhttps://github.com/opencollective/opencollective-api/blob/master/server/models/PaymentMethod.js#L442-L445\r\n\r\nThe reason being that fetching transaction by `PaymentMethodId` is doing a table scan.\r\n\r\nThis fixes it. \r\n"},"comment":{"url":"https://api.github.com/repos/opencollective/opencollective-api/issues/comments/440579523","html_url":"https://github.com/opencollective/opencollective-api/pull/1531#issuecomment-440579523","issue_url":"https://api.github.com/repos/opencollective/opencollective-api/issues/1531","id":440579523,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDU3OTUyMw==","user":{"login":"coveralls","id":2354108,"node_id":"MDQ6VXNlcjIzNTQxMDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2354108?v=4","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2018-11-21T08:33:42Z","updated_at":"2018-11-21T08:33:42Z","author_association":"NONE","body":"\n[![Coverage Status](https://coveralls.io/builds/20218867/badge)](https://coveralls.io/builds/20218867)\n\nCoverage remained the same at 69.082% when pulling **4e1dac52c6b0c36363fe4ef8753312361e4650a8 on TransactionIndex** into **17187b4d24b9acb6169dc7cab76b6dc6a74e4512 on master**.\n"}}
{"actor":{"display_login":"coveralls"}}