Like anyone other RDBMS, Vertica also provides a large number of metadata tables which can be used for various purpose. In this tutorial, we will discuss how to check query execution time (duration), list of queries executed and delete vectors (non purged data) accumulated. These are some of the use cases to get this info.
SELECT time,user_name,transaction_id,request_type,request FROM dc_requests_issued
WHERE request_type='QUERY' and time >sysdate-1/24;
SELECT * FROM query_requests WHERE request_type = 'QUERY' AND session_id='[session_id]';
SELECT * FROM query_requests WHERE request_type = 'QUERY' AND REQUEST LIKE '% [QUERY TEXT] %';
SELECT execution_step, completion_time-time FROM dc_query_executions WHERE transaction_id=<> and statement_id=<>;
List of some of the query phase
select distinct execution_Step from dc_query_executions;
Output:
InitPlan
AbandonPlan
SerializePlan
ExecutePlan
CompilePlan
CompilePlan:EEpreexecute
CompilePlan:ReserveResources
Plan
PopulateVirtualProjection
PreparePlan
PreparePlan:DeserializePlan
PreparePlan:DistPlanner
PreparePlan:EEcompile
PreparePlan:LocalPlan
PreparePlan:TakeTableLocks
SELECT node_name, schema_name, projection_name, COUNT(*) num_dv, SUM(deleted_row_count) delete_row_cnt, MIN(start_epoch) min_epoch, MAX(start_epoch) max_epoch
FROM delete_vectors GROUP BY 1,2,3 ORDER BY 4 DESC;