Remove unused rel parameter in lookup_var_attr_stats

Started by Ilia Evdokimovabout 1 year ago4 messages
#1Ilia Evdokimov
ilya.evdokimov@tantorlabs.com
1 attachment(s)

Hi hackers,

I've attached a small patch that remove unused parameter 'rel' from
the static function lookup_var_attr_stats() in extended_stats.c

While exploring src/backend/statistics, I noticed that there are several
other parameters which appear to be unused. However, since the
discussion around import/export statistics [1]/messages/by-id/CADkLM=cB0rF3p_FuWRTMSV0983ihTRpsH+OCpNyiqE7Wk0vUWA@mail.gmail.com attribute_stats.c is
still ongoing and many functions from other files are non-static, those
parameters may yet prove useful. Therefore, I'm only removing the
parameter from this static function.

Any thoughts?

[1]: /messages/by-id/CADkLM=cB0rF3p_FuWRTMSV0983ihTRpsH+OCpNyiqE7Wk0vUWA@mail.gmail.com
/messages/by-id/CADkLM=cB0rF3p_FuWRTMSV0983ihTRpsH+OCpNyiqE7Wk0vUWA@mail.gmail.com

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.

Attachments:

v1-0001-Remove-unused-rel-parameter-in-lookup_var_attr_stats.patchtext/x-patch; charset=UTF-8; name=v1-0001-Remove-unused-rel-parameter-in-lookup_var_attr_stats.patchDownload
From a59af002463c962f153c79202b5f091a24fa6199 Mon Sep 17 00:00:00 2001
From: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>
Date: Fri, 3 Jan 2025 16:46:51 +0300
Subject: [PATCH] Remove unused rel parameter in lookup_var_attr_stats

The rel parameter in lookup_var_attr_stats is unused, so remove it.
This is a static function, so the parameter can easily be added again if
it's ever needed.
---
 src/backend/statistics/extended_stats.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index aeec3ece41..34dcb535e1 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -74,7 +74,7 @@ typedef struct StatExtEntry
 
 
 static List *fetch_statentries_for_relation(Relation pg_statext, Oid relid);
-static VacAttrStats **lookup_var_attr_stats(Relation rel, Bitmapset *attrs, List *exprs,
+static VacAttrStats **lookup_var_attr_stats(Bitmapset *attrs, List *exprs,
 											int nvacatts, VacAttrStats **vacatts);
 static void statext_store(Oid statOid, bool inh,
 						  MVNDistinct *ndistinct, MVDependencies *dependencies,
@@ -165,7 +165,7 @@ BuildRelationExtStatistics(Relation onerel, bool inh, double totalrows,
 		 * Check if we can build these stats based on the column analyzed. If
 		 * not, report this fact (except in autovacuum) and move on.
 		 */
-		stats = lookup_var_attr_stats(onerel, stat->columns, stat->exprs,
+		stats = lookup_var_attr_stats(stat->columns, stat->exprs,
 									  natts, vacattrstats);
 		if (!stats)
 		{
@@ -293,7 +293,7 @@ ComputeExtStatisticsRows(Relation onerel,
 		 * analyzed. If not, ignore it (don't report anything, we'll do that
 		 * during the actual build BuildRelationExtStatistics).
 		 */
-		stats = lookup_var_attr_stats(onerel, stat->columns, stat->exprs,
+		stats = lookup_var_attr_stats(stat->columns, stat->exprs,
 									  natts, vacattrstats);
 
 		if (!stats)
@@ -687,7 +687,7 @@ examine_expression(Node *expr, int stattarget)
  * indicate to the caller that the stats should not be built.
  */
 static VacAttrStats **
-lookup_var_attr_stats(Relation rel, Bitmapset *attrs, List *exprs,
+lookup_var_attr_stats(Bitmapset *attrs, List *exprs,
 					  int nvacatts, VacAttrStats **vacatts)
 {
 	int			i = 0;
-- 
2.34.1

#2Fabrízio de Royes Mello
fabriziomello@gmail.com
In reply to: Ilia Evdokimov (#1)
Re: Remove unused rel parameter in lookup_var_attr_stats

On Fri, Jan 3, 2025 at 11:09 AM Ilia Evdokimov <
ilya.evdokimov@tantorlabs.com> wrote:

Hi hackers,

I've attached a small patch that remove unused parameter 'rel' from
the static function lookup_var_attr_stats() in extended_stats.c

While exploring src/backend/statistics, I noticed that there are several
other parameters which appear to be unused. However, since the
discussion around import/export statistics [1] attribute_stats.c is
still ongoing and many functions from other files are non-static, those
parameters may yet prove useful. Therefore, I'm only removing the
parameter from this static function.

LGTM looks like a leftover from a4d75c86.

Regards,

--
Fabrízio de Royes Mello

#3Ilia Evdokimov
ilya.evdokimov@tantorlabs.com
In reply to: Fabrízio de Royes Mello (#2)
Re: Remove unused rel parameter in lookup_var_attr_stats

On 03.01.2025 18:42, Fabrízio de Royes Mello wrote:

On Fri, Jan 3, 2025 at 11:09 AM Ilia Evdokimov
<ilya.evdokimov@tantorlabs.com> wrote:

Hi hackers,

I've attached a small patch that remove unused parameter 'rel' from
the static function lookup_var_attr_stats() in extended_stats.c

While exploring src/backend/statistics, I noticed that there are
several
other parameters which appear to be unused. However, since the
discussion around import/export statistics [1] attribute_stats.c is
still ongoing and many functions from other files are non-static,
those
parameters may yet prove useful. Therefore, I'm only removing the
parameter from this static function.

LGTM looks like a leftover from a4d75c86.

Regards,

--
Fabrízio de Royes Mello

True. Moreover, I checked the commit and found nothing else.

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.

#4Richard Guo
guofenglinux@gmail.com
In reply to: Ilia Evdokimov (#1)
Re: Remove unused rel parameter in lookup_var_attr_stats

On Fri, Jan 3, 2025 at 11:09 PM Ilia Evdokimov
<ilya.evdokimov@tantorlabs.com> wrote:

I've attached a small patch that remove unused parameter 'rel' from
the static function lookup_var_attr_stats() in extended_stats.c

LGTM. It's a static function, and we can easily add this parameter
back if it's ever needed.

Thanks
Richard