Created
February 20, 2015 19:46
-
-
Save mw44118/08f6fcf44eeef2c9ff2e to your computer and use it in GitHub Desktop.
slow query!
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
with current_config as | |
( | |
select * | |
from refractometer_config_history | |
where now()::timestamp without time zone <@ effective | |
) | |
select rmsh.sump_id, rr.refractometer_reading, current_config.* | |
from refractometer_readings rr | |
join refractometer_manifold_selection_history rmsh | |
on rr.inserted::timestamp without time zone <@ rmsh.effective | |
cross join current_config | |
where rr.inserted::timestamp without time zone <@ tsrange( | |
lower(rmsh.effective) + current_config.minutes_to_wait, | |
upper(rmsh.effective)) | |
and sump_id = 3 | |
order by inserted desc | |
limit 10; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment