René's URL Explorer Experiment


Title: perf(admin): read dashboard ledger usage one bounded scan per entity by waleedlatif1 · Pull Request #9448 · simstudioai/sim · GitHub

Open Graph Title: perf(admin): read dashboard ledger usage one bounded scan per entity by waleedlatif1 · Pull Request #9448 · simstudioai/sim

X Title: perf(admin): read dashboard ledger usage one bounded scan per entity by waleedlatif1 · Pull Request #9448 · simstudioai/sim

Description: Summary The admin dashboard computed each page's per-entity spend and workflow runs in one statement that OR'd every entity's period together. The planner answers that with a BitmapOr and a heap fetch for every matched ledger row, or with a scan over every organization entry in the period index, filtered row by row. Both run on the primary. Each read is now a UNION ALL with one arm per entity. Every arm is bounded by that entity's period on the existing indexes: usage_log_billing_entity_period_cost_idx for stamped periods and usage_log_billing_entity_created_at_cost_idx for reporting periods. Spend is index-only. Workflow runs are a separate statement on the same indexes. No index carries execution_id, so this statement fetches each matched workflow row from the heap. Keeping it separate leaves the spend scans index-only. A dedicated index was rejected: it would add a write to every workflow ledger insert to speed up a staff-only page. The four copies of the period predicate are consolidated. The org list, org summary/detail, historical actors and personal users views now use buildUsageAnalyticsScope, which already defines the reporting-vs-stamped period predicate for usage analytics. The reads stay on the primary. The replica serves these index pages from disk rather than cache, and it cancels statements held past its replay delay (recovery conflicts). The largest entities' periods can reach that delay. What the dashboard shows is unchanged. A workflow run is still a distinct execution_id among the entity's source = 'workflow' ledger rows in the period. Execution logs are not a substitute: they are subject to retention, they include runs with no billed lines, and they don't record which entity a run was billed to. No schema change. Type of Change Bug fix New feature Breaking change Documentation Other: performance Testing dashboard-usage.integration.ts runs against real Postgres. It checks spend and run counts per entity, per user, filtered by user, and for historical actors. The seed covers: multi-row executions zero-cost runs a run whose rows have two different actors non-workflow sources and workflow-test workflow rows with a null execution_id rows stamped with the previous period a resumed run stamped with a period that has since ended rows billed to a user entity with the same id, or to no entity reporting-period start/end boundaries a run billed partly to another entity duplicate windows A local differential run (not committed) compared the new readers with the previous OR'd queries on 400k randomized ledger rows across 25 organizations and 25 user entities, mixing stamped and reporting periods. Results were identical for all four reads. Spend arms planned as Index Only Scans with zero heap fetches; run-count arms planned as Index Scans bounded per entity. Against the production planner (plain EXPLAIN on the primary), for a large yearly reporting period plus a stamped period: The previous statement scanned every organization entry in the period index and filtered it. The spend arms are now Index Only Scans bounded by entity and period. The run-count arms are Index Scans with entity, period and source in the index condition. There is no sequential scan anywhere. check:migrations (no new migrations), drizzle-kit generate (no changes), check:audits, type-check, lint, and the lib/admin unit tests all pass. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary The admin dashboard computed each page's per-entity spend and workflow runs in one statement that OR'd every entity's period together. The planner answers that with a BitmapOr a...

X Description: Summary The admin dashboard computed each page's per-entity spend and workflow runs in one statement that OR'd every entity's period together. The planner answers that with ...

Opengraph URL: https://github.com/simstudioai/sim/pull/9448

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:f02072fc-eff8-8cbb-f5c8-cb8e1a2c5439
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idACA0:12D29A:8B3DC:CF0E8:6AFB1976
html-safe-nonce416a52af757526e196052f55f1d8d40fc17217ea00b37bd8f85831351dd0b0cf
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0EwOjEyRDI5QTo4QjNEQzpDRjBFODo2QUZCMTk3NiIsInZpc2l0b3JfaWQiOiI1OTY4MjE2ODQ4OTk3MjI2ODcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac9b7c844519a98e9dc4655fde8b8d399e60c247ad6fba435c94e8570760355ec8
hovercard-subject-tagpull_request:5073510008
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/9448/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary The admin dashboard computed each page's per-entity spend and workflow runs in one statement that OR'd every entity's period together. The planner answers that with a BitmapOr a...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None24933791aba0f10b2f189f8b953a1452dd79933933ac13a0a67b8ad3acee3d9f
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release030711cc180b563614a434f4376acf7da5d445fa
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/9448/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F9448%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F9448%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/9448/files
Reloadhttps://github.com/simstudioai/sim/pull/9448/files
Reloadhttps://github.com/simstudioai/sim/pull/9448/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests198 (198)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
perf/admin-dashboard-usage-readshttps://github.com/simstudioai/sim/tree/perf/admin-dashboard-usage-reads
Conversation 11 https://github.com/simstudioai/sim/pull/9448
Commits 2 https://github.com/simstudioai/sim/pull/9448/commits
Checks 68 https://github.com/simstudioai/sim/pull/9448/checks
Files changed https://github.com/simstudioai/sim/pull/9448/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9448/files
perf(admin): read dashboard ledger usage one bounded scan per entity https://github.com/simstudioai/sim/pull/9448/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/9448/files
9d61bef perf(admin): read dashboard spend and workflow runs index-only waleedlatif1 Oct 29, 2026 https://github.com/simstudioai/sim/pull/9448/commits/9d61bef5be0ada2858dcbf6284c61e08a7124505
454e62a perf(admin): count dashboard workflow runs on the existing ledger ind… waleedlatif1 Oct 29, 2026 https://github.com/simstudioai/sim/pull/9448/commits/454e62a53d27f8ba914fc5de9f08f2fe4ace6e96
Clear filters https://github.com/simstudioai/sim/pull/9448/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9448/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9448/files
dashboard-organizations.test.ts https://github.com/simstudioai/sim/pull/9448/files#diff-9dfb75e45b7cecb45ab8066fae0533ab0f1605d2abbc379fdcb2b422bf0aeb4c
dashboard-usage.integration.ts https://github.com/simstudioai/sim/pull/9448/files#diff-1760dcde0ca571c8f908223f87030f5b795aa249738dd1929ead2b0a360d5e21
dashboard-usage.ts https://github.com/simstudioai/sim/pull/9448/files#diff-0222c6f6951ae11a0c8b47738a7720051ac96eb82693a6fa8e6a3641e855fd57
dashboard.ts https://github.com/simstudioai/sim/pull/9448/files#diff-5c387d1340d6c2018ddbd5f5b624f978ebc0ac158ea97ef66de7dfc9586d07dc
apps/sim/lib/admin/dashboard-organizations.test.tshttps://github.com/simstudioai/sim/pull/9448/files#diff-9dfb75e45b7cecb45ab8066fae0533ab0f1605d2abbc379fdcb2b422bf0aeb4c
View file https://github.com/simstudioai/sim/blob/454e62a53d27f8ba914fc5de9f08f2fe4ace6e96/apps/sim/lib/admin/dashboard-organizations.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9448/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9448/files#diff-9dfb75e45b7cecb45ab8066fae0533ab0f1605d2abbc379fdcb2b422bf0aeb4c
https://github.com/simstudioai/sim/pull/9448/files#diff-9dfb75e45b7cecb45ab8066fae0533ab0f1605d2abbc379fdcb2b422bf0aeb4c
https://github.com/simstudioai/sim/pull/9448/files#diff-9dfb75e45b7cecb45ab8066fae0533ab0f1605d2abbc379fdcb2b422bf0aeb4c
https://github.com/simstudioai/sim/pull/9448/files#diff-9dfb75e45b7cecb45ab8066fae0533ab0f1605d2abbc379fdcb2b422bf0aeb4c
apps/sim/lib/admin/dashboard-usage.integration.tshttps://github.com/simstudioai/sim/pull/9448/files#diff-1760dcde0ca571c8f908223f87030f5b795aa249738dd1929ead2b0a360d5e21
View file https://github.com/simstudioai/sim/blob/454e62a53d27f8ba914fc5de9f08f2fe4ace6e96/apps/sim/lib/admin/dashboard-usage.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9448/{{ revealButtonHref }}
Please reload this pagehttps://github.com/simstudioai/sim/pull/9448/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9448/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.