{"action":"created","issue":{"url":"https://api.github.com/repos/pods-framework/pods/issues/1911","repository_url":"https://api.github.com/repos/pods-framework/pods","labels_url":"https://api.github.com/repos/pods-framework/pods/issues/1911/labels{/name}","comments_url":"https://api.github.com/repos/pods-framework/pods/issues/1911/comments","events_url":"https://api.github.com/repos/pods-framework/pods/issues/1911/events","html_url":"https://github.com/pods-framework/pods/issues/1911","id":24552446,"number":1911,"title":"Optimizing multiple-relationship loop with many items","user":{"login":"ekandreas","id":1794603,"avatar_url":"https://avatars.githubusercontent.com/u/1794603?v=3","gravatar_id":"","url":"https://api.github.com/users/ekandreas","html_url":"https://github.com/ekandreas","followers_url":"https://api.github.com/users/ekandreas/followers","following_url":"https://api.github.com/users/ekandreas/following{/other_user}","gists_url":"https://api.github.com/users/ekandreas/gists{/gist_id}","starred_url":"https://api.github.com/users/ekandreas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekandreas/subscriptions","organizations_url":"https://api.github.com/users/ekandreas/orgs","repos_url":"https://api.github.com/users/ekandreas/repos","events_url":"https://api.github.com/users/ekandreas/events{/privacy}","received_events_url":"https://api.github.com/users/ekandreas/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pods-framework/pods/labels/Docs%20Improvements","name":"Docs Improvements","color":"e102d8"}],"state":"closed","locked":false,"assignee":{"login":"pglewis","id":1973916,"avatar_url":"https://avatars.githubusercontent.com/u/1973916?v=3","gravatar_id":"","url":"https://api.github.com/users/pglewis","html_url":"https://github.com/pglewis","followers_url":"https://api.github.com/users/pglewis/followers","following_url":"https://api.github.com/users/pglewis/following{/other_user}","gists_url":"https://api.github.com/users/pglewis/gists{/gist_id}","starred_url":"https://api.github.com/users/pglewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pglewis/subscriptions","organizations_url":"https://api.github.com/users/pglewis/orgs","repos_url":"https://api.github.com/users/pglewis/repos","events_url":"https://api.github.com/users/pglewis/events{/privacy}","received_events_url":"https://api.github.com/users/pglewis/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/pods-framework/pods/milestones/26","html_url":"https://github.com/pods-framework/pods/milestones/Pods%203.0%20-%20Holding","labels_url":"https://api.github.com/repos/pods-framework/pods/milestones/26/labels","id":239384,"number":26,"title":"Pods 3.0 - Holding","description":"","creator":{"login":"sc0ttkclark","id":709662,"avatar_url":"https://avatars.githubusercontent.com/u/709662?v=3","gravatar_id":"","url":"https://api.github.com/users/sc0ttkclark","html_url":"https://github.com/sc0ttkclark","followers_url":"https://api.github.com/users/sc0ttkclark/followers","following_url":"https://api.github.com/users/sc0ttkclark/following{/other_user}","gists_url":"https://api.github.com/users/sc0ttkclark/gists{/gist_id}","starred_url":"https://api.github.com/users/sc0ttkclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sc0ttkclark/subscriptions","organizations_url":"https://api.github.com/users/sc0ttkclark/orgs","repos_url":"https://api.github.com/users/sc0ttkclark/repos","events_url":"https://api.github.com/users/sc0ttkclark/events{/privacy}","received_events_url":"https://api.github.com/users/sc0ttkclark/received_events","type":"User","site_admin":false},"open_issues":84,"closed_issues":480,"state":"open","created_at":"2013-01-06T17:40:38Z","updated_at":"2016-02-03T05:08:41Z","due_on":null,"closed_at":null},"comments":22,"created_at":"2013-12-19T12:06:34Z","updated_at":"2016-02-14T19:17:56Z","closed_at":"2014-01-27T18:44:39Z","body":"In our project we have 28 advanced custom tables with Pods as database tables.\r\nThe relations between them are not so many but still the podsrel is about 700k rows big and slows everything down så that it is not possible to use the application.\r\nWhere to start? \r\n\r\n*edited to add the below by: @sc0ttkclark*\r\n\r\nBefore:\r\n\r\n* find() retrieves 846 items\r\n* fetch() loop outputs fields from item including 5 relationship fields\r\n* 4200+ potential select statements\r\n\r\nAfter optimization by @pglewis:\r\n\r\n* find() retrieves 846 items, using an optimized 'select' parameter for the 5 relationship fields needed in loop\r\n* fetch() loop outputs fields from item including 5 relationship fields based on the 'select' aliases from the optimized find() query"},"comment":{"url":"https://api.github.com/repos/pods-framework/pods/issues/comments/183957904","html_url":"https://github.com/pods-framework/pods/issues/1911#issuecomment-183957904","issue_url":"https://api.github.com/repos/pods-framework/pods/issues/1911","id":183957904,"user":{"login":"pglewis","id":1973916,"avatar_url":"https://avatars.githubusercontent.com/u/1973916?v=3","gravatar_id":"","url":"https://api.github.com/users/pglewis","html_url":"https://github.com/pglewis","followers_url":"https://api.github.com/users/pglewis/followers","following_url":"https://api.github.com/users/pglewis/following{/other_user}","gists_url":"https://api.github.com/users/pglewis/gists{/gist_id}","starred_url":"https://api.github.com/users/pglewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pglewis/subscriptions","organizations_url":"https://api.github.com/users/pglewis/orgs","repos_url":"https://api.github.com/users/pglewis/repos","events_url":"https://api.github.com/users/pglewis/events{/privacy}","received_events_url":"https://api.github.com/users/pglewis/received_events","type":"User","site_admin":false},"created_at":"2016-02-14T19:17:56Z","updated_at":"2016-02-14T19:17:56Z","body":"> My current query is checking the values of around 15 fields, some of which reside in various related pods. It's a particularly intensive find, and at the moment is causing me major performance issues.\r\n\r\nIf I understand: this is what we're out to solve.  Optimization works best by finding the exact bottlenecks for your case.  So let's start with the code you're running that is causing performance issues.  "}}