How do I use profiling to find execution time for both SQL and MongoDB query in PHP? -
i'm new php , don't know how use profiling execution time of following queries. mongodb query:
$collection = new mongocollection($db,'customers'); $cursor = $collection->find(['customer_id' => intval($id)]);
sql query:
$s = oci_parse($c, 'select customer_id customers customer_id = :un_bv '); oci_bind_by_name($s, ":un_bv", $_post['customer_id']); oci_execute($s);
i tried following code mongodb query print lot of things of know nothing.
$db->setprofilinglevel(2); $cursor = $collection->find(['customer_id' => intval($id)]); $response = $db->system->profile->find(); foreach($response $obj) { print_r($obj); }
help me on how use profiling execution time only.
in general can use microtime() in php test execution time of piece of code, in case 2 queries.
Comments
Post a Comment