# Best Practice: Multiple DB Connections vs. Single Connection for multiple MySQL schemas?

**URL:** <https://forum.inductiveautomation.com/t/best-practice-multiple-db-connections-vs-single-connection-for-multiple-mysql-schemas/115335>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [April 30, 2026, 3:47pm UTC](https://forum.inductiveautomation.com/t/best-practice-multiple-db-connections-vs-single-connection-for-multiple-mysql-schemas/115335 "2026-04-30T15:47:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [April 30, 2026, 3:47pm UTC](https://forum.inductiveautomation.com/t/best-practice-multiple-db-connections-vs-single-connection-for-multiple-mysql-schemas/115335/1 "2026-04-30T15:47:13Z")

</div>

Hi,

I am currently working on an Ignition 8.1.42 project and I have a question regarding database architecture best practices.

I have multiple databases (schemas) hosted on the same MySQL instance. I am wondering which approach is more efficient and performant:

1. **Single Gateway Connection:** Create one Database Connection in the Gateway and use dot notation in my queries (e.g., `SELECT * FROM other_db.table`).

2. **Multiple Gateway Connections:** Create a dedicated Database Connection for each schema.

My main concerns are resource management (connection pooling), ease of maintenance, and overall Gateway performance. Are there specific scenarios where one approach is significantly better than the other in Ignition?

Thanks

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [April 30, 2026, 4:30pm UTC](https://forum.inductiveautomation.com/t/best-practice-multiple-db-connections-vs-single-connection-for-multiple-mysql-schemas/115335/2 "2026-04-30T16:30:45Z")

</div>

If you have different connections for different schemas, then you can also have different users for each connection and all those users can have the corresponding schema as their default. This way you can use a single query that is schema agnostic and reuse it across all your schemas with the only difference being the DB Connection used. This would benefit you if your different schemas have the same DB table structure etc.

---

<div class="post-metadata">

**Author:** ![lane.duncan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lane.duncan/32/83700_2.png) [@lane.duncan](https://forum.inductiveautomation.com/u/lane.duncan)\
**Post date:** [May 2, 2026, 6:13am UTC](https://forum.inductiveautomation.com/t/best-practice-multiple-db-connections-vs-single-connection-for-multiple-mysql-schemas/115335/3 "2026-05-02T06:13:49Z")

</div>

If there will ever be a reason to join the individual schemas in a query then you will for sure want a single connection.

If there is an excessive amount of schemas in comparison to the size of the system (clients with active queries) I would use a single connection.

Otherwise it’s really just an issue of how to best build efficient queries without doing the same work for each schema.

---

<div class="post-metadata">

**Author:** ![bobby.miller](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bobby.miller/32/85153_2.png) [@bobby.miller](https://forum.inductiveautomation.com/u/bobby.miller)\
**Post date:** [May 2, 2026, 11:46am UTC](https://forum.inductiveautomation.com/t/best-practice-multiple-db-connections-vs-single-connection-for-multiple-mysql-schemas/115335/4 "2026-05-02T11:46:35Z")

</div>

Keep the relationships coupled. If you're going to join across schemas, those should be shared. If the data is unrelated, separate them.

---

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [May 4, 2026, 7:06am UTC](https://forum.inductiveautomation.com/t/best-practice-multiple-db-connections-vs-single-connection-for-multiple-mysql-schemas/115335/5 "2026-05-04T07:06:15Z")

</div>

Thanks,

DB structures and queries are the same for each schema. They work with the same Ignition project. I have one schema by default and I use others connections in my queries according to the connected user.
