Thanks for the database dump. Below is a rundown of benchmarking against the database to test the queries that will allow integration into the Missing Maps stats API.
As far as we can tell, the most efficient way to grab this information would be to pull all the relevant records from the task_state table.
Right now we're grabbing the stats we need by user (instead of by project) through the following query:
SELECT user_id, project_id, state, date FROM task_state WHERE user_id IS NOT NULL AND state IN (1, 2, 3)
Benchmarks
Based on my tests, the database query itself seems to take around 1.0045 seconds on a midrange Macbook Pro. Then processing into an object for the API takes another 0.434 seconds (total of (1.438 seconds), and finally running jsonify to serve it takes another 3.404 (total of 4.842).
Next Steps
Based on these results, couple questions:
If running this every 5-10 mins, do you see this as an impact on the system?
If it can stay around a total of ~5secs to process everytime, do we want to just proceed with running this in the short term as a scheduled task outside of Tasking Manager? In the longer term it seems like if robust API access is interesting, a refactor of the database would enable better integration of per user stats.
@dodobas --
Thanks for the database dump. Below is a rundown of benchmarking against the database to test the queries that will allow integration into the Missing Maps stats API.
As far as we can tell, the most efficient way to grab this information would be to pull all the relevant records from the task_state table.
Right now we're grabbing the stats we need by user (instead of by project) through the following query:
Benchmarks
Based on my tests, the database query itself seems to take around 1.0045 seconds on a midrange Macbook Pro. Then processing into an object for the API takes another 0.434 seconds (total of (1.438 seconds), and finally running jsonify to serve it takes another 3.404 (total of 4.842).
Next Steps
Based on these results, couple questions:
cc @kamicut @smit1678