Created
February 15, 2017 12:16
-
-
Save Halama/f65770f4b20a23a6d2886503f33da575 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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