Configure server parameters in Azure Database for PostgreSQL - Flexible Server
APPLIES TO: Azure Database for PostgreSQL - Flexible Server
You can list, show, and update configuration parameters for an Azure Database for PostgreSQL flexible server instance.
Parameter customization
Various methods and levels are available to customize your parameters according to your specific needs.
Global level
For viewing current configured values for server parameters or for altering them globally at the instance or server level, you can use the Server parameters page in the Azure portal. You can also interact with server parameters globally by using the CLI, the REST API, Azure Resource Manager templates, or third-party IaC tools.
Note
Because Azure Database for PostgreSQL is a managed database service, users don't have host or operating system access to view or modify configuration files such as postgresql.conf. The content of the files is automatically updated based on parameter changes that you make.
In this same article you can find sections to interact with server parameters globally to:
- List all server parameters.
- List server parameters with modified defaults.
- List read-write static server parameters.
- List read-write dynamic server parameters.
- List read-only server parameters.
- Set the value of one or more server parameters.
- Revert one server parameter to its default.
- Revert all server parameter to their defaults.
Granular levels
You can adjust parameters at more granular levels. These adjustments override globally set values. Their scope and duration depend on the level at which you make them:
Database level: Use the
ALTER DATABASE
command for database-specific configurations.Role or user level: Use the
ALTER USER
command for user-centric settings.Function, procedure level: When you're defining a function or procedure, you can specify or alter the configuration parameters that are used when the function is called.
Table level: As an example, you can modify parameters related to autovacuum at this level.
Session level: For the life of an individual database session, you can adjust specific parameters. PostgreSQL facilitates this adjustment with the following SQL commands:
- Use the
SET
command to make session-specific adjustments. These changes serve as the default settings during the current session. Access to these changes might require specificSET
privileges, and the limitations for modifiable and read-only parameters described earlier don't apply. The corresponding SQL function isset_config(setting_name, new_value, is_local)
. - Use the
SHOW
command to examine existing parameter settings. Its SQL function equivalent iscurrent_setting(setting_name text)
.
- Use the
List all server parameters
Using the Azure portal:
Select your Azure Database for PostgreSQL flexible server instance.
In the resource menu, under the Settings section, select Server parameters. The page shows a list of parameters, their configured values, optional units, whether they're read-only/dynamic/static, and their descriptions.
Select or hover over the i (information) icon, to see the allowed values to which each parameter can be set to. Depending on the data type of the parameter, which can be string, enumeration, integer, boolean, numeric, set, the allowed values vary. And it can be regular expression, list of values, range of integers, on/off, range of decimals, list of values, respectively.
The list of server parameters supported by the instance consists of several hundred items, which are rendered in pages of 20 items each. At the bottom of the page, there's a control to inform you of the position you're at. There's also a paging control which you can use to navigate through the whole set of pages.
If needed, use the Search to filter items... text box to narrow down the list to those parameters containing the search term in their name or in their description.
The Parameter type column can show any of the following values for each parameter:
Parameter type | Description |
---|---|
Static | Requires a server restart to make the change effective. |
Dynamic | Can be altered without the need to restart the server instance. However, changes will apply only to new connections established after the modification. |
Read-only | Isn't user configurable, because of their critical role in maintaining reliability, security, or other operational aspects of the service. |
List server parameters with modified defaults
Using the Azure portal:
List read-write static server parameters
Using the Azure portal:
Select your Azure Database for PostgreSQL flexible server instance.
In the resource menu, under the Settings section, select Server parameters, and then select the Static tab. The page shows a list of read-write parameters for which, if their value is changed, require a restart of the server for the new value to take effect.
List read-write dynamic server parameters
Using the Azure portal:
Select your Azure Database for PostgreSQL flexible server instance.
In the resource menu, under the Settings section, select Server parameters, and then select the Dynamic tab. The page shows a list of read-write parameters for which, if their value is changed, require a restart of the server for the new value to take effect.
List read-only server parameters
Using the Azure portal:
Set the value of one or more server parameters
Using the Azure portal:
Select your Azure Database for PostgreSQL flexible server instance.
In the resource menu, under the Settings section, select Server parameters.
Locate the read-write parameters whose current values you want to change, set them to the new desired values, notice that an informational message indicates how many server parameter changes aren't saved yet, and select Save.
If the column Parameter type for any of the parameters changed is equal to Static, the server requires a restart for the changes to take effect. In that case, a dialog pops up so that you can select if you want to:
- Save and Restart: In case you want to persist all changes made to all parameters whose values were modified, and immediately after restart the server for any changes to static parameters to take effect.
- Save only: In case you want to persist all changes made to all parameters whose set values changed, but want to defer the server restart to a later time. Until you don't complete the server restart action, changes made to any static server parameters don't take effect.
- Cancel: To not implement any changes yet.
Revert one server parameter to its default
Using the Azure portal:
Select your Azure Database for PostgreSQL flexible server instance.
In the resource menu, under the Settings section, select Server parameters.
Locate the read-write parameter whose current value you want to revert to its default, select the ellipsis at the right end side of the scree, and select Reset to default.
Important
For parameters designated as read-only, selecting the ellipsis doesn't pop up the Reset to default menu option.
If the column Parameter type for the parameter you're trying to reset to default is equal to Static, the server requires a restart for the change to take effect. In that case, a dialog pops up so that you can select if you want to:
- Save and Restart: In case you want to persist all changes made to all parameters whose values were modified, and immediately after restart the server for any changes to static parameters to take effect.
- Save only: In case you want to persist all changes made to all parameters whose set values changed, but want to defer the server restart to a later time. Until you don't complete the server restart action, changes made to any static server parameters don't take effect.
- Cancel: To not implement any changes yet.
Revert all server parameters to their defaults
Using the Azure portal:
Select your Azure Database for PostgreSQL flexible server instance.
In the resource menu, under the Settings section, select Server parameters.
Select Reset all to default.
If, for any of the parameters whose current value doesn't match their default, the column Parameter type is equal to Static, the server requires a restart for the change to take effect. In that case, a dialog pops up so that you can select if you want to:
- Save and Restart: In case you want to persist all changes made to all parameters whose values were modified, and immediately after restart the server for any changes to static parameters to take effect.
- Save only: In case you want to persist all changes made to all parameters whose set values changed, but want to defer the server restart to a later time. Until you don't complete the server restart action, changes made to any static server parameters don't take effect.
- Cancel: To not implement any changes yet.
Working with time zone parameters
If you plan to work with date and time data in PostgreSQL, make sure that you set the correct time zone for your location. All timezone-aware dates and times are stored internally in PostgreSQL in UTC. They're converted to local time in the zone specified by the TimeZone server parameter before being displayed to the client. This parameter can be edited on Server parameters page. PostgreSQL allows you to specify time zones in three different forms:
A full time zone name, for example America/New_York. The recognized time zone names are listed in the pg_timezone_names view.
Example to query this view in psql and get list of time zone names:select name FROM pg_timezone_names LIMIT 20;
You should see result set like:
name ----------------------- GMT0 Iceland Factory NZ-CHAT America/Panama America/Fort_Nelson America/Pangnirtung America/Belem America/Coral_Harbour America/Guayaquil America/Marigot America/Barbados America/Porto_Velho America/Bogota America/Menominee America/Martinique America/Asuncion America/Toronto America/Tortola America/Managua (20 rows)
A time zone abbreviation, for example PST. Such a specification merely defines a particular offset from UTC, in contrast to full time zone names which can imply a set of daylight savings transition-date rules as well. The recognized abbreviations are listed in the pg_timezone_abbrevs view Example to query this view in psql and get list of time zone abbreviations:
select abbrev from pg_timezone_abbrevs limit 20;
You should see result set like:
abbrev| ------+ ACDT | ACSST | ACST | ACT | ACWST | ADT | AEDT | AESST | AEST | AFT | AKDT | AKST | ALMST | ALMT | AMST | AMT | ANAST | ANAT | ARST | ART |
In addition to the timezone names and abbreviations, PostgreSQL accepts POSIX-style time zone specifications of the form STDoffset or STDoffsetDST, where STD is a zone abbreviation, offset is a numeric offset in hours west from UTC, and DST is an optional daylight-savings zone abbreviation, assumed to stand for one hour ahead of the given offset.
Share your suggestions and bugs with the Azure Database for PostgreSQL product team.