Schema:

ORGANIZATION_USAGE

REPLICATION_GROUP_REFRESH_HISTORY view

Important

This view is only available in the organization account. For more information, see Premium views in the organization account.

This Organization Usage view can be used to query the refresh history for a specified replication or failover group.

See also:

REPLICATION_GROUP_REFRESH_HISTORY, REPLICATION_GROUP_REFRESH_HISTORY_ALL (Information Schema table function)

Columns

Organization-level columns

Column NameData TypeDescription
ORGANIZATION_NAMEVARCHARName of the organization.
ACCOUNT_LOCATORVARCHARSystem-generated identifier for the account.
ACCOUNT_NAMEVARCHARUser-defined identifier for the account.

Additional columns

Column NameData TypeDescription
REPLICATION_GROUP_NAMEVARCHARName of the secondary replication or failover group.
REPLICATION_GROUP_IDNUMBERInternal/system-generated identifier for the replication or failover group.
PHASE_NAMEVARCHARCurrent 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_UUIDVARCHARQuery 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

  • Results are only returned for secondary failover or replication groups in the current account (the target account).

  • 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 the secondary failover group myfg, execute the following statement:

SELECT account_name, phase_name, start_time, end_time,
       total_bytes, object_count, error
  FROM SNOWFLAKE.ORGANIZATION_USAGE.REPLICATION_GROUP_REFRESH_HISTORY
  WHERE replication_group_name = 'MYFG';

To retrieve the last refresh record for each replication or failover group, execute the following statement:

SELECT account_name, replication_group_name, phase_name,
       start_time, end_time,
       total_bytes, object_count, error,
       ROW_NUMBER() OVER (
         PARTITION BY replication_group_name
         ORDER BY end_time DESC
       ) AS row_num
  FROM SNOWFLAKE.ORGANIZATION_USAGE.REPLICATION_GROUP_REFRESH_HISTORY
  QUALIFY row_num = 1;