STL_SORT - Amazon Redshift

STL_SORT

Displays sort execution steps for queries, such as steps that use ORDER BY processing.

STL_SORT 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.

Note

STL_SORT only contains queries run on main clusters. It doesn't contain queries run on concurrency scaling clusters. To access queries run on both main and concurrency scaling clusters, we recommend that you use the SYS monitoring view SYS_QUERY_DETAIL . The data in the SYS monitoring view is formatted to be easier to use and understand.

Table columns

Column name Data type Description
userid integer ID of the user who generated the entry.
query integer Query ID. The query column can be used to join other system tables and views.
slice integer Number that identifies the slice where the query was running.
segment integer Number that identifies the query segment.
step integer Query step that ran.
starttime timestamp Time in UTC that the query started. Total time includes queuing and execution. with 6 digits of precision for fractional seconds. For example: 2009-06-12 11:29:19.131358.
endtime timestamp Time in UTC that the query finished. Total time includes queuing and execution. with 6 digits of precision for fractional seconds. For example: 2009-06-12 11:29:19.131358.
tasknum integer Number of the query task process that was assigned to run the step.
rows bigint Total number of rows that were processed.
bytes bigint Size, in bytes, of all the output rows for the step.
tbl integer Table ID.
is_diskbased character(1) If true (t), the query was performed as a disk-based operation. If false (f), the query was performed in memory.
workmem bigint Total number of bytes in working memory that were assigned to the step.
checksum bigint This information is for internal use only.

Sample queries

The following example returns sort results for slice 0 and segment 1.

select query, bytes, tbl, is_diskbased, workmem from stl_sort where slice=0 and segment=1;
query | bytes | tbl | is_diskbased | workmem -------+---------+-----+--------------+----------- 567 | 3126968 | 241 | f | 383385600 604 | 5292 | 242 | f | 383385600 675 | 104776 | 251 | f | 383385600 525 | 3126968 | 251 | f | 383385600 585 | 5068 | 241 | f | 383385600 630 | 204808 | 266 | f | 383385600 704 | 0 | 242 | f | 0 669 | 4606416 | 241 | f | 383385600 696 | 104776 | 241 | f | 383385600 651 | 4606416 | 254 | f | 383385600 632 | 0 | 256 | f | 0 599 | 396 | 241 | f | 383385600 86397 | 0 | 242 | f | 0 621 | 5292 | 241 | f | 383385600 86325 | 0 | 242 | f | 0 572 | 5068 | 242 | f | 383385600 645 | 204808 | 241 | f | 383385600 590 | 396 | 242 | f | 383385600 (18 rows)