Select * from `strapi_database_schema` order by `time` DESC limit 1 - ER_OUT_OF_SORTMEMORY: Out of sort memory, consider increasing server sort buffer size

System Information
  • Strapi Version: 4.1.5
  • Operating System: Linux
  • Database: MySQL 8
  • Node Version: 14.19.1
  • NPM Version: 6.14.16

Hi :slight_smile: ,

Since a few days I have a strange issue with strapi. When I try to start a production build I get the following error:

select * from strapi_database_schema order by time DESC limit 1 - ER_OUT_OF_SORTMEMORY: Out of sort memory, consider increasing server sort buffer size

I seems like that strapi tries to run a very heavy select statement on start but why? I tried to connect with a fresh strapi project and it worked without any issue. It seems like that strapi has an issue with specific single/collection types but couldnt figure out why. I also try the statement in mysql workbench but same issue. So has anyone an idea why this is suddenly happening or has anyone a similiar issue?

My Database specs:

  • Digital Ocean Managed MySQL 8 Database
  • 1 vCPU
  • 2 GB Ram
  • 25 GB SSD

This issue only happens after a second deploy. So the first deployment works without any issues. But when I redeploy a second version then this issue is thrown.


3 Likes

If you look into that table you’ll find only one record there, not heavy at all.
the issue is strapi didn’t index their sorting column time, adding a simple index would fix it.

1 Like

Thank you for this.