create index if not exists idx_score_events_tenant_created_user_negative
  on public.user_score_events(tenant_id, created_at desc, user_id)
  where points < 0;

create index if not exists idx_score_events_tenant_created_abs_points
  on public.user_score_events(tenant_id, created_at desc, (abs(points)) desc);

create index if not exists idx_point_activity_claims_tenant_claimed_user
  on public.user_point_activity_claims(tenant_id, claimed_at desc, user_id)
  where status = 'claimed';

create index if not exists idx_point_exchange_orders_tenant_exchanged_user
  on public.user_point_exchange_orders(tenant_id, exchanged_at desc, user_id);
