ALTER POSTGRES INSTANCE¶
Modifies the properties of an existing Snowflake Postgres instance.
- See also:
CREATE POSTGRES INSTANCE, DESCRIBE POSTGRES INSTANCE, DROP POSTGRES INSTANCE, SHOW POSTGRES INSTANCES
Syntax¶
Parameters¶
nameSpecifies the identifier for the Postgres instance to alter.
If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
For more information, see Identifier requirements.
RENAME TO new_nameChanges the name of the Postgres instance to the specified new name. The new identifier must be unique for the account.
For more details about identifiers, see Identifier requirements.
RESET ACCESS FOR { 'snowflake_admin' | 'application' }Regenerates credentials for the
snowflake_adminorapplicationrole. Returns one row with the following column:password
For more information, see Snowflake Postgres Roles.
SET ...Sets one or more specified properties for the Postgres instance:
NETWORK_POLICY = 'network_policy'Specifies the network policy to use for the instance. Changes to the policy may take up to 2 minutes to take effect.
To specify this parameter, you must have been granted the USAGE privilege on the network policy object.
AUTHENTICATION_AUTHORITY = { POSTGRES | POSTGRES_OR_SNOWFLAKE }Change the authentication method for the instance. POSTGRES indicates that only Postgres user passwords can be used. POSTGRES_OR_SNOWFLAKE also allows the use of short-lived access token passwords. See Snowflake Token Authentication for Snowflake Postgres for more details.
COMMENT = 'string_literal'Adds or overwrites an existing comment for the Postgres instance.
HIGH_AVAILABILITY = { TRUE | FALSE }Enables or disables high availability for the instance. Executes as an asynchronous operation. Run the DESCRIBE POSTGRES INSTANCE command and monitor the
operationsfield to track progress.A high availability change can only be initiated if the instance is in the READY state and no other operation is running.
Note
Burstable instance sizes (BURST_XS, BURST_S, BURST_M) do not support high availability. To enable HA, you must first change to a STANDARD or HIGHMEM compute family.
COMPUTE_FAMILY = 'compute_family'Specifies the new instance size for the Postgres instance.
STORAGE_SIZE_GB = storage_gbSpecifies the new storage size in GB. Both increases and decreases are supported.
Note
When you decrease the storage size, you can’t set it too close to current disk usage. The new size must be at least 1.4x the disk space currently in use. That way, there’s still room to add more data without triggering an automatic storage increase.
STORAGE_INTEGRATION = 'storage_integration_name'Attaches a storage integration of type
POSTGRES_EXTERNAL_STORAGEto the Postgres instance, enabling the pg_lake extension to access data in external object storage. For the complete setup procedure, see Configuring S3 Storage for pg_lake.POSTGRES_VERSION = { 16 | 17 | 18 }Specifies the Postgres major version to upgrade to. You can only upgrade to a newer version; downgrading isn’t supported.
MAINTENANCE_WINDOW_START = hour_of_daySpecifies the hour of day (0-23, UTC) when a maintenance window can start. Maintenance windows are three hours long, starting from the specified hour.
POSTGRES_SETTINGS = 'json_string'Specifies changes to the Postgres server settings for the instance in JSON format:
Some settings require an instance restart to take effect. These changes won’t be applied unless you specify
APPLY IMMEDIATELY.APPLY IMMEDIATELYOverrides any defined maintenance window and applies the specified operations as soon as they’re ready. Applies to
COMPUTE_FAMILY,STORAGE_SIZE_GB,POSTGRES_VERSION, andPOSTGRES_SETTINGS.APPLY ON 'timestamp'Overrides any defined maintenance window and applies the specified operations at the given timestamp. The timestamp can’t be more than 72 hours in the future.
Supported timestamp formats:
yyyy-MM-ddyyyy-MM-dd HH:mmyyyy-MM-dd HH:mm:ssyyyy-MM-dd HH:mm zzz
UNSET ...Unsets one or more specified properties for the Postgres instance, resetting them to their defaults:
COMMENTPOSTGRES_SETTINGSNETWORK_POLICYMAINTENANCE_WINDOW_START- Unsetting causes all ongoing operations to be applied as soon as they’re completed.STORAGE_INTEGRATION- Removes the storage integration from the instance, disabling pg_lake access to external storage.
To unset multiple properties or parameters with a single ALTER statement, separate each property or parameter with a comma.
When unsetting a property or parameter, specify only the property or parameter name (unless the syntax above indicates that you should specify the value). Specifying the value returns an error.
SUSPENDSuspends the Postgres instance. The virtual machine is deactivated while the disk image is kept in storage. Normal billing is suspended, but storage costs continue to accrue. Existing backups are retained.
RESUMEResumes a suspended Postgres instance. If there were operations pending restart, they’re applied when the instance resumes.
TAG tag_name = 'tag_value' [ , tag_name = 'tag_value' , ... ]Specifies the tag name and the tag string value.
The tag value is always a string, and the maximum number of characters for the tag value is 256.
For information about specifying tags in a statement, see Tag quotas.
Access control requirements¶
A role used to execute this operation must have the following privileges at a minimum:
Privilege |
Object |
Notes |
|---|---|---|
OWNERSHIP or OPERATE |
Postgres instance |
Required for modifying instance properties. |
USAGE |
Network policy |
Required only if specifying a NETWORK_POLICY. |
USAGE |
Storage integration |
Required only if specifying a STORAGE_INTEGRATION. |
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage notes¶
Changes to
COMPUTE_FAMILY,STORAGE_SIZE_GB, andPOSTGRES_VERSIONare collectively referred to as “upgrade” operations and can be performed together. Run the DESCRIBE POSTGRES INSTANCE command and monitor theoperationsfield to track progress.An upgrade operation can only be initiated if the instance is in the READY state and no other operation is running.
If an instance has a defined maintenance window, changes won’t take effect until the maintenance window period starts, unless
APPLY IMMEDIATELYis specified. Maintenance windows control when changes are applied, not whether the instance is running. For more details about maintenance operations, see Snowflake Postgres instance management.A brief service interruption is required to perform instance management operations. Ensure that your applications can automatically reconnect to the database.
SUSPEND and RESUME are immediate operations for stopping and starting instance billing. They are distinct from maintenance windows, which schedule when configuration changes (like upgrades or HA enablement) take effect.
The connection string for an instance remains the same across instance management operations, unless you explicitly regenerate credentials.
Regarding metadata:
Attention
Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.
Examples¶
Change the compute family and storage size for a Postgres instance:
Monitor the progress of the operation using DESCRIBE:
Enable high availability for an instance:
Upgrade to Postgres 18:
Apply changes immediately, overriding the maintenance window:
Suspend a Postgres instance:
Resume a suspended instance:
Rename a Postgres instance:
Note
Renaming an instance changes its identifier in Snowflake but does not change the connection hostname. The hostname remains the same, so existing connections and applications continue to work without modification.
