Re: Added prosupport function for estimating numeric generate_series rows

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: songjinzhou <tsinghualucky912(at)foxmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, japinli <japinli(at)hotmail(dot)com>
Subject: Re: Added prosupport function for estimating numeric generate_series rows
Date: 2024-11-29 21:01:03
Message-ID: CAEZATCWW54Xqh-9bX0AQNEWQBQwqJ_gDt0KuMDyvi+bYv3RQkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 29 Nov 2024 at 13:10, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
>
> There are a couple more things that I think need tidying up. I'll post an update when I get back to my computer.
>

Here's an update with some cosmetic tidying up, plus a couple of
not-so-cosmetic changes:

The new #include wasn't in the right place alphabetically (the same is
true for the recent timestamp equivalent function).

It's not necessary to call init_var() for a variable that you're going
to initialise with init_var_from_num(), and it's then not necessary to
call free_var() for that variable.

It's not necessary to have separate NumericVars for the difference and
quotient -- the same variable can be reused.

Doing both those things means that there's only one variable to free
after the computation, and it can be kept local to if-step-not-zero
code block, so there's no need for the "goto cleanup" stuff.

It seems worth avoiding div_var() in the 2-argument case, when step = 1.

Regards,
Dean

Attachment Content-Type Size
v4-0001-Add-a-planner-support-function-for-numeric-genera.patch text/x-patch 11.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2024-11-29 22:21:08 Re: [PATCH] SVE popcount support
Previous Message Kirill Gavrilov 2024-11-29 20:57:38 Re: Truncate logs by max_log_size