#7136OPEN Issue
Scan `/v0/events` (`getEventHistory`) does one `listTransactionViews` query per verdict
stephencompall-DA04-09-2026Last activity 1d ago
ScanEventStore#getEvents fetches a page of verdicts, then makes one extra query per verdict in the page to fetch each verdict's transaction views:
Each of those calls is a separate query on scan_verdict_transaction_view_store:
Up to 1000 verdicts are fetched, so up to 1000 queries may be made.
Instead of the existing listTransactionViews, add a listTransactionViews(verdictRowIds: Seq[Long]) that uses isInClause and regroup the results in memory. It should use a limit of the length of verdictRowIds.
Compare to the existing example for AppActivityRecords:
This can be tested by comparing the results from traversing with the existing single-ID function to those from the batch function for equality.
Introduced by #2039.