I have been using some join statements to get the data. But I wanted to use the Belongs:to , has-many , one-one, many to many Relation ships to reduce my query processing time.
So I have applied it and every thing is working fine.
I just want to print the query execution time on my screen using yii framework.
I just want to check the time taken by two queries.
A simple solution might be to set a variable with microtime() before execution, then after execution subtract that variable from the current microtime() to get the elapsed time ??
The yiidebugtb already logs the start time of the queries and some global statistics. With that I’ve already been able to identify slow queries or queries that could benefit from eager loading (with KeenActiveDataprovider).
I also log slow queries to the mysql log file ( a mysql log setting) to facillate slow query identification when in production.