I have a database wrapper class for MySQL which allow one query per call currently. I want to extend my database wrapper's support for processing multiple queries at once. It is clear for me that if I use the multi-query feature then I can reduce the server-server communication but I don't know enough what happens inside the MySQL server. Is there a significant overhead in the processing if I send a lot of single queries one by one as multi-queries?
There is a lot of projects depends on the wrapper already and don't want to lower their performance, so if there is any reason why I should not do this, I will realize as a separate feature of the wrapper.
This is my planned solution:
<?php
class MySQLWrapper extends AWrapper{
public function query($query){
return $this->multiQuery([$query])[0];
}
public function multiQuery(array $queries){
return $this->doMultiQueryMagic($queries);
}
}
Or should I change the return $this->multiQuery([$query])[0];
line to return $this->doSingleQueryMagic($query);
?