[PATCH] analyze: move elevel calculation into do_analyze_rel()

Started by Lev Nikolaev6 months ago4 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliesbuild failedCI history

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t139178_3 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t139178_3 && git checkout t139178_3

Patchset v3 (message #3) is on t139178_3

Jump to latest
#1Lev Nikolaev
lev.nikolaev@tantorlabs.com

Attachments:

0001-analyze-move-elevel-calculation-into-do_analyze_rel.patchtext/x-diff; name=0001-analyze-move-elevel-calculation-into-do_analyze_rel.patchDownload+12-13
#2Lev Nikolaev
lev.nikolaev@tantorlabs.com
In reply to: Lev Nikolaev (#1)
Re: [PATCH] analyze: move elevel calculation into do_analyze_rel()

Hi hackers,

I reworked the patch slightly.

Since do_analyze_rel() is static, removing the extra elevel argument is
local to analyze.c only. No behavioral change is intended.

--

Best regards,

Lev Nikolaev,

Tantor Labs LLC,

https://tantorlabs.com/

30.03.2026 16:03, Лев Николаев пишет:

Show quoted text

Hi hackers,

While reading analyze.c in current master, I noticed a small cleanup
opportunity in the ANALYZE code path.

Currently, analyze_rel() computes elevel from params.options, but does
not use it directly. It only passes the value down to
do_analyze_rel(). At the same time, do_analyze_rel() already receives
params and derives verbose from params.options for its own purposes.

The attached patch moves the elevel calculation into do_analyze_rel()
and removes the extra elevel argument from its declaration,
definition, and call sites.

No behavioral change is intended here. The logging level selection
remains the same; the calculation is just moved closer to the actual
use sites.

Comments and feedback would be appreciated.

--

Best regards,

Lev Nikolaev,

Tantor Labs LLC,

https://tantorlabs.com/

Attachments:

0001-analyze-move-elevel-calculation-into-do_analyze_rel.patchtext/x-patch; charset=UTF-8; name=0001-analyze-move-elevel-calculation-into-do_analyze_rel.patchDownload+13-14
#3Andreas Karlsson
andreas.karlsson@percona.com
In reply to: Lev Nikolaev (#2)
Re: [PATCH] analyze: move elevel calculation into do_analyze_rel()

On 3/31/26 7:56 PM, Lev Nikolaev wrote:

I reworked the patch slightly.

This small cleanup makes sense to me since do_analyze_rel() already
looks at if VACOPT_VERBOSE is set meaning related code is grouped closer
after this small refactoring.

The patch no longer applied so I rebased it.

Andreas

Attachments:

t139178_3
v3-0001-analyze-move-elevel-calculation-into-do_analyze_r.patchtext/x-patch; charset=UTF-8; name=v3-0001-analyze-move-elevel-calculation-into-do_analyze_r.patchDownload+13-14
#4Etsuro Fujita
fujita.etsuro@lab.ntt.co.jp
In reply to: Andreas Karlsson (#3)
Re: [PATCH] analyze: move elevel calculation into do_analyze_rel()

On Thu, Apr 2, 2026 at 8:29 AM Andreas Karlsson <andreas@proxel.se> wrote:

On 3/31/26 7:56 PM, Lev Nikolaev wrote:

I reworked the patch slightly.

This small cleanup makes sense to me since do_analyze_rel() already
looks at if VACOPT_VERBOSE is set meaning related code is grouped closer
after this small refactoring.

The patch no longer applied so I rebased it.

Sorry, but -1 from me because this change would lead to doing the same
setup repeatedly when analyzing inheritance trees, which is not great.

Best regards,
Etsuro Fujita