Status update:
* Daniel triggered a "Phabricator monthly statistics" test email to my account last week.
* For unknown reasons (those SQL queries work locally, maybe the  //cut -d " " -f3// in the script itself but hard to imagine), the following two values in that email are just empty: 
** Number of tasks created in (2014-11): 
** Number of open and stalled tasks in total: 
* Daniel had to kill the queries I had pasted above under //Median age of open tasks by priority// as they have a horrible runtime. Yesterday I created 2500 tasks in local Phab instance and it already took 50-75sec so I stole [[ http://stackoverflow.com/questions/1291152/simple-way-to-calculate-median-with-mysql/7263925#7263925 | a better query from stackoverflow ]]. Output difference is small enough as we're talking about days here. Comparison below.
** Output isn't an integer though, hence the //epochnow-mediantasksopen_needsvolunteer_epoch// part in https://gerrit.wikimedia.org/r/#/c/177792/7/modules/phabricator/templates/community_metrics.sh.erb to calculate the delta between current time and the output value might bark if it expects integers? Don't know, didn't have time to test with an actual similar shell script yet and my bash script times are long ago.
```
MariaDB [phabricator_maniphest]> SELECT x.dateCreated from maniphest_task x, maniphest_task y WHERE (x.priority = "80" AND x.status = "open") GROUP BY x.dateCreated HAVING SUM(SIGN(1-SIGN(CAST(y.dateCreated AS SIGNED)-CAST(x.dateCreated AS SIGNED))))/COUNT(*) > .5 LIMIT 1;                           +-------------+
| dateCreated |
+-------------+
|  1418715703 |
+-------------+
1 row in set (59.33 sec)

MariaDB [phabricator_maniphest]> SELECT avg(t1.dateCreated) as median_val FROM (SELECT @rownum:=@rownum+1 as `row_number`, d.dateCreated FROM maniphest_task d, (SELECT @rownum:=0) r WHERE (d.priority = "80" AND d.status = "open") ORDER BY d.dateCreated) as t1, (SELECT COUNT(*) AS total_rows FROM maniphest_task d WHERE (d.priority = "80" AND d.status = "open")) as t2 WHERE 1 AND t1.row_number IN ( floor((total_rows+1)/2), floor((total_rows+2)/2));
+-----------------+
| median_val      |
+-----------------+
| 1418715752.0000 |
+-----------------+
1 row in set (0.24 sec)
```