Categories:

Information Schema , Table functions

REPLICATION_GROUP_REFRESH_HISTORY, REPLICATION_GROUP_REFRESH_HISTORY_ALL

You can use the REPLICATION_GROUP_REFRESH_HISTORY family of table functions to query the replication history for one secondary replication or failover group, or all such groups.

By default (when no date-range arguments are provided), these functions return data for the last 12 hours. You can use the optional DATE_RANGE_START and DATE_RANGE_END arguments to query a custom range within the 14-day retention window.

See also:

REPLICATION_GROUP_REFRESH_HISTORY view

Syntax

REPLICATION_GROUP_REFRESH_HISTORY(
      '<secondary_group_name>'
      [ , DATE_RANGE_START => <constant_expr> ]
      [ , DATE_RANGE_END => <constant_expr> ] )

REPLICATION_GROUP_REFRESH_HISTORY_ALL(
      [ DATE_RANGE_START => <constant_expr> ]
      [ , DATE_RANGE_END => <constant_expr> ] )

Arguments

'secondary_group_name'

Name of the secondary group. The entire name must be enclosed in single quotes. Required for REPLICATION_GROUP_REFRESH_HISTORY. Not used with REPLICATION_GROUP_REFRESH_HISTORY_ALL.

The following arguments are optional for both functions.

DATE_RANGE_START => constant_expr ,
DATE_RANGE_END => constant_expr

The date/time range for which to return replication refresh history.

  • If neither a start date nor an end date is specified, the default is the last 12 hours.
  • If a start date is specified but no end date, CURRENT_DATE at midnight is used as the end of the range.
  • If an end date is specified but no start date, the range starts 12 hours prior to the start of DATE_RANGE_END.

Data is retained for 14 days. If the requested range extends beyond the 14-day retention window, the function returns an error.

Output

The function returns the following columns. REPLICATION_GROUP_REFRESH_HISTORY_ALL has additional columns that are the first two columns in the result set.

Column NameData TypeDescription
GROUP_NAMETEXT

Specifies which secondary replication or failover group corresponds to this row in the result set. Only applies to REPLICATION_GROUP_REFRESH_HISTORY_ALL.

GROUP_TYPETEXT

Specifies whether the group corresponding to this row in the result set is a failover group or a replication group. The value is either FAILOVER or REPLICATION. Only applies to REPLICATION_GROUP_REFRESH_HISTORY_ALL.

PHASE_NAMETEXTCurrent phase in the replication operation. For the list of phases, see the Usage Notes.
START_TIMETIMESTAMP_LTZTime when the replication operation began.
END_TIMETIMESTAMP_LTZTime when the replication operation finished, if applicable. NULL if it is in progress.
JOB_UUIDTEXTQuery ID for the refresh job.
TOTAL_BYTESVARIANT

A JSON object that provides detailed information about refreshed databases:

  • totalBytesToReplicate: Total number of bytes expected to be replicated.
  • bytesUploaded: Actual number of bytes uploaded.
  • bytesDownloaded: Actual number of bytes downloaded.
  • databases: List of JSON objects containing the following fields for each member database:
    • name: Name of the database.
    • totalBytesToReplicate: Total bytes expected to be replicated for the database.
OBJECT_COUNTVARIANT

A JSON object that provides detailed information about refreshed objects:

  • totalObjects: Total number of objects in the replication or failover group.
  • completedObjects: Total number of objects completed.
  • objectTypes: List of JSON objects containing the following fields for each type:
    • objectType: Type of object (for example users, roles, grants, warehouses, schemas, tables, columns, etc).
    • totalObjects: Total number of objects of this type in the replication or failover group.
    • completedObjects: Total number of objects of this type that were completed.
PRIMARY_SNAPSHOT_TIMESTAMPTIMESTAMP_LTZTimestamp when the primary snapshot was created.
ERRORVARIANT

NULL if the refresh operation is successful. If the refresh operation fails, returns a JSON object that provides detailed information about the error:

  • errorCode: Error code of the failure.
  • errorMessage: Error message of the failure.

Usage notes

  • When no DATE_RANGE_START or DATE_RANGE_END arguments are provided, the functions return data for the last 12 hours. To retrieve data beyond the last 12 hours, specify the date range explicitly. Data is available for up to 14 days.

  • Only returns rows for a role with any privilege on the replication or failover group.

  • Only returns rows for a secondary replication or failover group in the current account.

  • When calling an Information Schema table function, the session must have an INFORMATION_SCHEMA schema in use or the function name must be fully-qualified. For more details, see Snowflake Information Schema.

  • The following is the list of phases in the order processed:

    #Phase nameDescription
    1SECONDARY_SYNCHRONIZING_MEMBERSHIPThe secondary replication or failover group receives information from the primary group about the objects included in the group, and updates its membership metadata.
    2SECONDARY_UPLOADING_INVENTORYThe secondary replication or failover group sends an inventory of its objects in the target account to the primary group.
    3PRIMARY_UPLOADING_METADATAThe primary replication or failover group creates a snapshot of metadata in the source account and sends it to the secondary group.
    4PRIMARY_UPLOADING_DATAThe primary replication or failover group copies the files the secondary group needs to reconcile any deltas between the objects in the source and target accounts.
    5SECONDARY_DOWNLOADING_METADATAThe secondary replication or failover group applies the snapshot of the metadata that was sent by the primary. The metadata updates are not applied atomically and instead applied over time.
    6SECONDARY_DOWNLOADING_DATAThe secondary replication or failover group copies the files sent by the primary group to the target account.
    7COMPLETED / FAILED / CANCELEDRefresh operation status.

Examples

To retrieve the refresh history for secondary group myfg, execute the following statement.

SELECT phase_name, start_time, end_time,
       total_bytes, object_count, error
  FROM TABLE(
      INFORMATION_SCHEMA.REPLICATION_GROUP_REFRESH_HISTORY('myfg')
  );

To retrieve the refresh history for the last 12 hours (default) for all failover groups and replication groups, execute the following statement:

SELECT phase_name, start_time, end_time,
       total_bytes, object_count, error
  FROM TABLE(
      INFORMATION_SCHEMA.REPLICATION_GROUP_REFRESH_HISTORY_ALL()
  );

To retrieve the refresh history for the last 7 days for all groups:

SELECT phase_name, start_time, end_time,
       total_bytes, object_count, error
  FROM TABLE(
      INFORMATION_SCHEMA.REPLICATION_GROUP_REFRESH_HISTORY_ALL(
          DATE_RANGE_START => DATEADD(D, -7, CURRENT_DATE),
          DATE_RANGE_END => CURRENT_DATE)
  );

To retrieve the refresh history for a specific date range for secondary group myfg:

SELECT phase_name, start_time, end_time,
       total_bytes, object_count, error
  FROM TABLE(
      INFORMATION_SCHEMA.REPLICATION_GROUP_REFRESH_HISTORY(
          'myfg',
          DATE_RANGE_START => '2025-04-01',
          DATE_RANGE_END => '2025-04-07')
  );