i have a mysql connection using clud sql from Googlle cloud platform that i am using in my php(codeigneiter) application and i connect through cloud sql proxy. this instance has the following resources : 4 vcpu and 16 RAM.
the problem i have is that doing a querys speed test i have noticed that it is slow, i am comparing it with a machine with the same resources and local mysql and the speed is higher.
mysql proxy sql : 11 seconds
mysql local : 1.5 seconds as you can see, the problem is the sql proxy.
this is the code of the test that I am doing
Translated with www.DeepL.com/Translator (free version)
public function testSQL()
{
$time_start = microtime(true);
for ($i=0; $i < 10000; $i++) {
$sql = "SELECT * FROM test";
$sqlResult = $this->db->query($sql)->result_array();
}
$time_end = microtime(true);
$time = $time_end - $time_start;
echo $time;
}
note that the version of php is 7.2 and the version of mysql in the instance and in mysql local is 8