timescaledb/sql/updates/reverse-dev.sql
Mats Kindahl e1eeedb276 Add index to compression_chunk_size catalog table
During upgrade the function `remove_dropped_chunk_metadata` is used to
update the metadata tables and remove data for chunks marked as
dropped. The function iterates of the chunks of the provided hypertable
and internally does a sequence scan of `compression_chunk_size` table
to locate the `compressed_chunk_id`, resulting in quadratic execution
time. This is usually not noticed for small number of chunks, but for
large number of chunks this becomes a problem.

This commit fixes this by adding an index to `compression_chunk_size`
catalog table, turning the sequence scan into an index scan.
2024-09-04 10:28:13 +02:00

3 lines
158 B
SQL

DROP FUNCTION _timescaledb_functions.compressed_data_info(_timescaledb_internal.compressed_data);
DROP INDEX _timescaledb_catalog.compression_chunk_size_idx;