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. 
@adamrp, roger that. We may want a procedure for other bottlenecks like
this that actually require some logic?

On (Nov-24-14| 9:36), adamrp wrote:
> > +            "qiita.study_users.study_id = qiita.study.study_id)), ',') AS "
> > +            "shared_with, count(raw_data_id), (SELECT qiita.study_person.name "
> > +            "|| '&' || qiita.study_person.email FROM qiita.study_person WHERE "
> > +            "qiita.study_person.study_person_id = "
> > +            "qiita.study.principal_investigator_id) AS pi, array_to_string("
> > +            "array(SELECT qiita.study_pmid.pmid FROM qiita.study_pmid WHERE "
> > +            "qiita.study_pmid.study_id = qiita.study.study_id), ',') AS "
> > +            "pmid, (SELECT qiita.qiita_user.name || '&' || "
> > +            "qiita.qiita_user.email FROM qiita.qiita_user WHERE "
> > +            "qiita.qiita_user.email = qiita.study.email), (SELECT "
> > +            "qiita.study_status.status FROM qiita.study_status WHERE "
> > +            "qiita.study_status.study_status_id = "
> > +            "qiita.study.study_status_id) FROM qiita.study LEFT JOIN "
> > +            "qiita.study_raw_data ON qiita.study.study_id = "
> > +            "qiita.study_raw_data.study_id WHERE email = %s GROUP BY "
> > +            "qiita.study.study_id ORDER BY qiita.study.study_id")
> 
> @ElDeveloper I don't think this makes sense as a procedure.  Typically, procedures are performing some logic, whereas this is just a few `SELECT` statements. Also, we have been doing most/all of our logic in Python, so I'm not sure when we will need/want to make procedures out of certain tasks.
> 
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/biocore/qiita/pull/679/files#r20806673