Skip to content

Comments

fix(analytics): scope logSummary subquery to avoid full table scan and Drizzle ref conflict#427

Merged
eskp merged 1 commit intostagingfrom
fix/analytics-drizzle-subquery-scope
Feb 24, 2026
Merged

fix(analytics): scope logSummary subquery to avoid full table scan and Drizzle ref conflict#427
eskp merged 1 commit intostagingfrom
fix/analytics-drizzle-subquery-scope

Conversation

@eskp
Copy link
Member

@eskp eskp commented Feb 24, 2026

Summary

  • Scope the logSummary derived subquery in fetchWorkflowRuns to only aggregate logs for the current org's executions within the time range
  • Use an IN subquery (scopedExecutionIds) instead of innerJoin(workflowExecutions) to avoid Drizzle's table reference conflict when the same table appears in both a .as() subquery and the outer query

Without this fix, the subquery either scans the entire workflow_execution_logs table (performance regression) or throws "tried to reference field from a subquery" at runtime when scoped via innerJoin.

Test plan

  • Verify analytics dashboard loads without the "Failed to fetch analytics runs" error
  • Confirm gas data, network, and transaction hash display correctly on workflow runs
  • Check pagination still works on the runs list

@eskp eskp merged commit 0c09364 into staging Feb 24, 2026
4 checks passed
@eskp eskp deleted the fix/analytics-drizzle-subquery-scope branch February 24, 2026 13:02
@github-actions
Copy link

🧹 PR Environment Cleaned Up

The PR environment has been successfully deleted.

Deleted Resources:

  • Namespace: pr-427
  • All Helm releases (Keeperhub, Scheduler, Event services)
  • PostgreSQL Database (including data)
  • LocalStack, Redis
  • All associated secrets and configs

All resources have been cleaned up and will no longer incur costs.

@github-actions
Copy link

ℹ️ No PR Environment to Clean Up

No PR environment was found for this PR. This is expected if:

  • The PR never had the deploy-pr-environment label
  • The environment was already cleaned up
  • The deployment never completed successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant