Last active
September 22, 2022 07:05
-
-
Save AshishKapoor/04bacdf0931d46fe3e09fad12a899644 to your computer and use it in GitHub Desktop.
This one takes 55 seconds on apache superset
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 DATE_TRUNC('day', time) AS __timestamp, | |
fill_level AS fill_level, | |
AVG(sensor_id) AS "AVG(sensor_id)" | |
FROM demo.fill_measurements | |
JOIN | |
(SELECT fill_level AS fill_level__, | |
AVG(sensor_id) AS mme_inner__ | |
FROM demo.fill_measurements | |
GROUP BY fill_level | |
ORDER BY mme_inner__ DESC | |
LIMIT 100) AS anon_1 ON fill_level = fill_level__ | |
GROUP BY fill_level, | |
DATE_TRUNC('day', time) | |
ORDER BY "AVG(sensor_id)" DESC | |
LIMIT 10000; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment