Thread
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add a planner support function for numeric generate_series().
- 97173536ed4b 18.0 landed
-
Added prosupport function for estimating numeric generate_series rows
songjinzhou <tsinghualucky912@foxmail.com> — 2024-11-28T07:46:47Z
Hello hackers, I saw a recent submission: Teach planner how to estimate rows for timestamp generate_series. I provide a patch for the numeric type here, and a simple test is as follows: postgres=# explain SELECT * FROM generate_series(-25.0, -1.0, 2.0); QUERY PLAN ---------------------------------------------------------------------- Function Scan on generate_series (cost=0.00..0.13 rows=13 width=32) (1 row) postgres=# explain SELECT * FROM generate_series(-25.0, -1.0); QUERY PLAN ---------------------------------------------------------------------- Function Scan on generate_series (cost=0.00..0.25 rows=25 width=32) (1 row) postgres=# I really want to know your thoughts, please give me feedback. Thank you.
-
Re: Added prosupport function for estimating numeric generate_series rows
Dean Rasheed <dean.a.rasheed@gmail.com> — 2024-11-28T13:56:10Z
On Thu, 28 Nov 2024 at 07:47, 孤傲小二~阿沐 <tsinghualucky912@foxmail.com> wrote: > > Hello hackers, I saw a recent submission: Teach planner how to estimate rows for timestamp generate_series. I provide a patch for the numeric type here, and a simple test is as follows: > > I really want to know your thoughts, please give me feedback. Thank you. > Good idea. Some random review comments: This should test for special inputs, NaN and infinity (it doesn't make sense to convert those to NumericVars). generate_series() produces an error for all such inputs, so the support function can just not produce an estimate for these cases (the same as when the step size is zero). NumericVars initialised using init_var() should be freed using free_var(). That can be avoided for the 3 inputs, by using init_var_from_num(), rather than set_var_from_num(), which saves copying digit arrays. It should then be possible to write this using a single additional allocated NumericVar and one init_var()/free_var() pair. There's no need to use floor(), since the div_var() call already produces a floored integer result. It could use some regression test cases. Regards, Dean