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.

see: http://php.net/manual/en/function.microtime.php


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -