different apps with different user credentials to db

I am looking for information on how to optimize connections to mysql. I have a mysql server with max connection per user set to 10. One way to optimize code is makes fewer queries ex. Combining queries. Is it possible to make each application in the project connect to the same database but with a different user? For example, the shop application logs into the db as a shop and the warehouse application as a warehouse, but both applications modify the same database/data. This would increase the limit for the project :-).

A connection is a connection is a connection.

Operationally, it doesn’t matter whether you have 100 connections by the same user id or 10 connections each with 10 different ids.

You’re going to be a lot better off changing the database connection limit for your Django account in the database than the work you would create by trying to manage different accounts within the application.

But one of your first steps should be to monitor your database and identify how many connections are concurrently being used by your application.

Well I think it’s make the different example:
example faq

I collect info about future task and I don’t have idea if the project will scale to the limits. Project will’be installed on outside hosting server so I don’t have any rights to change this restriction.
I consider split data and use django multiple database setup for lower risk and specialize db users but this is not so simple to split it right :slight_smile:

Ok I read doc and see first minus

Django doesn’t currently provide any support for foreign key or many-to-many relationships spanning multiple databases"

If that’s going to be an issue, then you really should find a different database provider.

Yes, I understand you’re working under certain constraints. However, whoever is requiring those constraints also needs to understand the implications of them.

Aside from that, your best option may be something along the lines of a “custom db pool”, one that can maintain connection pools using multiple accounts. (I’m not specifically aware of any such for MySQL, but that doesn’t mean that something like that doesn’t already exist.)

That’s a specious argument at best, and simply wrong at worst. By adding extra unnecessary components you’re actually increasing risk along with the additional complexity of the environment.

Yes, sometimes that’s necessary and appropriate at scale, but you’re not showing anything here that would lead me to believe you’re anywhere close to that point.

KenWhitesell thanks for your advice as always good and quick help. I warned about the problems related to hosting. It’s always worth asking :slight_smile: . I agree that multiple database is a bad idea. The more I think about it, the more I am convinced that it will be more trouble than good. Custom db pool it interesting :ok_hand: