H
H
HaruAtari2014-04-27 20:27:26
PostgreSQL
HaruAtari, 2014-04-27 20:27:26

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',
];

New config:
return [
  'class'    => 'yii\db\Connection',
  'dsn'      => 'pgsql:host=localhost;port=5432;dbname=dbName',
  'username' => 'user',
  'password' => 'pass',
  'charset'  => 'utf8',
];

Tell me what could be the problem? I have no idea where to look at all. I would be grateful for any thoughts.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander N++, 2014-04-27
@sanchezzzhak

Is alloying sql queries enabled in the framework?

Y
Yuri Morozov, 2014-04-27
@metamorph

and try enableSchemaCache and schemaCacheDuration to enable.

P
Papa, 2014-04-28
Stifflera @PapaStifflera

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.

V
Vitaly Voskobovich, 2016-03-13
@voskobovich

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 question

Ask a Question

731 491 924 answers to any question