STL_DELETE - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

STL_DELETE

Analyzes delete execution steps for queries.

STL_DELETE 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_DELETE only contains queries run on main provisioned clusters. It doesn't contain queries run on concurrency scaling clusters or on serverless namespaces. To access explain plans for queries run on both main clusters, concurrency scaling clusters, and serverless namespaces, 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.
tbl integer Table ID.

Sample queries

In order to create a row in STL_DELETE, the following example inserts a row into the EVENT table and then deletes it.

First, insert a row into the EVENT table and verify that it was inserted.

insert into event(eventid,venueid,catid,dateid,eventname) values ((select max(eventid)+1 from event),95,9,1857,'Lollapalooza');
select * from event where eventname='Lollapalooza' order by eventid;
eventid | venueid | catid | dateid | eventname | starttime ---------+---------+-------+--------+--------------+--------------------- 4274 | 102 | 9 | 1965 | Lollapalooza | 2008-05-01 19:00:00 4684 | 114 | 9 | 2105 | Lollapalooza | 2008-10-06 14:00:00 5673 | 128 | 9 | 1973 | Lollapalooza | 2008-05-01 15:00:00 5740 | 51 | 9 | 1933 | Lollapalooza | 2008-04-17 15:00:00 5856 | 119 | 9 | 1831 | Lollapalooza | 2008-01-05 14:00:00 6040 | 126 | 9 | 2145 | Lollapalooza | 2008-11-15 15:00:00 7972 | 92 | 9 | 2026 | Lollapalooza | 2008-07-19 19:30:00 8046 | 65 | 9 | 1840 | Lollapalooza | 2008-01-14 15:00:00 8518 | 48 | 9 | 1904 | Lollapalooza | 2008-03-19 15:00:00 8799 | 95 | 9 | 1857 | Lollapalooza | (10 rows)

Now, delete the row that you added to the EVENT table and verify that it was deleted.

delete from event where eventname='Lollapalooza' and eventid=(select max(eventid) from event);
select * from event where eventname='Lollapalooza' order by eventid;
eventid | venueid | catid | dateid | eventname | starttime ---------+---------+-------+--------+--------------+--------------------- 4274 | 102 | 9 | 1965 | Lollapalooza | 2008-05-01 19:00:00 4684 | 114 | 9 | 2105 | Lollapalooza | 2008-10-06 14:00:00 5673 | 128 | 9 | 1973 | Lollapalooza | 2008-05-01 15:00:00 5740 | 51 | 9 | 1933 | Lollapalooza | 2008-04-17 15:00:00 5856 | 119 | 9 | 1831 | Lollapalooza | 2008-01-05 14:00:00 6040 | 126 | 9 | 2145 | Lollapalooza | 2008-11-15 15:00:00 7972 | 92 | 9 | 2026 | Lollapalooza | 2008-07-19 19:30:00 8046 | 65 | 9 | 1840 | Lollapalooza | 2008-01-14 15:00:00 8518 | 48 | 9 | 1904 | Lollapalooza | 2008-03-19 15:00:00 (9 rows)

Then query stl_delete to see the execution steps for the deletion. In this example, the query returned over 300 rows, so the output below is shortened for display purposes.

select query, slice, segment, step, tasknum, rows, tbl from stl_delete order by query;
query | slice | segment | step | tasknum | rows | tbl -------+-------+---------+------+---------+------+-------- 7 | 0 | 0 | 1 | 0 | 0 | 100000 7 | 1 | 0 | 1 | 0 | 0 | 100000 8 | 0 | 0 | 1 | 2 | 0 | 100001 8 | 1 | 0 | 1 | 2 | 0 | 100001 9 | 0 | 0 | 1 | 4 | 0 | 100002 9 | 1 | 0 | 1 | 4 | 0 | 100002 10 | 0 | 0 | 1 | 6 | 0 | 100003 10 | 1 | 0 | 1 | 6 | 0 | 100003 11 | 0 | 0 | 1 | 8 | 0 | 100253 11 | 1 | 0 | 1 | 8 | 0 | 100253 12 | 0 | 0 | 1 | 0 | 0 | 100255 12 | 1 | 0 | 1 | 0 | 0 | 100255 13 | 0 | 0 | 1 | 2 | 0 | 100257 13 | 1 | 0 | 1 | 2 | 0 | 100257 14 | 0 | 0 | 1 | 4 | 0 | 100259 14 | 1 | 0 | 1 | 4 | 0 | 100259 ...