-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
3 changed files
with
8 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
DROP FUNCTION _timescaledb_functions.compressed_data_info(_timescaledb_internal.compressed_data); | ||
DROP INDEX _timescaledb_catalog.compression_chunk_size_idx; |