| From: | Andrei Lepikhov <lepihov(at)gmail(dot)com> |
|---|---|
| To: | shihao zhong <zhong950419(at)gmail(dot)com>, Priyanka S <developerette(at)gmail(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [PATCH] Planner support function for generate_subscripts() |
| Date: | 2026-09-08 10:07:48 |
| Message-ID: | fbf72e54-8db2-4377-8ec5-3d8e1deca75d@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 08/09/2026 03:21, shihao zhong wrote:
> * A dimension above the first is asked for on an array that is not a
> constant. One dimension of an array is never longer than the whole
> array, so a large number is wrong here.
>
> 1000 fits neither case.
>
> I kept 0002 as its own patch. It only changes a number in the catalog,
> and 0001 does not need it. If people do not agree on the number, 0001
> can still go in.
I'd say that detecting the estimate_array_length's default value for the rows
number and returning constant 1000 as used before might make life of engineers
easier and query plans more stable during upgrade.
Hence, maybe it makes sense to follow the way of group-by estimations -
introduce something like one more 'isdefault' parameter to the
estimate_array_length?
Basically, this code looks good. But I'd like to see more assertions: if
something will be changed at the functions itself it would more quickly detect
issues in the prosupport routine. For example:
- Assert(req->root != NULL);
- Type of arg2
- Potentially, no more than 3 arguments of the function
- Maybe hard oid check on F_GENERATE_SUBSCRIPTS / F_GENERATE_SUBSCRIPTS_NODIR
This topic also raises the question of the practical usability of the average
total number of elements in an array column. Your tests highlight a gap in
estimates for more than two dimensions.
regards, Andrei Lepikhov,
pgEdge
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-09-08 10:08:52 | Use C11 alignas instead of palloc/malloc for alignment |
| Previous Message | Ajit Awekar | 2026-09-08 10:03:15 | Re: Allow table AMs to define their own reloptions |