public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ilia Evdokimov <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: Removing unused parameter in compute_expr_stats
Date: Thu, 26 Dec 2024 12:40:52 +0300
Message-ID: <[email protected]> (raw)

Hi hackers,

I'm sharing a small patch that removes an unused parameter (totalrows) 
from compute_expr_stats function in extended_stats.c .

This function originally appeared in commit 
a4d75c86bf15220df22de0a92c819ecef9db3849, which introduced extended 
statistics on expressions. From what I can see, total rows is never used 
in the current implementation, so this patch removes it

If there are reasons to keep this parameter, or if there's anything I 
might have missed, I'd be happy to discuss further.

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



Attachments:

  [text/x-patch] v1-0001-Remove-unused-parameter-in-compute_expr_stats.patch (2.2K, ../[email protected]/2-v1-0001-Remove-unused-parameter-in-compute_expr_stats.patch)
  download | inline diff:
From 0de17516bec761474761bf2862724b23ccb11beb Mon Sep 17 00:00:00 2001
From: Ilia Evdokimov <[email protected]>
Date: Thu, 26 Dec 2024 12:09:14 +0300
Subject: [PATCH v1] Remove unused totalrows parameter in compute_expr_stats

The totalrows parameter in compute_expr_stats is never referenced anyway
in the function or by its callers. It appears to have been introduced in
commit a4d75c86bf15220df22de0a92c819ecef9db3849, but it remained unused
---
 src/backend/statistics/extended_stats.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 99fdf208db..85da3edb10 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -89,9 +89,8 @@ typedef struct AnlExprData
 	VacAttrStats *vacattrstat;	/* statistics attrs to analyze */
 } AnlExprData;
 
-static void compute_expr_stats(Relation onerel, double totalrows,
-							   AnlExprData *exprdata, int nexprs,
-							   HeapTuple *rows, int numrows);
+static void compute_expr_stats(Relation onerel, AnlExprData *exprdata,
+							   int nexprs, HeapTuple *rows, int numrows);
 static Datum serialize_expr_stats(AnlExprData *exprdata, int nexprs);
 static Datum expr_fetch_func(VacAttrStatsP stats, int rownum, bool *isNull);
 static AnlExprData *build_expr_data(List *exprs, int stattarget);
@@ -220,8 +219,7 @@ BuildRelationExtStatistics(Relation onerel, bool inh, double totalrows,
 				exprdata = build_expr_data(stat->exprs, stattarget);
 				nexprs = list_length(stat->exprs);
 
-				compute_expr_stats(onerel, totalrows,
-								   exprdata, nexprs,
+				compute_expr_stats(onerel, exprdata, nexprs,
 								   rows, numrows);
 
 				exprstats = serialize_expr_stats(exprdata, nexprs);
@@ -2107,9 +2105,8 @@ examine_opclause_args(List *args, Node **exprp, Const **cstp,
  * Compute statistics about expressions of a relation.
  */
 static void
-compute_expr_stats(Relation onerel, double totalrows,
-				   AnlExprData *exprdata, int nexprs,
-				   HeapTuple *rows, int numrows)
+compute_expr_stats(Relation onerel, AnlExprData *exprdata,
+				   int nexprs, HeapTuple *rows, int numrows)
 {
 	MemoryContext expr_context,
 				old_context;
-- 
2.34.1



view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Removing unused parameter in compute_expr_stats
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox