Есть класс
Код: Выделить всё
class OppCallBacks extends \yii\db\ActiveRecord
{
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => new Expression('NOW()'),
],
];
}
/**
* @inheritdoc
*/
public static function tableName()
{
return 'opp_callbacks';
}
public static function getDb()
{
return Yii::$app->get('dbspkhpg02');
}
}
Код: Выделить всё
namespace app\commands;
use yii\helpers\ArrayHelper;
use app\modules\Pers\models\OppCallBacks;
use app\modules\Pers\models\OppPhones;
use app\modules\Pers\models\OppExtPhones;
use app\modules\Pers\models\OppGroups;
use app\modules\Pers\models\OppPhoneToGroup;
use app\modules\Pers\models\PersCdrPgSearch;
class OppController extends \yii\console\Controller
{
public function actionAllocatemisscalls()
{
$res = OppCallBacks::find()->select('id_call')->orderBy('id_call DESC')->one();
return;
}
}
time ./yii opp/allocatemisscalls
real 0m16.047s
user 0m0.842s
sys 0m0.486s
Приложение с одним запросов к БД выполняется 16 сек. Делаю этот же запрос из клиента postgres выполняется моментально
Что не так ? Почему так тормозит ?
Centos 7 , PHP 7.0.27