-- Inspect pg_indexes first; equivalent indexes with other names should be reused. -- Run outside a transaction: psql -v ON_ERROR_STOP=1 -f sql/indexes.sql -- IF NOT EXISTS only checks names, not index validity or equivalence. Inspect invalid -- indexes after an interrupted build before retrying. CREATE INDEX CONCURRENTLY IF NOT EXISTS binance_price_recorded_at_id ON public.binance_price (recorded_at, id); CREATE INDEX CONCURRENTLY IF NOT EXISTS strike_price_recorded_at_id ON public.strike_price (recorded_at, id); -- kraken_minute already has a ts primary-key index.