Skip to content

Instantly share code, notes, and snippets.

View kbzowski's full-sized avatar

Krzysztof kbzowski

  • AGH University of Science and Technology
  • Krakow, Poland
View GitHub Profile
@kbzowski
kbzowski / gist:aabc0630f5bc7344fe68b36864254d75
Last active July 27, 2021 07:28
TimescaleDB procedure which moves (AKA archives) chunks to history tablespace
CREATE OR REPLACE PROCEDURE "public"."archive"("job_id" int4, "config" jsonb)
AS $BODY$
DECLARE
ht REGCLASS;
lag interval;
destination name;
index_postfix name;
chunk_record RECORD;
result RECORD;
BEGIN