Change query for jobs list for more performance

The big group by clause at the end of query turned out to be a major
performance problem on postgresql.
This version gets the task counts for all jobs in four temporary tables
first, the left-outer-joins those tables.
Fix sorting by task counts
Merge pull request #228 from guidow/optimize_jobs_list

Optimize jobs list