Why Yii First Run Sql Need 10S

run this my pc need 1s not sql used,It’s Yii code need 1s。

test server need 0.02~10s too slowly.


Hospital::model()->findByPk($hid);

I find this

framework/base/CModule.php

public function getComponent($id,$createIfNull=true)

{

$component->init();// if $id is ‘db’ run this use 1~10s

}

is This a bug?

Is there a faster way?

I don’t think so. I would take a look at your setup to try to find any hick-ups in there. You could try adding a ‘iniSQLs’ parameter to your db-configuration:




...

'initSQLs' => array("set time_zone='+00:00';"),

...



Though this is only a work-around.