mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-16 18:43:18 +08:00
Remove continuous_aggregate_stats view
Stats for policies are exposed via the policy_stats view. Remove continuous aggregate stats view - the thresholds exposed via this view are not relevant with the new API.
This commit is contained in:
parent
94dd9a33bf
commit
602d9a9bf5
@ -90,56 +90,6 @@ CREATE OR REPLACE VIEW timescaledb_information.continuous_aggregates as
|
|||||||
and N.nspname = cagg.direct_view_schema ) directview
|
and N.nspname = cagg.direct_view_schema ) directview
|
||||||
WHERE cagg.mat_hypertable_id = ht.id;
|
WHERE cagg.mat_hypertable_id = ht.id;
|
||||||
|
|
||||||
CREATE OR REPLACE VIEW timescaledb_information.continuous_aggregate_stats as
|
|
||||||
SELECT format('%1$I.%2$I', cagg.user_view_schema, cagg.user_view_name)::regclass as view_name,
|
|
||||||
CASE _timescaledb_internal.get_time_type(cagg.raw_hypertable_id)
|
|
||||||
WHEN 'TIMESTAMP'::regtype
|
|
||||||
THEN _timescaledb_internal.to_timestamp_without_timezone(ct.watermark)::TEXT
|
|
||||||
WHEN 'TIMESTAMPTZ'::regtype
|
|
||||||
THEN _timescaledb_internal.to_timestamp(ct.watermark)::TEXT
|
|
||||||
WHEN 'DATE'::regtype
|
|
||||||
THEN _timescaledb_internal.to_date(ct.watermark)::TEXT
|
|
||||||
ELSE ct.watermark::TEXT
|
|
||||||
END AS completed_threshold,
|
|
||||||
CASE _timescaledb_internal.get_time_type(cagg.raw_hypertable_id)
|
|
||||||
WHEN 'TIMESTAMP'::regtype
|
|
||||||
THEN _timescaledb_internal.to_timestamp_without_timezone(it.watermark)::TEXT
|
|
||||||
WHEN 'TIMESTAMPTZ'::regtype
|
|
||||||
THEN _timescaledb_internal.to_timestamp(it.watermark)::TEXT
|
|
||||||
WHEN 'DATE'::regtype
|
|
||||||
THEN _timescaledb_internal.to_date(it.watermark)::TEXT
|
|
||||||
ELSE it.watermark::TEXT
|
|
||||||
END AS invalidation_threshold,
|
|
||||||
bgw_job_stat.job_id,
|
|
||||||
bgw_job_stat.last_start as last_run_started_at,
|
|
||||||
bgw_job_stat.last_successful_finish as last_successful_finish,
|
|
||||||
CASE WHEN bgw_job_stat.last_finish < '4714-11-24 00:00:00+00 BC' THEN NULL
|
|
||||||
WHEN bgw_job_stat.last_finish IS NOT NULL THEN
|
|
||||||
CASE WHEN bgw_job_stat.last_run_success = 't' THEN 'Success'
|
|
||||||
WHEN bgw_job_stat.last_run_success = 'f' THEN 'Failed'
|
|
||||||
END
|
|
||||||
END as last_run_status,
|
|
||||||
CASE WHEN bgw_job_stat.last_finish < '4714-11-24 00:00:00+00 BC' THEN 'Running'
|
|
||||||
WHEN bgw_job_stat.next_start IS NOT NULL THEN 'Scheduled'
|
|
||||||
END as job_status,
|
|
||||||
CASE WHEN bgw_job_stat.last_finish > bgw_job_stat.last_start THEN (bgw_job_stat.last_finish - bgw_job_stat.last_start)
|
|
||||||
END as last_run_duration,
|
|
||||||
bgw_job_stat.next_start as next_scheduled_run,
|
|
||||||
bgw_job_stat.total_runs,
|
|
||||||
bgw_job_stat.total_successes,
|
|
||||||
bgw_job_stat.total_failures,
|
|
||||||
bgw_job_stat.total_crashes
|
|
||||||
FROM
|
|
||||||
_timescaledb_catalog.continuous_agg as cagg
|
|
||||||
LEFT JOIN _timescaledb_config.bgw_job as bgw_job
|
|
||||||
ON ( cagg.mat_hypertable_id = bgw_job.hypertable_id )
|
|
||||||
LEFT JOIN _timescaledb_internal.bgw_job_stat as bgw_job_stat
|
|
||||||
ON ( bgw_job.id = bgw_job_stat.job_id )
|
|
||||||
LEFT JOIN _timescaledb_catalog.continuous_aggs_invalidation_threshold as it
|
|
||||||
ON ( cagg.raw_hypertable_id = it.hypertable_id)
|
|
||||||
LEFT JOIN _timescaledb_catalog.continuous_aggs_completed_threshold as ct
|
|
||||||
ON ( cagg.mat_hypertable_id = ct.materialization_id);
|
|
||||||
|
|
||||||
CREATE OR REPLACE VIEW timescaledb_information.data_node AS
|
CREATE OR REPLACE VIEW timescaledb_information.data_node AS
|
||||||
SELECT s.node_name, s.owner, s.options
|
SELECT s.node_name, s.owner, s.options
|
||||||
FROM (SELECT srvname AS node_name, srvowner::regrole::name AS owner, srvoptions AS options
|
FROM (SELECT srvname AS node_name, srvowner::regrole::name AS owner, srvoptions AS options
|
||||||
|
@ -534,12 +534,11 @@ WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass AND
|
|||||||
AND objid NOT IN (select unnest(extconfig) from pg_extension where extname='timescaledb')
|
AND objid NOT IN (select unnest(extconfig) from pg_extension where extname='timescaledb')
|
||||||
ORDER BY objid::text DESC;
|
ORDER BY objid::text DESC;
|
||||||
objid
|
objid
|
||||||
----------------------------------------------------
|
---------------------------------------------------
|
||||||
timescaledb_information.compression_settings
|
timescaledb_information.compression_settings
|
||||||
timescaledb_information.dimensions
|
timescaledb_information.dimensions
|
||||||
timescaledb_information.chunks
|
timescaledb_information.chunks
|
||||||
timescaledb_information.data_node
|
timescaledb_information.data_node
|
||||||
timescaledb_information.continuous_aggregate_stats
|
|
||||||
timescaledb_information.continuous_aggregates
|
timescaledb_information.continuous_aggregates
|
||||||
timescaledb_information.policy_stats
|
timescaledb_information.policy_stats
|
||||||
timescaledb_information.license
|
timescaledb_information.license
|
||||||
@ -550,7 +549,7 @@ WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass AND
|
|||||||
_timescaledb_internal.bgw_policy_chunk_stats
|
_timescaledb_internal.bgw_policy_chunk_stats
|
||||||
_timescaledb_internal.bgw_job_stat
|
_timescaledb_internal.bgw_job_stat
|
||||||
_timescaledb_catalog.tablespace_id_seq
|
_timescaledb_catalog.tablespace_id_seq
|
||||||
(15 rows)
|
(14 rows)
|
||||||
|
|
||||||
-- Make sure we can't run our restoring functions as a normal perm user as that would disable functionality for the whole db
|
-- Make sure we can't run our restoring functions as a normal perm user as that would disable functionality for the whole db
|
||||||
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER
|
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER
|
||||||
|
@ -94,14 +94,6 @@ SELECT add_continuous_aggregate_policy('test_continuous_agg_view', NULL, 4::inte
|
|||||||
1000
|
1000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- even before running, stats shows something
|
|
||||||
SELECT view_name, invalidation_threshold, job_status, last_run_duration
|
|
||||||
FROM timescaledb_information.continuous_aggregate_stats;
|
|
||||||
view_name | invalidation_threshold | job_status | last_run_duration
|
|
||||||
--------------------------+------------------------+------------+-------------------
|
|
||||||
test_continuous_agg_view | | |
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
SELECT id as raw_table_id FROM _timescaledb_catalog.hypertable WHERE table_name='test_continuous_agg_table' \gset
|
SELECT id as raw_table_id FROM _timescaledb_catalog.hypertable WHERE table_name='test_continuous_agg_table' \gset
|
||||||
-- min distance from end should be 1
|
-- min distance from end should be 1
|
||||||
SELECT mat_hypertable_id, user_view_schema, user_view_name, bucket_width
|
SELECT mat_hypertable_id, user_view_schema, user_view_name, bucket_width
|
||||||
@ -473,10 +465,11 @@ view_definition | SELECT time_bucket(2, test_continuous_agg_table."time") AS ti
|
|||||||
| FROM test_continuous_agg_table +
|
| FROM test_continuous_agg_table +
|
||||||
| GROUP BY (time_bucket(2, test_continuous_agg_table."time"));
|
| GROUP BY (time_bucket(2, test_continuous_agg_table."time"));
|
||||||
|
|
||||||
select view_name, invalidation_threshold, job_status, last_run_duration from timescaledb_information.continuous_aggregate_stats where view_name::text like '%test_continuous_agg_view';
|
select job_status, last_run_duration
|
||||||
-[ RECORD 1 ]----------+-------------------------
|
from timescaledb_information.policy_stats ps, timescaledb_information.continuous_aggregates cagg
|
||||||
view_name | test_continuous_agg_view
|
where cagg.view_name::text like '%test_continuous_agg_view'
|
||||||
invalidation_threshold | 12
|
and cagg.materialization_hypertable = ps.hypertable;
|
||||||
|
-[ RECORD 1 ]-----+----------
|
||||||
job_status | Scheduled
|
job_status | Scheduled
|
||||||
last_run_duration |
|
last_run_duration |
|
||||||
|
|
||||||
|
@ -83,25 +83,6 @@ view_definition | SELECT time_bucket('@ 1 hour'::interval, device_re
|
|||||||
| FROM device_readings +
|
| FROM device_readings +
|
||||||
| GROUP BY (time_bucket('@ 1 hour'::interval, device_readings.observation_time)), device_readings.device_id;
|
| GROUP BY (time_bucket('@ 1 hour'::interval, device_readings.observation_time)), device_readings.device_id;
|
||||||
|
|
||||||
--You can also view information about your background workers.
|
|
||||||
--Note: (some fields are empty because there are no background workers used in tests)
|
|
||||||
SELECT * FROM timescaledb_information.continuous_aggregate_stats;
|
|
||||||
-[ RECORD 1 ]----------+-----------------------------
|
|
||||||
view_name | device_summary
|
|
||||||
completed_threshold |
|
|
||||||
invalidation_threshold | Sun Dec 30 22:00:00 2018 PST
|
|
||||||
job_id |
|
|
||||||
last_run_started_at |
|
|
||||||
last_successful_finish |
|
|
||||||
last_run_status |
|
|
||||||
job_status |
|
|
||||||
last_run_duration |
|
|
||||||
next_scheduled_run |
|
|
||||||
total_runs |
|
|
||||||
total_successes |
|
|
||||||
total_failures |
|
|
||||||
total_crashes |
|
|
||||||
|
|
||||||
\x
|
\x
|
||||||
-- Refresh interval
|
-- Refresh interval
|
||||||
--
|
--
|
||||||
|
@ -83,10 +83,6 @@ CREATE MATERIALIZED VIEW test_continuous_agg_view
|
|||||||
|
|
||||||
SELECT add_continuous_aggregate_policy('test_continuous_agg_view', NULL, 4::integer, '12 h'::interval);
|
SELECT add_continuous_aggregate_policy('test_continuous_agg_view', NULL, 4::integer, '12 h'::interval);
|
||||||
|
|
||||||
-- even before running, stats shows something
|
|
||||||
SELECT view_name, invalidation_threshold, job_status, last_run_duration
|
|
||||||
FROM timescaledb_information.continuous_aggregate_stats;
|
|
||||||
|
|
||||||
SELECT id as raw_table_id FROM _timescaledb_catalog.hypertable WHERE table_name='test_continuous_agg_table' \gset
|
SELECT id as raw_table_id FROM _timescaledb_catalog.hypertable WHERE table_name='test_continuous_agg_table' \gset
|
||||||
|
|
||||||
-- min distance from end should be 1
|
-- min distance from end should be 1
|
||||||
@ -275,7 +271,10 @@ where view_name::text like '%test_continuous_agg_view';
|
|||||||
select view_name, view_definition from timescaledb_information.continuous_aggregates
|
select view_name, view_definition from timescaledb_information.continuous_aggregates
|
||||||
where view_name::text like '%test_continuous_agg_view';
|
where view_name::text like '%test_continuous_agg_view';
|
||||||
|
|
||||||
select view_name, invalidation_threshold, job_status, last_run_duration from timescaledb_information.continuous_aggregate_stats where view_name::text like '%test_continuous_agg_view';
|
select job_status, last_run_duration
|
||||||
|
from timescaledb_information.policy_stats ps, timescaledb_information.continuous_aggregates cagg
|
||||||
|
where cagg.view_name::text like '%test_continuous_agg_view'
|
||||||
|
and cagg.materialization_hypertable = ps.hypertable;
|
||||||
|
|
||||||
\x off
|
\x off
|
||||||
|
|
||||||
|
@ -51,9 +51,6 @@ SELECT * FROM device_summary WHERE metric_spread = 1800 ORDER BY bucket DESC, de
|
|||||||
\x
|
\x
|
||||||
SELECT * FROM timescaledb_information.continuous_aggregates;
|
SELECT * FROM timescaledb_information.continuous_aggregates;
|
||||||
|
|
||||||
--You can also view information about your background workers.
|
|
||||||
--Note: (some fields are empty because there are no background workers used in tests)
|
|
||||||
SELECT * FROM timescaledb_information.continuous_aggregate_stats;
|
|
||||||
\x
|
\x
|
||||||
|
|
||||||
-- Refresh interval
|
-- Refresh interval
|
||||||
|
Loading…
x
Reference in New Issue
Block a user