Menu
Amazon Redshift
Database Developer Guide (API Version 2012-12-01)

STL_UNLOAD_LOG

Records the details for an unload operation.

STL_UNLOAD_LOG records one row for each file created by an UNLOAD statement. For example, if an UNLOAD creates 12 files, STL_UNLOAD_LOG will contain 12 corresponding rows.

This table 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
userid integer ID of the user who generated the entry.
query integer ID for the transaction.
slice integer Number that identifies the slice where the query was running.
pid integer Process ID associated with the query statement.
path character(1280) The complete Amazon S3 object path for the file.
start_time timestamp Start time for the transaction.
end_time timestamp End time for the transaction.
line_count bigint Number of lines (rows) unloaded to the file.
transfer_size bigint Number of bytes transferred.

Sample Query

To get a list of the files that were written to Amazon S3 by an UNLOAD command, you can call an Amazon S3 list operation after the UNLOAD completes; however, depending on how quickly you issue the call, the list might be incomplete because an Amazon S3 list operation is eventually consistent. To get a complete, authoritative list immediately, query STL_UNLOAD_LOG.

The following query returns the pathname for files that were created by an UNLOAD with query ID 2320:

Copy
select query, substring(path,0,40) as path from stl_unload_log where query=2320 order by path;

This command returns the following sample output:

Copy
query | path -------+-------------------------------------- 2320 | s3://my-bucket/venue0000_part_00 2320 | s3://my-bucket/venue0001_part_00 2320 | s3://my-bucket/venue0002_part_00 2320 | s3://my-bucket/venue0003_part_00 (4 rows)

On this page: