STL_AGGR - Amazon Redshift

STL_AGGR

Analyzes aggregate execution steps for queries. These steps occur during execution of aggregate functions and GROUP BY clauses.

STL_AGGR 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_AGGR 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.
slots integer Number of hash buckets.
occupied integer Number of slots that contain records.
maxlength integer Size of the largest slot.
tbl integer Table ID.
is_diskbased character(1) If true (t), the query was run as a disk-based operation. If false (f), the query was run in memory.
workmem bigint Number of bytes of working memory assigned to the step.
type character(6) The type of step. Valid values are:
  • HASHED. Indicates that the step used grouped, unsorted aggregation.

  • PLAIN. Indicates that the step used ungrouped, scalar aggregation.

  • SORTED. Indicates that the step used grouped, sorted aggregation.

resizes integer This information is for internal use only.
flushable integer This information is for internal use only.

Sample queries

Returns information about aggregate execution steps for SLICE 1 and TBL 239.

select query, segment, bytes, slots, occupied, maxlength, is_diskbased, workmem, type from stl_aggr where slice=1 and tbl=239 order by rows limit 10;
query | segment | bytes | slots | occupied | maxlength | is_diskbased | workmem | type -------+---------+-------+---------+----------+-----------+--------------+-----------+-------- 562 | 1 | 0 | 4194304 | 0 | 0 | f | 383385600 | HASHED 616 | 1 | 0 | 4194304 | 0 | 0 | f | 383385600 | HASHED 546 | 1 | 0 | 4194304 | 0 | 0 | f | 383385600 | HASHED 547 | 0 | 8 | 0 | 0 | 0 | f | 0 | PLAIN 685 | 1 | 32 | 4194304 | 1 | 0 | f | 383385600 | HASHED 652 | 0 | 8 | 0 | 0 | 0 | f | 0 | PLAIN 680 | 0 | 8 | 0 | 0 | 0 | f | 0 | PLAIN 658 | 0 | 8 | 0 | 0 | 0 | f | 0 | PLAIN 686 | 0 | 8 | 0 | 0 | 0 | f | 0 | PLAIN 695 | 1 | 32 | 4194304 | 1 | 0 | f | 383385600 | HASHED (10 rows)