Re: Re: Added prosupport function for estimating numeric generate_series rows

songjinzhou <tsinghualucky912@foxmail.com>

From: "tsinghualucky912@foxmail.com" <tsinghualucky912@foxmail.com>
To: dean.a.rasheed <dean.a.rasheed@gmail.com>, dgrowleyml <dgrowleyml@gmail.com>
Cc: tgl <tgl@sss.pgh.pa.us>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>, japinli <japinli@hotmail.com>
Date: 2024-11-30T00:38:48Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add a planner support function for numeric generate_series().

On 2024-11-30, Dean Rasheed wrote:
On Fri, 29 Nov 2024 at 13:10, Dean Rasheed <dean.a.rasheed@gmail.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

Dear Dean Rasheed, I have reviewed the v4 patch and it is very thoughtful and reasonable, with a very clever attention to detail (plus I am very happy that we can get rid of the goto, which I was not a big fan of).

This patch looks very good and I have no complaints about it. Thanks again for your help from beginning to end!



Regards, Song Jinzhou