Skip to content

Instantly share code, notes, and snippets.

@Halama
Created February 15, 2017 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Halama/f65770f4b20a23a6d2886503f33da575 to your computer and use it in GitHub Desktop.
Save Halama/f65770f4b20a23a6d2886503f33da575 to your computer and use it in GitHub Desktop.
select t1.query_type,
t1.avg_time as current_avg,
t2.avg_time as previous_avg,
t1.avg_time / t2.avg_time as performance_ratio
from
(select query_type, count(*) as query_count, avg(total_elapsed_time) as avg_time
from table(information_schema.query_history_by_user(
'ct_us_keboola_3292',
dateadd('hours',-1,current_timestamp()),
current_timestamp(), 10000))
group by query_type) t1
join
(select query_type, count(*) as query_count, avg(total_elapsed_time) as avg_time
from table(information_schema.query_history_by_user(
'ct_us_keboola_3292',
dateadd('days',-6,current_timestamp()),
dateadd('days',-5,current_timestamp()),
10000
))
group by query_type) t2
on(t1.query_type = t2.query_type)
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment