From a5449376cec059916c73e8f9e151adae42bab2fc Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Fri, 10 May 2024 13:01:32 -0700 Subject: [PATCH] Remove first two unused indexes (#376) * Remove first two unused indexes * Don't make it concurrent * Just use select 1 for down * Drop sort index too * Update PR * Rename migration * Remove if not exists * Fix splitting --- ...20240419172419_remove-unused-indexes.down.sql | 5 +++++ .../20240419172419_remove-unused-indexes.up.sql | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 pkg/migrations/messages/20240419172419_remove-unused-indexes.down.sql create mode 100644 pkg/migrations/messages/20240419172419_remove-unused-indexes.up.sql diff --git a/pkg/migrations/messages/20240419172419_remove-unused-indexes.down.sql b/pkg/migrations/messages/20240419172419_remove-unused-indexes.down.sql new file mode 100644 index 00000000..04c5e832 --- /dev/null +++ b/pkg/migrations/messages/20240419172419_remove-unused-indexes.down.sql @@ -0,0 +1,5 @@ +SET statement_timeout = 0; + +--bun:split +DROP INDEX CONCURRENTLY message_receivertimestamp_idx; + diff --git a/pkg/migrations/messages/20240419172419_remove-unused-indexes.up.sql b/pkg/migrations/messages/20240419172419_remove-unused-indexes.up.sql new file mode 100644 index 00000000..06d98c4b --- /dev/null +++ b/pkg/migrations/messages/20240419172419_remove-unused-indexes.up.sql @@ -0,0 +1,16 @@ +SET statement_timeout = 0; + +--bun:split +DROP INDEX IF EXISTS message_pubsubtopic_idx; + +--bun:split +DROP INDEX IF EXISTS message_sort_idx; + +--bun:split +DROP INDEX IF EXISTS message_recvts_shouldexpire_idx; + +--bun:split +-- Replace recvts_shouldexpire_idx with an index just on receiver timestamp +-- This index is used in our data pipelines to power the data warehouse for high level analytics on network growth +CREATE INDEX CONCURRENTLY IF NOT EXISTS message_receivertimestamp_idx ON public.message(receiverTimestamp); +