How to get infos about pending postgres db restart programmatically

Björn Pohl 1 Reputation point
2021-02-12T10:07:57.897+00:00

Hi,
in Azure PostgreSQL, when changing some server params, the Server requires a restart and denotes this on the Server Parameters page.
Is there any way to find about a pending restart programmatically? az postgres server show or config show displays nothing about that pending restart.

Reason:
We're deploying those Servers using ARM Templates and cli/ps. On first deployment, we need to tweak the shared_preload_libraries config (which requires a restart).
Since we're doing idempotent deployments, we're deploying these templates over and over, so the restart might only be needed on the first deployment, and of course we cannot just restart the server at every deployment.

I don't want to track state of all these config changes just to trigger that restart . Some of those params do not require a restart.

any idea?

regards,
Bjoern

Azure Database for PostgreSQL
{count} votes

1 answer

Sort by: Most helpful
  1. Anurag Sharma 17,581 Reputation points
    2021-02-15T05:23:04.6+00:00

    Hi @Björn Pohl , welcome to Microsoft Q&A forum.

    As we already know there are few parameters that need restart of server, so we can prepare a query like below and fire whenever we need to check if restart is needed on the server or not:

    select pending_restart from pg_settings where name = 'track_commit_timestamp';  
    

    67987-image.png

    Here I changed the parameter 'track_commit_timestamp' and if the query returns 't'(true), a restart is needed.

    After restart:

    67997-image.png

    We can club multiple parameters in 'in clause' and use the same accordingly.

    Please let us know if this helps.

    ----------

    If answer helps, please mark it 'Accept Answer'

    0 comments No comments