Hi, It looks like this field was write-only since its introduction in 3592e0ff98b. The proposed patch removes dead code.
-- Best regards, Aleksander Alekseev
From 71216a8585aa44ad11cb80ad5d77b5877d0d0e80 Mon Sep 17 00:00:00 2001 From: Aleksander Alekseev <[email protected]> Date: Mon, 3 Aug 2026 15:13:49 +0300 Subject: [PATCH v1] Remove unused PartitionDescData.last_found_part_index field The field was set in get_partition_for_tuple() and initialized by RelationBuildPartitionDesc(), but it was never read. The cache-hit paths of get_partition_for_tuple() obtain the partition index from boundinfo->indexes[] instead, so the field has been write-only ever since it was introduced in 3592e0ff98b. Author: Aleksander Alekseev <[email protected]> Reviewed-by: TODO FIXME Discussion: TODO FIXME --- src/backend/executor/execPartition.c | 1 - src/backend/partitioning/partdesc.c | 1 - src/include/partitioning/partdesc.h | 6 ------ 3 files changed, 8 deletions(-) diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c index 33ec5bfde4c..503ba045ad0 100644 --- a/src/backend/executor/execPartition.c +++ b/src/backend/executor/execPartition.c @@ -1772,7 +1772,6 @@ get_partition_for_tuple(PartitionDispatch pd, const Datum *values, const bool *i else { partdesc->last_found_count = 1; - partdesc->last_found_part_index = part_index; partdesc->last_found_datum_index = bound_offset; } diff --git a/src/backend/partitioning/partdesc.c b/src/backend/partitioning/partdesc.c index c3d275f8726..5a8987bb3c5 100644 --- a/src/backend/partitioning/partdesc.c +++ b/src/backend/partitioning/partdesc.c @@ -333,7 +333,6 @@ retry: /* Initialize caching fields for speeding up ExecFindPartition */ partdesc->last_found_datum_index = -1; - partdesc->last_found_part_index = -1; partdesc->last_found_count = 0; partdesc->oids = (Oid *) palloc(nparts * sizeof(Oid)); diff --git a/src/include/partitioning/partdesc.h b/src/include/partitioning/partdesc.h index dd9c68692fe..9f13b2382d6 100644 --- a/src/include/partitioning/partdesc.h +++ b/src/include/partitioning/partdesc.h @@ -45,12 +45,6 @@ typedef struct PartitionDescData */ int last_found_datum_index; - /* - * Partition index of the last found partition or -1 if none has been - * found yet. - */ - int last_found_part_index; - /* * For LIST partitioning, this is the number of times in a row that the * datum we're looking for a partition for matches the datum in the -- 2.43.0
