-- Indexes for admin users list sorting (Balance, Deposits, Withdraws, Referrals)
-- db_users_b: balance_a, deposit_total, withdraw_total
CREATE INDEX idx_users_b_balance_a ON db_users_b(balance_a);
CREATE INDEX idx_users_b_deposit_total ON db_users_b(deposit_total);
CREATE INDEX idx_users_b_withdraw_total ON db_users_b(withdraw_total);

-- db_users_d: for referral count (sum of referals_1..5) we filter by referer_id_N; indexes already exist (V34)
-- For sorting by total referral count we could use a composite; referer_id_1 is used for "referrals of user X"
CREATE INDEX idx_users_d_referals1 ON db_users_d(referals_1);
CREATE INDEX idx_users_d_referer_id_1 ON db_users_d(referer_id_1);
CREATE INDEX idx_users_d_referer_id_2 ON db_users_d(referer_id_2);
CREATE INDEX idx_users_d_referer_id_3 ON db_users_d(referer_id_3);
CREATE INDEX idx_users_d_referer_id_4 ON db_users_d(referer_id_4);
CREATE INDEX idx_users_d_referer_id_5 ON db_users_d(referer_id_5);
