Google Cloud PostgreSQL

Google Cloud PostgreSQL is a fully-managed database service that helps you set up, maintain, manage, and administer your PostgreSQL relational databases on the Google Cloud platform.

You can ingest data from your Google Cloud PostgreSQL database using Hevo Pipelines and replicate it to a Destination of your choice.


Perform the following steps to configure your Google Cloud PostgreSQL Source:

Set up Log-based Incremental Replication (optional)

Note: If you are not using Logical Replication, skip this step.

PostgreSQL (version 9.4 and above) supports logical replication by writing additional information to its Write Ahead Logs (WALs).

To configure logical replication:

  1. Go to the Google Cloud SQL instance.

  2. Click the More icon next to the PostgreSQL instance and click Edit.

    Google Cloud PostgreSQL instance

  3. Scroll down to the Flags section.

    Google Cloud PostgreSQL flags section

  4. Click the More icon next to the PostgreSQL instance name and click Edit.

    Google Cloud PostgreSQL instance

  5. Scroll down to the Flags section.

    Google Cloud PostgreSQL flags section

  6. Click the drop-down next to Flags and then click Add Flag.
  7. Select all four flags from the drop-down menu. Specify their values as follows:

    Setting Value Description
    cloudsql.enable_pglogical On The setting to enable or disable the pglogical extension. Default value: Off.
    cloudsql.logical_decoding On The setting to enable or disable logical replication. Default value: Off.
    max_replication_slots 10 The number of clients that can connect to the server. Default value: 10.
    max_wal_senders 10 The number of processes that can simultaneously transmit the WAL log. Default value: 10.
    wal_sender_timeout 0 The time, in seconds, after which PostgreSQL terminates the replication connections due to inactivity. Default value: 60 seconds. You must set the value to 0 so that the connections are never terminated and your Pipeline does not fail.
    You can use the following query to check the value configured for the parameter:
    show wal_sender_timeout
  8. Click Save. The settings you configured are displayed under the Flags section.

    Google Cloud PostgreSQL flags values

Whitelist Hevo’s IP Addresses

You need to whitelist the Hevo IP addresses for your region to enable Hevo to connect to your PostgreSQL database. To do this:

  1. Access the Google Cloud console and click on your PostgeSQL instance ID.

    Google Cloud PostgreSQL instance

  2. In the left navigation pane, click Connections.

  3. Select the Public IP check box to activate access on any custom IP address.

    Public IP check box

  4. Click Add Network, and include the list of Hevo IP addresses available for your region.

    Add network addresses

  5. Repeat the above step for all the network addresses you want to add.

  6. Click Save. You can see Hevo’s IP addresses under Authorized networks.

    Hevo's IP addresses aded

Create a Replication User and Grant Privileges

While using logical replication in Google Cloud PostgreSQL, the user must have the cloudsqlsuperuser role. This role is needed to run the CREATE EXTENSION command.

Create a PostgreSQL user with REPLICATION privileges as follows:

  1. Log in to your PostgreSQL database using any SQL client like DataGrip as a super admin and run the following commands:

     CREATE USER replication_user WITH REPLICATION
     IN ROLE cloudsqlsuperuser LOGIN PASSWORD 'secret';

    Alternatively, set this attribute for an existing user as follows:

  2. Enter the following commands to provide access to the database user:

     GRANT CONNECT ON DATABASE <database_name> TO <database_username>;
     GRANT USAGE ON SCHEMA <schema_name> TO <database_username>;
     GRANT SELECT ON DATABASE <database_name> TO <database_username>;
  3. Alter the schema’s default privileges to grant SELECT privileges on tables to the database user:

     GRANT SELECT ON TABLES TO <database_username>;


  • The data type Array in the Source is automatically mapped to Varchar at the Destination. No other mapping is currently supported.

See Also

Revision History

Refer to the following table for the list of key updates made to this page:

Date Release Description of Change
Mar-07-2022 1.83 Updated the section, Prerequisites with a note about the logical replication.
Jan-24-2022 1.80 Removed from Limitations that Hevo does not support UUID datatype as primary key.
Dec-20-2021 1.78 Updated section, Set up Log-based Incremental Replication.
Sep-09-2021 1.71 - Updated the section, Limitations to include information about columns with the UUID data type not being supported as a primary key.
- Added WAL replication mode in the Prerequisites section.
- Replaced the section Grant Privileges to the User with Create a Replication User and Grant Privileges.
Jun-14-2021 1.65 Updated the Grant Privileges to the User section to include latest commands.
Last updated on 22 Mar 2022