SYS_UNLOAD_HISTORY - Amazon Redshift

SYS_UNLOAD_HISTORY

Use SYS_UNLOAD_HISTORY to view details of UNLOAD commands. Each row represents a UNLOAD command with accumulated statistics for some of the fields. It contains both running and finished UNLOAD commands.

SYS_UNLOAD_HISTORY is visible to all users. Superusers can see all rows; regular users can see only their own data. For more information, see Visibility of data in system tables and views.

Table columns

Column name Data type Description
user_id integer The identifier of the user who submitted the unload.
query_id bigint The query identifier of the UNLOAD command.
transaction_id bigint The transaction identifier.
session_id integer The process identifier of the process running the unload.
database_name text The name of the database the user was connected to when the operation was issued.
status text The status of the UNLOAD command. Valid values include: running, completed, aborted, and unknown.
start_time timestamp The time when the unload began.
end_time timestamp The time when the unload completed.
duration bigint The amount of time (microseconds) spent in the UNLOAD command.
file_format text The file format of the output files.
compression_type text The compression type.
unloaded_location text The Amazon S3 location of unloaded files.
unloaded_rows bigint The number of rows.
unloaded_files_count bigint The file count of the output file.
unloaded_files_size bigint The file size of the output file.
error_message text The error message of the UNLOAD command.

Sample queries

The following query shows the unloaded query details, including format, rows, and file count of unload command.

SELECT query_id, file_format, start_time, duration, unloaded_rows, unloaded_files_count FROM sys_unload_history ORDER BY query_id, file_format limit 100;

Sample output.

query_id | file_format | start_time | duration | unloaded_rows | unloaded_files_count ----------+-------------+----------------------------+----------+---------------+---------------------- 527067 | Text | 2022-02-09 05:18:35.844452 | 5932478 | 10 | 1