-- ========================================
-- QUICK FIX - RUN THIS NOW
-- ========================================

USE ac3_marketing_portal;

-- These 4 indexes will fix the "Loading..." issue
CREATE INDEX idx_campaign_user ON campaign_user_data(campaign_id, user_id);
CREATE INDEX idx_campaign_user_status ON campaign_user_data(campaign_id, user_id, status);  
CREATE INDEX idx_campaign_user_id ON campaign_user_data(campaign_id, user_id, id);
CREATE INDEX idx_master_data_id ON campaign_user_data(master_data_id);

-- Update table statistics
ANALYZE TABLE campaign_user_data;

-- Verify indexes were created
SHOW INDEX FROM campaign_user_data WHERE Key_name LIKE 'idx_%';
