WIP: optimization on displaying studies list

I got really tired of how slow is the studies display when having so many studies so I started working on https://github.com/biocore/qiita/issues/601. This is the initial optimization of /private/. I want to have some feedback before working on the others. 
Has the query execution plan been evaluated? This is quite complex. If the decision is to keep this query, can you please format it for human readability?