Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Van4kk's avatar

Van4kk liked a comment+100 XP

3w ago

Poor performances when migrating from SQLite to Postgresql

I solved my issue. I made a test with MySQL, which highlighted some issues in a couple migrations files. Postgresql didn't mention anything, but i think it's the reason why the engine was stalling.

  $table->unsignedBigInteger('created_by')->nullable();
  $table->foreign('created_by')->references('id')->on('users')->onDelete('set null');

In my "media" table (used everywhere) I had a "onDelete('set null')" reference on the users table, but the field was not nullable. I had the same issues in a couple of other migration files.

While I will stick with MySQL, performances seem to have greatly improved with postgresql as well, following that change, whether local or remote. I still find it much slower than mysql though, in a noticeable but acceptable way.

Thank you again for your help, @martinbean!