Re: Added prosupport function for estimating numeric generate_series rows

From: 孤傲小二~阿沐 <tsinghualucky912(at)foxmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: 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-28 17:23:37
Message-ID: tencent_1F6D5B9A1545E02FD7D0EE508DFD056DE50A@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, thank you very much for your attention and guidance. I have modified and improved the problem you mentioned. The patch of version v2 is attached below.&nbsp;

Regarding regression testing, I implemented it with the help of some facilities of generate_series_timestamp_support last time. Everything is normal in Cirrus CI test.

Looking forward to your reply, thank you very much.

原始邮件


发件人: "Dean Rasheed" <dean(dot)a(dot)rasheed(at)gmail(dot)com&gt;
发件时间: 2024年11月28日 21:56
收件人: "孤傲小二~阿沐" <tsinghualucky912(at)foxmail(dot)com&gt;
抄送: "pgsql-hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org&gt; , "japinli" <japinli(at)hotmail(dot)com&gt; , "jian.universality" <jian(dot)universality(at)gmail(dot)com&gt;
主题: Re: Added prosupport function for estimating numeric generate_series rows

On Thu, 28 Nov 2024 at 07:47, 孤傲小二~阿沐 wrote:
&gt;
&gt; 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:
&gt;
&gt; I really want to know your thoughts, please give me feedback. Thank you.
&gt;

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

Attachment Content-Type Size
v2_0001-Added-prosupport-function-for-estimating-numeric-gen.patch application/octet-stream 10.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2024-11-28 18:00:01 Re: POC, WIP: OR-clause support for indexes
Previous Message Robert Haas 2024-11-28 17:18:54 Re: Changing shared_buffers without restart