Added a new table in db, stat_activity, which tracks all queries that get executed. Also added code to server which updates that table (it actually increases a value and stores the timestamp of that time).