Update comments in functions for statistics import in postgres_fdw.c

Поиск
Список
Период
Сортировка
Искать

Update comments in functions for statistics import in postgres_fdw.c

От:
Etsuro Fujita <etsuro.fujita@gmail.com>
Дата:
Вложения:
Hi,

I did s/attname/remote_attname/ to a comment in match_attrmap(), for
clarity, and added a comment to import_fetched_statistics().  I also
tweaked the comments for each of the two functions.

Best regards,
Etsuro Fujita

Re: Update comments in functions for statistics import in postgres_fdw.c

От:
Chao Li <li.evan.chao@gmail.com>
Дата:


> On Nov 9, 2026, at 17:35, Etsuro Fujita  wrote:
> 
> Hi,
> 
> I did s/attname/remote_attname/ to a comment in match_attrmap(), for
> clarity, and added a comment to import_fetched_statistics().  I also
> tweaked the comments for each of the two functions.
> 
> Best regards,
> Etsuro Fujita
> 


```
+	/*
+	 * ATTSTATS_NUM_FIELDS corresponds to the number of statistical value
+	 * parameters for import_attribute_statistics(), which is larger than that
+	 * for import_relation_statistics().  Therefore, a NullableDatum array of
+	 * that length is used to store data for each parameter in both functions.
+	 */
 	NullableDatum args[ATTSTATS_NUM_FIELDS];
```

I think this comment is slightly inaccurate. ATTSTATS_NUM_FIELDS is 14, including ATTSTATS_ATTNAME as 0. So the number of statistical value parameters is 13. import_attribute_statistics() needs 14 NullableDatatum including a “version” argument plus 13 statistical value parameters.

How about:
```
ATTSTATS_NUM_FIELDS equals the number of NullableDatum arguments
required by import_relation_statistics(). Use the same array for import_relation_statistics(),
which requires fewer arguments.
```

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Re: Update comments in functions for statistics import in postgres_fdw.c

От:
Etsuro Fujita <etsuro.fujita@gmail.com>
Дата:
On Tue, Nov 10, 2026 at 3:23 PM Chao Li  wrote:
> ```
> +       /*
> +        * ATTSTATS_NUM_FIELDS corresponds to the number of statistical value
> +        * parameters for import_attribute_statistics(), which is larger than that
> +        * for import_relation_statistics().  Therefore, a NullableDatum array of
> +        * that length is used to store data for each parameter in both functions.
> +        */
>         NullableDatum args[ATTSTATS_NUM_FIELDS];
> ```
>
> I think this comment is slightly inaccurate. ATTSTATS_NUM_FIELDS is 14, including ATTSTATS_ATTNAME as 0. So the number of statistical value parameters is 13. import_attribute_statistics() needs 14 NullableDatatum including a “version” argument plus 13 statistical value parameters.

As I understand it, you are saying we need to separate the version
parameter from statistical value parameters, but the comment for
import_attribute_statistics says:

 * Import attribute statistics from NullableDatum inputs for all statistical
 * values.
 *
 * For now, the 'version' argument is ignored. In the future it can be used
 * to interpret older statistics properly.

So IMU I think we are using the term "statistical value parameters" to
include the version parameter.  With that in mind, what I proposed is
not that bad...

Thanks for reviewing!

Best regards,
Etsuro Fujita


Re: Update comments in functions for statistics import in postgres_fdw.c

От:
Etsuro Fujita <etsuro.fujita@gmail.com>
Дата:
On Tue, Nov 10, 2026 at 6:50 PM Etsuro Fujita  wrote:
> As I understand it, you are saying we need to separate the version
> parameter from statistical value parameters, but the comment for
> import_attribute_statistics says:
>
>  * Import attribute statistics from NullableDatum inputs for all statistical
>  * values.
>  *
>  * For now, the 'version' argument is ignored. In the future it can be used
>  * to interpret older statistics properly.
>
> So IMU I think we are using the term "statistical value parameters" to
> include the version parameter.  With that in mind, what I proposed is
> not that bad...

I mean the term "statistical values" includes a version value.  Sorry.

Best regards,
Etsuro Fujita


Re: Update comments in functions for statistics import in postgres_fdw.c

От:
Chao Li <li.evan.chao@gmail.com>
Дата:


> On Nov 10, 2026, at 18:04, Etsuro Fujita  wrote:
> 
> On Tue, Nov 10, 2026 at 6:50 PM Etsuro Fujita  wrote:
>> As I understand it, you are saying we need to separate the version
>> parameter from statistical value parameters, but the comment for
>> import_attribute_statistics says:
>> 
>> * Import attribute statistics from NullableDatum inputs for all statistical
>> * values.
>> *
>> * For now, the 'version' argument is ignored. In the future it can be used
>> * to interpret older statistics properly.
>> 
>> So IMU I think we are using the term "statistical value parameters" to
>> include the version parameter.  With that in mind, what I proposed is
>> not that bad...
> 
> I mean the term "statistical values" includes a version value.  Sorry.
> 
> Best regards,
> Etsuro Fujita

I was considering the version parameter as metadata for the statistical values, which could be used to distinguish between different sets of statistical values. But I see your point now. Treating the version parameter as a statistical value parameter also makes sense to me. No objection from my side.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Re: Update comments in functions for statistics import in postgres_fdw.c

От:
Etsuro Fujita <etsuro.fujita@gmail.com>
Дата:
On Wed, Nov 11, 2026 at 9:39 AM Chao Li  wrote:
> > On Nov 10, 2026, at 18:04, Etsuro Fujita  wrote:
> > On Tue, Nov 10, 2026 at 6:50 PM Etsuro Fujita  wrote:
> >> As I understand it, you are saying we need to separate the version
> >> parameter from statistical value parameters, but the comment for
> >> import_attribute_statistics says:
> >>
> >> * Import attribute statistics from NullableDatum inputs for all statistical
> >> * values.
> >> *
> >> * For now, the 'version' argument is ignored. In the future it can be used
> >> * to interpret older statistics properly.

> > I mean the term "statistical values" includes a version value.  Sorry.

> I was considering the version parameter as metadata for the statistical values, which could be used to distinguish between different sets of statistical values. But I see your point now. Treating the version parameter as a statistical value parameter also makes sense to me. No objection from my side.

On reflection I changed my mind.  As pointed out by you, what I
proposed isn't very clear.  So I modified the patch based on your idea
(ie, s/statistical value parameters/NullableDatum arguments/), then
pushed/back-patched it.

Thanks again!

Best regards,
Etsuro Fujita


Re: Update comments in functions for statistics import in postgres_fdw.c

От:
Chao Li <li.evan.chao@gmail.com>
Дата:


> On Nov 12, 2026, at 10:29, Etsuro Fujita  wrote:
> 
> On Wed, Nov 11, 2026 at 9:39 AM Chao Li  wrote:
>>> On Nov 10, 2026, at 18:04, Etsuro Fujita  wrote:
>>> On Tue, Nov 10, 2026 at 6:50 PM Etsuro Fujita  wrote:
>>>> As I understand it, you are saying we need to separate the version
>>>> parameter from statistical value parameters, but the comment for
>>>> import_attribute_statistics says:
>>>> 
>>>> * Import attribute statistics from NullableDatum inputs for all statistical
>>>> * values.
>>>> *
>>>> * For now, the 'version' argument is ignored. In the future it can be used
>>>> * to interpret older statistics properly.
> 
>>> I mean the term "statistical values" includes a version value.  Sorry.
> 
>> I was considering the version parameter as metadata for the statistical values, which could be used to distinguish between different sets of statistical values. But I see your point now. Treating the version parameter as a statistical value parameter also makes sense to me. No objection from my side.
> 
> On reflection I changed my mind.  As pointed out by you, what I
> proposed isn't very clear.  So I modified the patch based on your idea
> (ie, s/statistical value parameters/NullableDatum arguments/), then
> pushed/back-patched it.
> 
> Thanks again!
> 
> Best regards,
> Etsuro Fujita

Cool!

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






FAQ