Last active
September 12, 2018 15:39
-
-
Save joebartels/b0559becc782443238669c722167f6ca to your computer and use it in GitHub Desktop.
query cycling_entry by day of week and hour of day
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 sum(km_cycled) as km_cycled_for_all_mondays | |
from cycling_entry | |
where day_of_week = 1 | |
and hour_of_day > 11; | |
-- result: 39982 | |
-- average time: 7.25ms | |
select sum(km_cycled) as km_cycled_for_all_mondays | |
from cycling_entry | |
where extract(dow from date) = 1 | |
and extract(hour from date) > 11; | |
-- result: 39982 | |
-- average time: 19.2ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment