René's URL Explorer Experiment


Title: perf(audit-logs): index organization-level rows and read them as two keyset parts by waleedlatif1 · Pull Request #9437 · simstudioai/sim · GitHub

Open Graph Title: perf(audit-logs): index organization-level rows and read them as two keyset parts by waleedlatif1 · Pull Request #9437 · simstudioai/sim

X Title: perf(audit-logs): index organization-level rows and read them as two keyset parts by waleedlatif1 · Pull Request #9437 · simstudioai/sim

Description: Summary Fixes a regression from #9419 in the organization audit-log listing. #9419 reads a page's ids as one keyset scan per org workspace plus one organization-level branch (workspace_id IS NULL and the org named in metadata or as the resource). No index served that branch in order, so unless the organization had a page of org-level rows near the top, every listing walked every workspace-less audit row in the table, scattered across the heap. Listings got slower and long reads on the replica began hitting recovery-conflict cancellations Migration 0444 adds audit_log_org_level_created_at_id_idx, a partial index on (metadata->>'organizationId', date_trunc('milliseconds', created_at), id) WHERE workspace_id IS NULL AND metadata->>'organizationId' IS NOT NULL. It's built concurrently with the replay-safe invalid-index handling from 0442, and it only holds workspace-less rows that name an organization The org-level branch is split into two disjoint keyset parts: rows naming the org in metadata (read backward through the new index, stopping after a page) and organization-resource rows that don't (read through audit_log_resource_idx, a handful per org). The index alone isn't enough: under the single OR the planner bitmap-ORs both indexes and sorts every org-level row of the organization buildOrgScopeCondition (single-record read, data drain) is unchanged and shares the same two definitions of an org-level row Type of Change Bug fix Other: performance Testing New list-plans.integration.ts: many workspace-less rows from other organizations, then EXPLAINs the SQL queryAuditLogs sends (current members and departed, with and without a cursor). It asserts the metadata part reads the new index and nothing seeks workspace_id IS NULL, and that the index serves it as a backward scan with the cursor in the index condition. Fails on the previous query list-scope.integration.ts adds metadata-only, resource-only and both-matching rows (appear once) and a resource row naming another org, and pages across all parts at several page sizes against the single-predicate reference Autopsy: #9419's tests compared results only, on a fixture of a few dozen rows where walking every workspace-less row costs nothing; nothing asserted the org-level branch's plan Migration replayed with the index missing, valid and invalid; integration suites pass in migrate and push modes bun run lint, type-check, check:audits, check-test-types, check:migrations, drizzle-kit generate (no changes) 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 Fixes a regression from #9419 in the organization audit-log listing. #9419 reads a page's ids as one keyset scan per org workspace plus one organization-level branch (workspace_id IS N...

X Description: Summary Fixes a regression from #9419 in the organization audit-log listing. #9419 reads a page's ids as one keyset scan per org workspace plus one organization-level branch (workspace_id ...

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

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:e1237dde-6640-601e-7a38-c55ddee5fd89
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA9C6:20420B:41B6E:60663:6AFB09D5
html-safe-noncef5dac349ed98a66537d66b86fe80f65b3592d7732d5e3a66cafe3716cbdfc78b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUM2OjIwNDIwQjo0MUI2RTo2MDY2Mzo2QUZCMDlENSIsInZpc2l0b3JfaWQiOiIzNDUyMTg2NDExMzk3OTY0MzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac2dbb33cbd36e870a06ed1fb23b7c389070256278ae329d6b0376c0d863052858
hovercard-subject-tagpull_request:5063621145
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/9437/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 Fixes a regression from #9419 in the organization audit-log listing. #9419 reads a page's ids as one keyset scan per org workspace plus one organization-level branch (workspace_id IS N...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None76fb13cb43f1834708971f45a9cfcab5df3177a7582086613d7cdc6e98c4bfde
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
releaseafc998826cdd963c8f91a96ae5372809ab5e296b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/9437/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F9437%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%2F9437%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/9437/files
Reloadhttps://github.com/simstudioai/sim/pull/9437/files
Reloadhttps://github.com/simstudioai/sim/pull/9437/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/audit-log-org-level-indexhttps://github.com/simstudioai/sim/tree/perf/audit-log-org-level-index
Conversation 2 https://github.com/simstudioai/sim/pull/9437
Commits 1 https://github.com/simstudioai/sim/pull/9437/commits
Checks 67 https://github.com/simstudioai/sim/pull/9437/checks
Files changed https://github.com/simstudioai/sim/pull/9437/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9437/files
perf(audit-logs): index organization-level rows and read them as two keyset parts https://github.com/simstudioai/sim/pull/9437/files#top
Show all changes 1 commit https://github.com/simstudioai/sim/pull/9437/files
61fd152 perf(audit-logs): index organization-level rows and read them as two … waleedlatif1 Oct 29, 2026 https://github.com/simstudioai/sim/pull/9437/commits/61fd152d362074e97144ffc0972bcd2598b6754f
Clear filters https://github.com/simstudioai/sim/pull/9437/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9437/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9437/files
list-plans.integration.ts https://github.com/simstudioai/sim/pull/9437/files#diff-fc9a843d6678cf521118a48f98499ceed85ffd5ace30e7e26134f52bf6d6379b
list-scope.integration.ts https://github.com/simstudioai/sim/pull/9437/files#diff-7bdfdfcda5afd5cb85ffcec8ee6ec19df358afdbcdb3157df6efb690cd99736f
query.ts https://github.com/simstudioai/sim/pull/9437/files#diff-aaa2119362c512970c462bfb742bb07aede57d4c2a54911fc17fa26ed4f82800
0444_audit_log_org_level_created_at_id_idx.sql https://github.com/simstudioai/sim/pull/9437/files#diff-f388127c3371a35e53455e4b81cb5d93832e939fd885a817466dd35d4322225b
0444_snapshot.json https://github.com/simstudioai/sim/pull/9437/files#diff-b6a08add1a6ba0365c3d464eac778033a0a5f34357b9ef13b4123cee3d54663f
_journal.json https://github.com/simstudioai/sim/pull/9437/files#diff-37150cc65ad16ee6fbc5fa318fc096be7730e16d63eaf863e3df5521b7030649
schema.ts https://github.com/simstudioai/sim/pull/9437/files#diff-9a959e2ce3cb4c86957bbae021d06eae364f7b0cb18964f5873bab53220af928
explain.ts https://github.com/simstudioai/sim/pull/9437/files#diff-3451bc7f5ca17320150a86318e313f926a5011e2b31d1fa9c7904d1515b7b142
apps/sim/lib/audit-logs/list-plans.integration.tshttps://github.com/simstudioai/sim/pull/9437/files#diff-fc9a843d6678cf521118a48f98499ceed85ffd5ace30e7e26134f52bf6d6379b
View file https://github.com/simstudioai/sim/blob/61fd152d362074e97144ffc0972bcd2598b6754f/apps/sim/lib/audit-logs/list-plans.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9437/{{ revealButtonHref }}
apps/sim/lib/audit-logs/list-scope.integration.tshttps://github.com/simstudioai/sim/pull/9437/files#diff-7bdfdfcda5afd5cb85ffcec8ee6ec19df358afdbcdb3157df6efb690cd99736f
View file https://github.com/simstudioai/sim/blob/61fd152d362074e97144ffc0972bcd2598b6754f/apps/sim/lib/audit-logs/list-scope.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9437/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9437/files#diff-7bdfdfcda5afd5cb85ffcec8ee6ec19df358afdbcdb3157df6efb690cd99736f
https://github.com/simstudioai/sim/pull/9437/files#diff-7bdfdfcda5afd5cb85ffcec8ee6ec19df358afdbcdb3157df6efb690cd99736f
https://github.com/simstudioai/sim/pull/9437/files#diff-7bdfdfcda5afd5cb85ffcec8ee6ec19df358afdbcdb3157df6efb690cd99736f
https://github.com/simstudioai/sim/pull/9437/files#diff-7bdfdfcda5afd5cb85ffcec8ee6ec19df358afdbcdb3157df6efb690cd99736f
apps/sim/lib/audit-logs/query.tshttps://github.com/simstudioai/sim/pull/9437/files#diff-aaa2119362c512970c462bfb742bb07aede57d4c2a54911fc17fa26ed4f82800
View file https://github.com/simstudioai/sim/blob/61fd152d362074e97144ffc0972bcd2598b6754f/apps/sim/lib/audit-logs/query.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9437/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9437/files#diff-aaa2119362c512970c462bfb742bb07aede57d4c2a54911fc17fa26ed4f82800
https://github.com/simstudioai/sim/pull/9437/files#diff-aaa2119362c512970c462bfb742bb07aede57d4c2a54911fc17fa26ed4f82800
https://github.com/simstudioai/sim/pull/9437/files#diff-aaa2119362c512970c462bfb742bb07aede57d4c2a54911fc17fa26ed4f82800
https://github.com/simstudioai/sim/pull/9437/files#diff-aaa2119362c512970c462bfb742bb07aede57d4c2a54911fc17fa26ed4f82800
https://github.com/simstudioai/sim/pull/9437/files#diff-aaa2119362c512970c462bfb742bb07aede57d4c2a54911fc17fa26ed4f82800
packages/db/migrations/0444_audit_log_org_level_created_at_id_idx.sqlhttps://github.com/simstudioai/sim/pull/9437/files#diff-f388127c3371a35e53455e4b81cb5d93832e939fd885a817466dd35d4322225b
View file https://github.com/simstudioai/sim/blob/61fd152d362074e97144ffc0972bcd2598b6754f/packages/db/migrations/0444_audit_log_org_level_created_at_id_idx.sql
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9437/{{ revealButtonHref }}
Please reload this pagehttps://github.com/simstudioai/sim/pull/9437/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9437/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.