Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garystafford/a8dac783c0adadccb9b53a6d453993e6 to your computer and use it in GitHub Desktop.
Save garystafford/a8dac783c0adadccb9b53a6d453993e6 to your computer and use it in GitHub Desktop.
-- create policies that automatically refreshes continuous aggregates
SELECT add_continuous_aggregate_policy('air_quality_summary_minute',
start_offset => INTERVAL '1 week',
end_offset => INTERVAL '1 hour',
schedule_interval => INTERVAL '1 hour');
SELECT add_continuous_aggregate_policy('light_summary_minute',
start_offset => INTERVAL '1 week',
end_offset => INTERVAL '1 hour',
schedule_interval => INTERVAL '1 hour');
SELECT add_continuous_aggregate_policy('motion_summary_minute',
start_offset => INTERVAL '1 week',
end_offset => INTERVAL '1 hour',
schedule_interval => INTERVAL '1 hour');
SELECT add_continuous_aggregate_policy('temperature_humidity_summary_minute',
start_offset => INTERVAL '1 week',
end_offset => INTERVAL '1 hour',
schedule_interval => INTERVAL '1 hour');
--view jobs
SELECT * FROM timescaledb_information.jobs;
--view job stats
SELECT job_id, total_runs, total_failures, total_successes
FROM timescaledb_information.job_stats;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment