Skip to content

Instantly share code, notes, and snippets.

@martyndavies
Last active April 9, 2018 21:38
Show Gist options
  • Save martyndavies/d4acbb242133e33f832c678ad1850163 to your computer and use it in GitHub Desktop.
Save martyndavies/d4acbb242133e33f832c678ad1850163 to your computer and use it in GitHub Desktop.
SELECT sum(query_count)
FROM ((
SELECT query_count
FROM rollups_5min
WHERE timestamp >= $1 AND timestamp < $2 AND app_id = $3
) UNION ALL (
SELECT query_count
FROM rollups_1day
WHERE timestamp >= $1 AND timestamp < $2 AND app_id = $3
)) a...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment