Azure pgSQL Server restart takes too long time

Tamás Rózsa 65 Reputation points
2025-06-06T07:41:02.53+00:00

Our production pgSQL Server has been restarted because of a server parameter update (max connection has been increased). Deployment of parameter update was successfull and the automatic server restart has been started, which already takes an hour. Please help and check if the restart process is stucked or is it normal that it takes so much time.

Every application using the DB has been stopped. Storage is 30%. Long time queries were not checked before the restart.

Azure Database for PostgreSQL
{count} votes

Accepted answer
  1. Saraswathi Devadula 5,485 Reputation points Microsoft External Staff Moderator
    2025-06-09T11:55:31.84+00:00

    Hello Tamás Rózsa

    Glad that your server is back to online. Regarding the max connection parameter, below is the update from the team.

    The team managed to set the server parameters values around approximately 2025-06-06 22:40 PM UTC. And following are few more suggestions from our side,

    Understanding the Parameters:

    max_connections: Determines the maximum number of concurrent connections to the database. Each connection consumes memory for backend processes and shared memory for locks and buffers.

    max_locks_per_transaction: Specifies the average number of object locks allocated per transaction. Each lock consumes shared memory.

    Recommendations on next steps:

    We want you to suggest that setting the server parameters to very higher values and restarting the server will mostly cause issues regarding the server being stuck in restarting state because at the backend, these might be facing memory issues. And trying with somewhat lower values wouldn’t face issues with the server restart. It would always complete as expected.

    “One more question: do you know any method in pg to see historically (last 12 or 24 hours) which SQL command how many locks required? In the pg_locks I can count only the active locks and even the pg explain analyse does not calculate the number of requested locks.”

    Azure PostgreSQL flexible server Offers a query Store feature that capture a history of queries and runtime statistics , including wait statistics. This can help identify queries that experience locs waits over time. Query store - Azure Database for PostgreSQL flexible server | Microsoft Learn

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.