Hi @Martin Gubis,
I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!
Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.
Issue :
While running Azure Database for PostgreSQL - Flexible Server, the metrics show that the system is not under heavy load, memory is at 60% and CPU is at 12%. The database is unavailable, and this issue is recorded twice daily in the Activity log of the Resource as Health event. The issue occurs for a few minutes and disrupts all requests in an application.
Solution :
The issue was caused by excessive memory consumption. When too many connections were made to the database, it overwhelmed a service responsible for managing connections not the database server itself. To resolve this, upgrade the memory accordingly and limit the number of connections from the application server.
Please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.