From 636187d59d4526d0a287d0dbbaead1ef3151517f Mon Sep 17 00:00:00 2001 From: himeshr Date: Fri, 13 Oct 2023 11:12:58 +0530 Subject: [PATCH] #000 | Add some useful queries and add thread-name to log pattern --- src/main/resources/log4j.xml | 4 ++-- src/main/resources/sql/usefulQueries.sql | 30 +++++++++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/main/resources/log4j.xml b/src/main/resources/log4j.xml index 7414156..b831561 100644 --- a/src/main/resources/log4j.xml +++ b/src/main/resources/log4j.xml @@ -6,14 +6,14 @@ - + - + diff --git a/src/main/resources/sql/usefulQueries.sql b/src/main/resources/sql/usefulQueries.sql index 7b77a6d..7984234 100644 --- a/src/main/resources/sql/usefulQueries.sql +++ b/src/main/resources/sql/usefulQueries.sql @@ -45,4 +45,32 @@ BEGIN execute 'delete from table_metadata where schema_name = ''' || in_impl_schema || ''';'; return true; END -$$; \ No newline at end of file +$$; + +-- List all waiting triggers for ETL , in ascending order of next trigger +select + qt.trigger_state, + qt.trigger_type, + qjd.job_name, + qjd.sched_name, + qjd.job_group, + qjd.description, + qt.next_fire_time +from public.qrtz_triggers qt + join public.qrtz_job_details qjd + on qt.sched_name = qjd.sched_name + and qt.job_name = qjd.job_name + and qt.job_group = qjd.job_group +order by qt.next_fire_time asc; + +-- List currently running ETL job +select qft.state, + qt.trigger_state, + qt.trigger_type, + qjd.job_name, + qjd.sched_name, + qjd.job_group, + qjd.description +from qrtz_fired_triggers qft + join qrtz_triggers qt on qft.job_name = qt.job_name + join qrtz_job_details qjd on qt.sched_name = qjd.sched_name and qt.job_name = qjd.job_name and qt.job_group = qjd.job_group;