37
Views
6
Comments
Solved
How many external database connections does a timer consume?

Imagine that I have a timer with 3 queries to an external database, how many connections will it consume? Is it one per timer or one per query?

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution
2023-02-01 09-55-42
Otávio Souza
Staff

Hey Robson, 
I'm not 100% sure (I can try to find an answer for that), but one question before: do you have admin access to the external database? You can check it in the dictionaries, right (something like v$_sessions for Oracle)? 


Also, is it for a corporate project? Is it affecting your project or only curiosity from you? 

UserImage.jpg
Robson Arruda

This is a connection that uses a user with read and write permissions.

 It's for a corporate project. I will explain in more detail.

We have an app that has 5 timers that run every 5 minutes. In each of them, at least 2 queries to an external database are executed (read and write permission).

The problem:

There is a connection limitation with the database, so if I "use" it a lot I reach the limit.

The question is:

When the 5 timers run, are 5 different connections opened (one for each timer)? Or will a connection be opened for each query (if each timer has at least 2, there would be 10 connections)?

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi,

All about number of database connections is documented by OutSystems here:

https://success.outsystems.com/support/enterprise_customers/maintenance_and_operations/connection_pools_in_the_outsystems_platform/

Regards,

Daniel

2025-09-29 11-10-28
José Alexandre dos Santos

Hi guys,


Since each query to an external database has his own transaction, I would bet my coins that you'll consume a database connection for each query, that is created to receive and response data, then closes the connection, and repeat the process for each query.

Although this depends on external BD engine configurations, I guess this is the default behaviour of most of the cases, and in my opinion, by far, the best approach, open connection, serve request and then close it, to avoid leaving connections opened for no reason, security, resource consumption, etc etc.


Hope it helps.


Cheers, have fun coding.

JAS

2022-09-05 11-03-57
Sérgio Miranda
Staff

Hello José,
As mentioned in the documentation shared by Daniel, connections are managed in pools. So when a connection is required for a transaction, one is obtained from the connection pool if a one that is free exists and if unavailable the number of connections in the pool is increased (up to  a maximum of 100 by default) and the new one is used. When the transaction is finished the connection is not closed, it is returned to the pool of connection and is available to be used again. This is to avoid the performance impact of constantly opening and closing connections.
Connections in the pool can be closed after some time without being used.

UserImage.jpg
Robson Arruda

Olá pessoal! 

Muito obrigado pelas respostas, acredito que ajudaram muito em minhas pesquisas e dúvidas. Só para ressaltar que a documentação fornecida pela Outystems contribuiu muito. 

Mais uma vez obrigado a todos!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.