Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WITH persisted_rate AS (
SELECT
date_trunc('minute', persisted_time) AS persisted_minute,
count(*) AS num_persisted
FROM persistent_queue_table
GROUP BY persisted_minute
),
polled_rate AS (
SELECT
date_trunc('minute', poll_time) AS poll_minute,
count(*) AS num_polled
FROM persistent_queue_table
GROUP BY poll_minute
),
SELECT
persisted_minute AS minute,
num_persisted,
num_polled
FROM persisted_rate
INNER JOIN polled_rate ON persisted_minute = poll_minute
ORDER BY minute;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment