-- Drop the 3 secondary indexes on `recommendation` so the denormalisation
-- backfill can run without per-row index write-amplification.
--
-- `recommendation` is packed (fillfactor 100), so each backfill UPDATE cannot do
-- a HOT update and must insert a new entry into every index on the table for all
-- ~21m rows. Dropping these first cuts index inserts per updated row from ~4 to 1
-- (just the primary key), which is the bulk of the speed-up.
--
-- These serve production reads (fetch-by-property, the active-defaults paths), so
-- ONLY run this in a low-usage window and rebuild them
-- (rebuild-recommendation-backfill-indexes.sql) as soon as the window's backfill
-- pass finishes. DROP INDEX is near-instant (catalog change + file unlink); it
-- takes a brief ACCESS EXCLUSIVE lock, so if long-running queries are in flight
-- use `DROP INDEX CONCURRENTLY` (cannot run inside a transaction) instead.
--
-- Kept OUT of the backfill script on purpose so you control exactly when the app
-- loses and regains these indexes. See
-- docs/runbooks/recommendation-denormalization-backfill.md
--
-- NOTE: idx_recommendation_active_id_property was originally built CONCURRENTLY;
-- if a prior CONCURRENTLY build was ever interrupted it can linger as INVALID —
-- the DROP below clears it either way.

DROP INDEX IF EXISTS recommendation_property_id_idx;
DROP INDEX IF EXISTS idx_recommendation_active_defaults;
DROP INDEX IF EXISTS idx_recommendation_active_id_property;
