mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-16 02:23:49 +08:00
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.
3 lines
158 B
SQL
3 lines
158 B
SQL
DROP FUNCTION _timescaledb_functions.compressed_data_info(_timescaledb_internal.compressed_data);
|
|
DROP INDEX _timescaledb_catalog.compression_chunk_size_idx;
|