Targeted match query for the matcher create-path (avoid full-collection scans) #44
Labels
No labels
bug
enhancement
pr-split
question
security
transaction-matcher
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
momsse/octant#44
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up from the #100 review (epic #42).
Problem
The matcher create-path scans the full counterpart collection on every event:
TransactionMatchingSaga.matchTransaction→documentsQuery.findAllDocuments()+ in-memory amount/date filterDocumentMatchingSaga.matchDocument→bankTransactionsQuery.findAllBankTransactions()+ in-memory amount/date filterThis is O(N) per
BankTransactionCreated/DocumentAnalyzedevent. It was a deliberate simplification in #38 (#100) —DocumentsQueryShapeandBankTransactionsQueryShapeonly exposefindAll*, and exact-match needs amount + a date window, which isn't a single equality lookup. The drop-path was already moved to targeted queries (findByBankTransactionId/findByDocumentId) in that PR; only the create-path remains a scan.Proposed work
findByAmountWithinDateWindow({ amount, from, to }), with in-memory + Postgres adapters.read.documents (amount_minor, currency, issued_at)andread.bank_transactions (amount_minor, currency, value_date).findAll*.Not urgent
Fine at current data volumes; needed before the matcher runs against production-scale document/transaction sets.