From c2442c31f36d6cfa4b45ebc1ea5cbcd6bfa1b88a Mon Sep 17 00:00:00 2001 From: Joe-Blount Date: Fri, 7 Jul 2023 15:19:46 -0500 Subject: [PATCH] chore: create partition table index for created_at --- .../20230707195110_add_created_at_index.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 iox_catalog/migrations/20230707195110_add_created_at_index.sql diff --git a/iox_catalog/migrations/20230707195110_add_created_at_index.sql b/iox_catalog/migrations/20230707195110_add_created_at_index.sql new file mode 100644 index 0000000000..3445ee01ba --- /dev/null +++ b/iox_catalog/migrations/20230707195110_add_created_at_index.sql @@ -0,0 +1,13 @@ +-- Add to help the compactor when it searches for partitions with files created recently. + +-- By default we often only have 5min to finish our statements. The `CREATE INDEX CONCURRENTLY` however takes longer. +-- In our prod test this took about 15min, but better be safe than sorry. +-- IOX_NO_TRANSACTION +SET statement_timeout TO '60min'; + +-- IOX_STEP_BOUNDARY + +-- While `CONCURRENTLY` means it runs parallel to other writes, this command will only finish after the index was +-- successfully built. +-- IOX_NO_TRANSACTION +CREATE INDEX CONCURRENTLY IF NOT EXISTS partition_new_file_at_idx ON partition (new_file_at);