You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: diagnostic.sql
+34-4Lines changed: 34 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -42,10 +42,10 @@ $$ SET search_path = pg_catalog, pg_temp;
42
42
CREATE OR REPLACEFUNCTIONpg_temp.check_cagg_large_materialization_range() RETURNS void LANGUAGE plpgsql AS
43
43
$$
44
44
DECLARE
45
-
cagg regclass;
46
-
rangetext;
45
+
v_cagg regclass;
46
+
v_rangetext;
47
47
BEGIN
48
-
FOR cagg, rangeIN
48
+
FOR v_cagg, v_rangeIN
49
49
SELECT
50
50
format('%I.%I', c.user_view_schema, c.user_view_name)::regclass AS continuous_aggregate,
51
51
CASE
@@ -62,7 +62,36 @@ BEGIN
62
62
WHEN d.column_type=ANY('{timestamp,timestamptz}'::regtype[]) THEN _timescaledb_functions.to_interval(r.greatest_modified_value-r.lowest_modified_value) >250*f.bucket_width::interval
63
63
END
64
64
LOOP
65
-
RAISE WARNING 'Continuous aggregate % has large materialization range ''%''.', cagg, range;
65
+
RAISE WARNING 'Continuous aggregate % has large materialization range ''%''.', v_cagg, v_range;
66
+
END LOOP;
67
+
END
68
+
$$ SET search_path = pg_catalog, pg_temp;
69
+
70
+
CREATE OR REPLACEFUNCTIONpg_temp.check_cagg_chunk_interval() RETURNS void LANGUAGE plpgsql AS
71
+
$$
72
+
DECLARE
73
+
v_cagg regclass;
74
+
v_cagg_width text;
75
+
v_chunk_width text;
76
+
BEGIN
77
+
FOR v_cagg, v_chunk_width, v_cagg_width IN
78
+
SELECT
79
+
format('%I.%I', c.user_view_schema, c.user_view_name)::regclass AS continuous_aggregate,
80
+
CASE
81
+
WHEN d.column_type=ANY('{int4,int8}'::regtype[]) THEN d.interval_length::text
82
+
WHEN d.column_type=ANY('{timestamp,timestamptz}'::regtype[]) THEN _timescaledb_functions.to_interval(d.interval_length)::text
83
+
END AS chunk_width,
84
+
f.bucket_width cagg_width
85
+
FROM_timescaledb_catalog.continuous_agg c
86
+
JOIN_timescaledb_catalog.continuous_aggs_bucket_function f ONf.mat_hypertable_id=c.mat_hypertable_id
87
+
JOIN_timescaledb_catalog.dimension d ONd.hypertable_id=c.mat_hypertable_id
88
+
WHERE
89
+
CASE
90
+
WHEN d.column_type=ANY('{int4,int8}'::regtype[]) THEN d.interval_length<=f.bucket_width::int
91
+
WHEN d.column_type=ANY('{timestamp,timestamptz}'::regtype[]) THEN _timescaledb_functions.to_interval(d.interval_length) <=f.bucket_width::interval
92
+
END
93
+
LOOP
94
+
RAISE WARNING 'Continuous aggregate % has chunk width smaller than bucket width % <= %', v_cagg, v_chunk_width, v_cagg_width;
0 commit comments