-- =====================================================
-- QUICK RUN: Bet History Performance Indexes
-- =====================================================
-- Just copy and paste these commands into your MySQL client
-- Estimated execution time: 30-60 seconds (depending on table sizes)
-- =====================================================

-- User bet history indexes (10-50x faster queries)
CREATE INDEX idx_premier_bets_user_created ON premier_bets(user_id, created_at DESC);
CREATE INDEX idx_champions_bets_user_created ON champions_bets(user_id, created_at DESC);
CREATE INDEX idx_liga_bets_user_created ON liga_bets(user_id, created_at DESC);
CREATE INDEX idx_bets_user_created ON bets(user_id, created_at DESC);
CREATE INDEX idx_keno_bets_user_created ON keno_bets(user_id, created_at DESC);

-- Reports generation indexes (15-30x faster queries)
CREATE INDEX idx_premier_bets_created_status ON premier_bets(created_at, status);
CREATE INDEX idx_champions_bets_created_status ON champions_bets(created_at, status);
CREATE INDEX idx_liga_bets_created_status ON liga_bets(created_at, status);
CREATE INDEX idx_bets_created_status ON bets(created_at, status);
CREATE INDEX idx_keno_bets_created ON keno_bets(created_at);

-- =====================================================
-- Verify (run after creating indexes)
-- =====================================================
SHOW INDEX FROM premier_bets WHERE Key_name LIKE 'idx_%';
SHOW INDEX FROM champions_bets WHERE Key_name LIKE 'idx_%';
SHOW INDEX FROM liga_bets WHERE Key_name LIKE 'idx_%';
SHOW INDEX FROM bets WHERE Key_name LIKE 'idx_%';
SHOW INDEX FROM keno_bets WHERE Key_name LIKE 'idx_%';
