Skip to content

Improve Supabase query performance for high-cardinality ledger snapshots #29

Description

@grantfox-oss

some backend queries fetch large result sets, join on unindexed JSON fields, or rely on sorting/indexes that do not exist in Supabase, causing slow snapshots and timeouts under load.

Affected areas: app/backend/src/ingestion/event.repository.ts, app/backend/src/transactions/transaction.repository.ts, app/backend/src/refunds/refund.repository.ts, app/backend/supabase/migrations/*, app/backend/src/common/pagination/*.

Implementation scope:

  • Audit slow query plans and add appropriate Supabase indexes for common filters and orderings.
  • Rewrite heavy joins into staged queries or materialized snapshots where needed.
  • Add query timeout handling and degrade gracefully for dashboard endpoints.
  • Add integration tests that assert query execution under realistic data volumes.

Acceptance criteria:

  • Key backend queries use indexed filter/order columns and avoid full-table scans.
  • Large pagination queries remain stable under synthetic load.
  • Slow query regressions are caught by CI or test assertions.

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignbugSomething isn't workinghelp wantedExtra attention is needed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions