Merge remote-tracking branch 'upstream/main' into merge-gramsrv-9106877

This commit is contained in:
onysd 2026-08-03 23:29:20 +03:00
commit ac6a50c5ff
697 changed files with 100880 additions and 8052 deletions

View file

@ -0,0 +1,22 @@
-- payments.getStarsTransactions applies the sign predicate before keyset LIMIT.
-- Partial owner/id indexes keep sparse inbound/outbound histories bounded even
-- when one account or channel has a long run of transactions in the other direction.
CREATE INDEX stars_transactions_user_incoming_idx
ON public.stars_transactions(user_id, id DESC) WHERE amount > 0;
CREATE INDEX stars_transactions_user_outgoing_idx
ON public.stars_transactions(user_id, id DESC) WHERE amount < 0;
CREATE INDEX ton_transactions_user_incoming_idx
ON public.ton_transactions(user_id, id DESC) WHERE amount_nanoton > 0;
CREATE INDEX ton_transactions_user_outgoing_idx
ON public.ton_transactions(user_id, id DESC) WHERE amount_nanoton < 0;
CREATE INDEX channel_stars_transactions_incoming_idx
ON public.channel_stars_transactions(channel_id, id DESC) WHERE amount > 0;
CREATE INDEX channel_stars_transactions_outgoing_idx
ON public.channel_stars_transactions(channel_id, id DESC) WHERE amount < 0;
CREATE INDEX channel_ton_transactions_incoming_idx
ON public.channel_ton_transactions(channel_id, id DESC) WHERE amount_nanoton > 0;
CREATE INDEX channel_ton_transactions_outgoing_idx
ON public.channel_ton_transactions(channel_id, id DESC) WHERE amount_nanoton < 0;