Use multiple database connections
D W
In certain use cases, we need to connect to two different databases or to two different schemas in the same database. This allows users to keep functional components separate. I understand that this is not possible to represent in content builder, but this functionality doesn't need to be viewed on the Strapi admin UI, it can exist as it did in V3 of Strapi.
An example is when you have the main database/schema for business logic, user data and functionality related data. Strapi has complete visibility over this (including in content builder).
Another database/schema can be used to view analytics. This analytics db/schema can have dimensional data and can follow a star schema structure where analytics and business intelligence can be best presented. the dimensional tables can exist without representation in Strapi Admin UI, but users can write data to the fact table/tables via the second connection.
Strapi V3 had this feature.
V
Vladyslav Shestakov
Highly needed feature, for perfomance and stability for growing projects, to avoid downtimes & laggies when a really huge traffic comes in
Stan
Another use case is to store archived records in separate DB, and use main DB only for active records. When sqlite has more than 200K 500K 1M rows the overall performance declines. With a few DB app can move data around with custom logic.
There are also other use cases for backend to have a few db connections.
P
Paolo 0166
A possible scenario where you might need to use different databases with the same strapi server is when you don’t have too many hardware resources on the virtual private server.
A client app that sends the client identifier to be used. Different client identifier, different schemas on the db to access.
A client app, a unique server but many db schemes.
Simple and efficient for those cases where there are not too many users per client application using, for example, the 3rd domain level part of the window.origin as customer identifier.