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

STL_DELETE

Analyzes delete execution steps for queries.

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 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 executed.
starttime timestamp Time in UTC that the query started executing, 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 executing, 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 execute 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.

Copy
insert into event(eventid,venueid,catid,dateid,eventname) values ((select max(eventid)+1 from event),95,9,1857,'Lollapalooza');
Copy
select * from event where eventname='Lollapalooza' order by eventid;

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

Copy
delete from event where eventname='Lollapalooza' and eventid=(select max(eventid) from event);
Copy
select * from event where eventname='Lollapalooza' order by eventid;

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

Copy
select query, slice, segment, step, tasknum, rows, tbl from stl_delete order by query;
Copy
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 ...