Multi-node maintenance tasks

    Statistics for distributed hypertables

    1. CREATE OR REPLACE PROCEDURE distributed_hypertables_analyze(job_id int, config jsonb)
    2. LANGUAGE plpgsql AS
    3. $$
    4. BEGIN
    5. FOR r IN SELECT hypertable_schema, hypertable_name
    6. FROM timescaledb_information.hypertables
    7. WHERE is_distributed ORDER BY 1, 2
    8. EXECUTE format('ANALYZE %I.%I', r.hypertable_schema, r.hypertable_name);
    9. END LOOP;
    10. END
    11. $$;