-- Drop Performance-Optimized Indexes for HFT Trading System
-- =========================================================
-- Removes specialized indexes for rollback scenarios

-- Drop monitoring functions
DROP FUNCTION IF EXISTS get_index_sizes();
DROP FUNCTION IF EXISTS get_index_usage_stats();

-- Drop GIN indexes
DROP INDEX IF EXISTS idx_fills_metadata_gin;
DROP INDEX IF EXISTS idx_orders_metadata_gin;

-- Drop expression indexes
DROP INDEX IF EXISTS idx_orders_remaining_qty;
DROP INDEX IF EXISTS idx_orders_value;

-- Drop partial indexes for hot data
DROP INDEX IF EXISTS idx_fills_recent;
DROP INDEX IF EXISTS idx_orders_recent;

-- Drop performance metrics indexes
DROP INDEX IF EXISTS idx_performance_metrics_component_timestamp;

-- Drop audit logs indexes
DROP INDEX IF EXISTS idx_audit_logs_entity_timestamp;
DROP INDEX IF EXISTS idx_audit_logs_event_timestamp;
DROP INDEX IF EXISTS idx_audit_logs_timestamp_desc;

-- Drop risk metrics indexes
DROP INDEX IF EXISTS idx_risk_metrics_account_metric_timestamp;
DROP INDEX IF EXISTS idx_risk_metrics_severity_timestamp;

-- Drop bars indexes
DROP INDEX IF EXISTS idx_bars_timestamp;
DROP INDEX IF EXISTS idx_bars_symbol_timeframe_timestamp;

-- Drop market data indexes (not concurrent for partitioned tables)
DROP INDEX IF EXISTS idx_market_data_timestamp;
DROP INDEX IF EXISTS idx_market_data_symbol_timestamp;

-- Drop positions indexes
DROP INDEX IF EXISTS idx_positions_active;
DROP INDEX IF EXISTS idx_positions_account_symbol;

-- Drop fills indexes
DROP INDEX IF EXISTS idx_fills_execution_time;
DROP INDEX IF EXISTS idx_fills_symbol_execution;
DROP INDEX IF EXISTS idx_fills_order_execution;

-- Drop orders indexes
DROP INDEX IF EXISTS idx_orders_account_created;
DROP INDEX IF EXISTS idx_orders_symbol_created;
DROP INDEX IF EXISTS idx_orders_status_created;
DROP INDEX IF EXISTS idx_orders_client_order_id;

-- Performance-optimized indexes dropped successfully!