Fix `thd->utime_before_query == 0` assert

* Disable assert for subqueries
* Do not collect any data in a slave thread
WIP: Write data to optimizer_cost_factors table