I was doing a simple query using explain to know precisely the execution time.
$this->db->toto->find($req)->sort(array('date' => 1))->explain();
I now want to use explain on a map and reduce query, how to do that ?
Should I use the ‘classic’ profiling system?
I’m trying to compare the execution time of theses 2 queries.
ex:
$res = $this->db->command(array(
"mapreduce" => "toto",
"map" => $map,
"reduce" => $reduce,
"finalize" => $finalize,
"query" => $req,
"out" => array("inline"=>1)
))->explain();
Doesn’t work because command return an array (explain need a MongoCursor).
Thanks you a lot 🙂
Explain won’t work on a command like map/reduce. The beat you can do is run explain on the query you’re using.
If you just need execution time, you can run the m/r and time it. That’s how explain determines the execution time.