Multi-node maintenance tasks
Statistics for distributed hypertables
CREATE OR REPLACE PROCEDURE distributed_hypertables_analyze(job_id int, config jsonb)
LANGUAGE plpgsql AS
$$
BEGIN
FOR r IN SELECT hypertable_schema, hypertable_name
FROM timescaledb_information.hypertables
WHERE is_distributed ORDER BY 1, 2
EXECUTE format('ANALYZE %I.%I', r.hypertable_schema, r.hypertable_name);
END LOOP;
END
$$;