Skip to content

fix: add hints to planner hook - #267

Merged
AndrewJackson2020 merged 10 commits into
masterfrom
fix_view_hints
Nov 10, 2026
Merged

AndrewJackson2020 merged 10 commits into
masterfrom
fix_view_hints

Conversation

@AndrewJackson2020

@AndrewJackson2020 AndrewJackson2020 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

When attempting to bump postgres minor versions in supautils CI in #263 we discovered that the planner hook functionality was broken for more recent releases of postgres minor versions. We knew that this was broken for postgres major versions 18 and 19 but the patch that caused those to be broken was a CVE fix so they were also applied to postgres minor versions 17, 16, etc.

This PR attempts to fix this. Basically the issue is that for views ACL is checked during the planning stage and it never gets to the execution stage. As a result we need a new planner hook.

Another option maybe we should deprecate this functionality entirely as #264 suggests. See also #182.

@AndrewJackson2020
AndrewJackson2020 requested a review from a team as a code owner October 28, 2026 21:22
Comment thread src/supautils.c Resolved
Comment thread src/supautils.c Resolved
@AndrewJackson2020

Copy link
Copy Markdown
Contributor Author

Question for the reviewers: do we need to validate the performance before merging this? How risky is it adding an extra hook with this PR?

@steve-chavez

Copy link
Copy Markdown
Member

@AndrewJackson2020 There are pgbench tests on https://github.com/supabase/supautils/actions/runs/41881805022?pr=267#summary-126755889292 to see the performance impact

@steve-chavez

Copy link
Copy Markdown
Member

Results look a bit flaky, perhaps you can try them locally?

Comment thread src/supautils.c Resolved
@AndrewJackson2020

Copy link
Copy Markdown
Contributor Author

Results look a bit flaky, perhaps you can try them locally?

I think I fixed it. Might raise it as a separate PR.

@AndrewJackson2020

Copy link
Copy Markdown
Contributor Author

I think I fixed it. Might raise it as a separate PR.

#271

@AndrewJackson2020

Copy link
Copy Markdown
Contributor Author

Results look a bit flaky, perhaps you can try them locally?

I think we probably shouldn't be running benchmarks on GitHub runners. At a minimum we should be running on blacksmith. Not sure if running on my macOS laptop is the best either. Some issues that come up for me:

  • Does the laptop sleeping have an impact on performance
  • Since these are going to be run on linux in prod environments we probably want to run benchmarking on linux machines

I don't have a better solution to this right now though.

That said here are the results that I see attached when running locally. Probably the most concerning thing that I see is from supautils-loadtest-select which actually tests the hint behavior.

fix_view_hints branch: tps = 42831.875820 (without initial connection time)
master branch: tps = .222303 (without initial connection time)

Around a 3-4 percent drop in perf. Is this acceptable in exchange for fixing a broken feature?

supautils_load_test.md

@steve-chavez

Copy link
Copy Markdown
Member

At a minimum we should be running on blacksmith

Agree, at least for the loadtests we should switch.

Around a 3-4 percent drop in perf. Is this acceptable in exchange for fixing a broken feature?

It's around the same impact I noticed before with the executor hook, should be fine since it only affects the roles in hint_roles.

@utkarash2991

Copy link
Copy Markdown
Contributor

@AndrewJackson2020 any blocker for merging this one ? Asking as this is needed by : #260 .

@AndrewJackson2020

Copy link
Copy Markdown
Contributor Author

@AndrewJackson2020 any blocker for merging this one ? Asking as this is needed by : #260 .

I don't think so, just need 10 minutes to do a final checkout of the code.

@AndrewJackson2020

Copy link
Copy Markdown
Contributor Author

Only thing that I can see here that can be improved is there is a lot of duplicated code between supautils_planner and the executor planner. I think duplicated code in 2 places is probably fine for now though.

@AndrewJackson2020
AndrewJackson2020 merged commit 3bf2bed into master Nov 10, 2026
21 checks passed
@AndrewJackson2020
AndrewJackson2020 deleted the fix_view_hints branch November 10, 2026 14:30
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.

3 participants