Script to List all Query request errors in Vertica

The script will list all requests that ended up in a error message. This is part of the daily monitoring and will help you identify bad sql that needs to be resolved.

SELECT
 qr.node_name,
 qr.user_name,
 qr.session_id,
 qr.start_timestamp,
 qr.request_type,
 LEFT(REGEXP_REPLACE(qr.request, '[rtfn]', ' '), 100) AS request,
 qr.request_duration_ms,
 qr.error_count,
 em.error_level,
 em.error_code,
 em.message
FROM
 v_monitor.query_requests qr
JOIN
 v_monitor.error_messages em
ON
 em.node_name = qr.node_name
AND em.session_id = qr.session_id
AND em.request_id = qr.request_id
AND em.transaction_id = qr.transaction_id
ORDER BY
 qr.start_timestamp DESC;