Added prosupport function for estimating numeric generate_series rows

songjinzhou <tsinghualucky912@foxmail.com>

From: 孤傲小二~阿沐 <tsinghualucky912@foxmail.com>
To: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Cc: japinli <japinli@hotmail.com>, jian.universality <jian.universality@gmail.com>
Date: 2024-11-28T07:46:47Z
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().

Attachments

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);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QUERY PLAN &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
----------------------------------------------------------------------
&nbsp;Function Scan on generate_series &nbsp;(cost=0.00..0.13 rows=13 width=32)
(1 row)


postgres=# explain SELECT * FROM generate_series(-25.0, -1.0); &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QUERY PLAN &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
----------------------------------------------------------------------
&nbsp;Function Scan on generate_series &nbsp;(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.