Skip to content

sys.log_restore

This view records the history of restore (ybrestore) operations.

Column NameData TypeDescription
session_keytextUnique session key generated for the restore operation. Note: A single-table restore runs under two session IDs with the same session key. The database name listed for the first session, which is a metadata-only restore, is an internal staging database name. Only the second row, which is the actual restore that moves data into the new table, shows the actual target database name.

session_idbigintUnique ID of the ybrestore session.
client_hostnametextClient host name, if available.
client_usernametextOperating system user on the client system who is running the restore tool.
user_nametextName of the database user, as passed in on the ybrestore command line (or set with YBUSER).
user_idbigintUnique ID of the database user.
database_nametextName of the restored database.
database_idbigintUnique ID of the restored database.
statetextCurrent state of the restore operation, such as USER_DATA_RUNNING or DONE.
error_stringtextError message reported for a failed restore. For example, if a restore is cancelled before it completes, the view may report an External data socket error.
start_timetimestamptzWhen the ybrestore command started running.
end_timetimestamptzWhen the ybrestore command completed.
elapsed_msbigintTime spent running the restore (in milliseconds).
remaining_msbigintTime remaining to complete the restore (in milliseconds).
received_bytesbigintNumber of bytes transferred over the network.
received_bytes_per_secdouble precisionNumber of bytes per second transferred over the network.
storage_bytesbigintNumber of bytes stored in the target location.
storage_bytes_per_secdouble precisionNumber of bytes per second being stored in the target location.
backup_point_idtextBackup name as specified with the ybbackup --name option.
chain_idtextName of the backup chain.
source_database_nametextName of the source database for the restore (not the restored database name in the case of a database being restored to an alias).
source_appliance_nametextName of the appliance or data warehouse instance where the database was backed up.
table_nametextName of the table that was restored in a single-table restore operation. For database-level restores, this column is NULL.

Examples

The following query shows that two restore operations occurred with premdb_restored as the target database. The first was a database restore, and the second was a single-table restore.

yellowbrick=# select * from sys.log_restore where database_name='premdb_restored';
-[ RECORD 1 ]----------+-----------------------------------------------------------------
session_key            | Dcli8wrwpy1WbsvrMNUzH9jPEjRdtLwpg8rBxGRRatRgN8BuOw7e2rMn3UYf7Xvs
session_id             | 54337
client_hostname        | localhost
client_username        | yellowbrick
username               | yellowbrick
user_id                | 16007
database_name          | premdb_restored
database_id            | 40619
state                  | DONE
error_string           | [NULL]
start_time             | 2021-06-22 14:37:56.185-07
end_time               | 2021-06-22 14:38:08.746-07
elapsed_ms             | 12561
remaining_ms           | 0
received_bytes         | 1040150443
received_bytes_per_sec | 82807932.728286
storage_bytes          | 1039832202
storage_bytes_per_sec  | 82782597.0862193
backup_point_id        | June22Full
chain_id               | premdbJune2021
source_database_name   | premdb
source_appliance_name  | localhost
table_name             | [NULL]
-[ RECORD 2 ]----------+-----------------------------------------------------------------
session_key            | CEyf1a9giaaA128eqmYHrdR35eo1mKybN4VliZkEcNhHWsvXf_nHJ2FrS_dUviPe
session_id             | 54449
client_hostname        | localhost
client_username        | yellowbrick
username               | yellowbrick
user_id                | 16007
database_name          | premdb_restored
database_id            | 40646
state                  | DONE
error_string           | [NULL]
start_time             | 2021-06-22 14:42:45.212-07
end_time               | 2021-06-22 14:42:47.389-07
elapsed_ms             | 2177
remaining_ms           | 0
received_bytes         | 62664469
received_bytes_per_sec | 28784781.3504823
storage_bytes          | 62647477
storage_bytes_per_sec  | 28776976.1139182
backup_point_id        | June22Full
chain_id               | premdbJune2021
source_database_name   | premdb
source_appliance_name  | localhost
table_name             | public.match_restored

The following example returns both session IDs for a single-table restore:

yellowbrick=# select session_key, session_id, database_name, source_database_name, storage_bytes, start_time, end_time from sys.log_restore;
                          session_key                            | session_id |                   database_name                   | source_database_name | storage_bytes |         start_time         |          end_time          
------------------------------------------------------------------+------------+---------------------------------------------------+----------------------+---------------+----------------------------+----------------------------
 UCZ61AkXrBfXFjTE3oEXOaO0biVMCmKQfe2ADPwy1VfnBHNBM-haMxUfBQKl4XE= |      24351 | _YB_BAR2_STR_6ed06f17-b3b8-4714-8a77-208a2a303f4c | premdb               |             0 | 2021-06-16 15:24:13.165-07 | 2021-06-16 15:24:14.325-07
 UCZ61AkXrBfXFjTE3oEXOaO0biVMCmKQfe2ADPwy1VfnBHNBM-haMxUfBQKl4XE= |      24358 | premdb                                            | premdb               |          1576 | 2021-06-16 15:24:14.398-07 | 2021-06-16 15:24:17.678-07
(2 rows)

Parent topic:System Views