Important Consideration: Custom Index Support in Strapi
Before adopting Strapi for production use, it’s essential to understand a critical limitation: Strapi does not natively support custom indexes. This has been a long-standing issue and, unfortunately, it has not yet been addressed or prioritized in their official roadmap.
This limitation may not be immediately apparent during early development, as performance typically remains acceptable with smaller datasets. However, as your application scales and the volume of data grows, you may begin to experience significant performance degradation—particularly with queries that would otherwise benefit from proper indexing.
While it is technically possible to manually create indexes directly in the database, Strapi will remove these custom indexes during schema updates or content type modifications. Developers often work around this by programmatically re-creating indexes via SQL queries after each schema change. However, this approach introduces startup delays, especially when dealing with large datasets, as index creation can be a resource-intensive operation.
In short:
- Strapi will not preserve manually added indexes.
- There is no official or supported mechanism to define and maintain indexes within Strapi.
- Re-creating indexes at runtime can lead to long startup times and heavy compute costs.