Skip to content

Perf: Optimize shares loading by eliminating N+1 queries#2293

Merged
blizzz merged 2 commits intomainfrom
feature/optimize-shares-loading
Mar 3, 2026
Merged

Perf: Optimize shares loading by eliminating N+1 queries#2293
blizzz merged 2 commits intomainfrom
feature/optimize-shares-loading

Conversation

@Koc
Copy link
Contributor

@Koc Koc commented Jan 31, 2026

Current implementation SharesService::findTablesSharedWithMe() generates repeatable queries for each view/table/group/circle.

This PR optimizes loading of that data by execution single WHERE IN query for each entity, so we have constant queries count.

Inspired by #1749.

Next steps for optimization (separate PRs):

  • TableService::enhanceTable()
  • ViewService::enhanceView()

@Koc Koc force-pushed the feature/optimize-shares-loading branch 4 times, most recently from 0bef51a to dd7dd5e Compare February 1, 2026 16:07
@Koc Koc marked this pull request as ready for review February 1, 2026 16:08
@Koc Koc requested review from blizzz and enjeck as code owners February 1, 2026 16:08
@Koc Koc force-pushed the feature/optimize-shares-loading branch 2 times, most recently from d5ac3e9 to c77f89a Compare February 5, 2026 11:23
@Koc Koc force-pushed the feature/optimize-shares-loading branch from c77f89a to 50fdced Compare February 12, 2026 17:48
Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this approach! Left a few comments, but nothing big.

@Koc Koc force-pushed the feature/optimize-shares-loading branch 5 times, most recently from d4a78f3 to 5c55f11 Compare February 14, 2026 22:57
@Koc Koc force-pushed the feature/optimize-shares-loading branch 3 times, most recently from 859b352 to 98bb04a Compare February 16, 2026 23:18
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
@Koc Koc force-pushed the feature/optimize-shares-loading branch from 98bb04a to 93affa8 Compare March 2, 2026 10:07
… fixes)

Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
@Koc Koc force-pushed the feature/optimize-shares-loading branch from 93affa8 to da356e9 Compare March 2, 2026 17:09
@blizzz blizzz merged commit 5d8cc67 into main Mar 3, 2026
62 of 63 checks passed
@blizzz blizzz deleted the feature/optimize-shares-loading branch March 3, 2026 12:29
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.

2 participants