fix(stars): sync filter transaction history by direction
This commit is contained in:
parent
94f3843d23
commit
3a123f38db
19 changed files with 559 additions and 135 deletions
|
|
@ -0,0 +1,8 @@
|
|||
DROP INDEX IF EXISTS public.channel_ton_transactions_outgoing_idx;
|
||||
DROP INDEX IF EXISTS public.channel_ton_transactions_incoming_idx;
|
||||
DROP INDEX IF EXISTS public.channel_stars_transactions_outgoing_idx;
|
||||
DROP INDEX IF EXISTS public.channel_stars_transactions_incoming_idx;
|
||||
DROP INDEX IF EXISTS public.ton_transactions_user_outgoing_idx;
|
||||
DROP INDEX IF EXISTS public.ton_transactions_user_incoming_idx;
|
||||
DROP INDEX IF EXISTS public.stars_transactions_user_outgoing_idx;
|
||||
DROP INDEX IF EXISTS public.stars_transactions_user_incoming_idx;
|
||||
|
|
@ -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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue