forked from HiFX/amazon-redshift-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
v_my_last_query_summary.sql
27 lines (23 loc) · 971 Bytes
/
v_my_last_query_summary.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**********************************************************************************************
Purpose: View to help you see the summary of the last query that was run
Notes: Query simply applies formatting to SVL_QUERY_SUMMARY for the last run query by the session
via the pg_last_query_id() function. Please note that this function may return null for
queries that are taking advantage of resultset caching.
History:
2018-01-18 meyersi Created View Script
**********************************************************************************************/
create or replace view admin.v_my_last_query_summary as
select query,
maxtime,
avgtime,
rows,
bytes,
lpad(' ',stm+seg+step) || label as label,
is_diskbased,
workmem,
is_rrscan,
is_delayed_scan,
rows_pre_filter
from svl_query_summary
where query = pg_last_query_id()
order by stm, seg, step;