Answer the question
In order to leave comments, you need to log in
After switching to Yii2, the database sank a lot?
There was a small personal project. Spinning on Yii 1.1.14. The Yii2 beta has just been released.
Moved the code base to it. At the same time, the logic of the application almost did not change.
I noticed that the base sank very much. Requests began to be executed 3-4 times longer. Logs are silent, stupidly the request is executed longer.
Base - postgres 9.1
Old config:
return [
'connectionString' => 'pgsql:host=localhost;port=5432;dbname=dbName',
'username' => 'user',
'password' => 'pass',
];
return [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:host=localhost;port=5432;dbname=dbName',
'username' => 'user',
'password' => 'pass',
'charset' => 'utf8',
];
Answer the question
In order to leave comments, you need to log in
1. Update PostgreSQL to the latest version (now 9.3).
2. Set up Postgres. Although, I don't remember cases when there was a performance drawdown after the transition from a crooked MySQL to Postgres. Always exactly the opposite. Accordingly, adjust the postgres configuration for your hardware. There are special scripts for this - search in Google.
3. Set up query profiling. If referential integrity is used, then check for indexes on fields that are links to other tables. Postgres itself does not build indexes for such fields.
If the application used eager loading and, due to it, data retrieval from the database was accelerated, then it is worth considering that in Yii2 the logic is completely different in this regard.
Yii1 used JOINs, but Yii2 doesn't, and eager loading can even make things worse in some cases. It is better to read www.yiiframework.com/doc-2.0/guide-db-active-recor...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question