<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks Chris, this helps a lot. I've updated the bug report for anyone else following along.<div><br></div><div>Sam</div><div><br></div><div><br><div><div><div>On 27/02/2013, at 5:45 AM, Chris Behrens <<a href="mailto:cbehrens@codestud.com">cbehrens@codestud.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>I am not understanding why there are secondary joins defined in the models.  I suspect this might break other things, but maybe you can test that this at least makes the scheduling faster:</div><div><br></div><div><a href="http://paste.openstack.org/show/32534/">http://paste.openstack.org/show/32534/</a></div><div><br></div><div>That seems to generate a much more acceptable query.</div><div><br></div><div>- Chris</div><div><br></div><br><div><div>On Feb 25, 2013, at 9:40 PM, Sam Morrison <<a href="mailto:sorrison@gmail.com">sorrison@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>On 26/02/2013, at 4:31 PM, Chris Behrens <<a href="mailto:cbehrens@codestud.com">cbehrens@codestud.com</a>> wrote:<br><br><blockquote type="cite">After thinking more, it does seem like we're doing something wrong if the query itself is returning 300k rows. :)  I can take a better look at it in front of the computer later if no one beats me to it.<br></blockquote><br>Yeah I think it's more than a missing index :-)<br><br>The query does 2 INNER JOINS on aggregate_hosts then 2 INNER JOINS on aggregate_metadata then does a further 2 LEFT OUTER JOINS on aggregate_hosts.<br>Thanks for the help,<br>Sam</blockquote></div><br></div></blockquote></div><br></div></div></body></html>