Recompress a chunk that had new data inserted after compression
Since 1.5.0Old API since v2.18.0. Superseded by convert_to_columnstore().
However, compression APIs are still supported, you do not need to migrate to the hypercore APIs.Recompresses a compressed that had more data inserted after compression.
In TimescaleDB 2.6.0 and above, recompress_chunk is implemented as a procedure. Previously, it was implemented as a
function. If you are upgrading to TimescaleDB 2.6.0 or above, therecompress_chunk function could cause an error. For
example, trying to run SELECT recompress_chunk(i.show_chunks, true) FROM... gives the following error:
Copy
Ask AI
ERROR: recompress_chunk(regclass, boolean) is a procedure
To fix the error, use CALL instead of SELECT. You might also need to write a procedure to replace the full
functionality in your SELECT statement. For example:
Copy
Ask AI
DO $$DECLARE chunk regclass;BEGIN FOR chunk IN SELECT format('%I.%I', chunk_schema, chunk_name)::regclass FROM timescaledb_information.chunks WHERE is_compressed = true LOOP RAISE NOTICE 'Recompressing %', chunk::text; CALL recompress_chunk(chunk, true); END LOOP;END$$;