diff --git i/src/backend/optimizer/path/costsize.c w/src/backend/optimizer/path/costsize.c
index ffd2bf8783..180cdc5f10 100644
--- i/src/backend/optimizer/path/costsize.c
+++ w/src/backend/optimizer/path/costsize.c
@@ -3431,10 +3431,21 @@ cached_scansel(PlannerInfo *root, RestrictInfo *rinfo, PathKey *pathkey)
 		if (cache->opfamily == pathkey->pk_opfamily &&
 			cache->collation == pathkey->pk_eclass->ec_collation &&
 			cache->strategy == pathkey->pk_strategy &&
-			cache->nulls_first == pathkey->pk_nulls_first)
+			cache->nulls_first == pathkey->pk_nulls_first) {
+			elog(INFO, " [HIT][%p]\topfamily: %u, collation: %u, strategy: %d, nulls_first: %s, left_relids:%p, right_relids:%p",
+				 rinfo,
+				 pathkey->pk_opfamily, pathkey->pk_eclass->ec_collation,
+				 pathkey->pk_strategy, pathkey->pk_nulls_first ? "t" : "f",
+				 rinfo->left_relids, rinfo->right_relids);
 			return cache;
+		}
 	}
 
+	elog(INFO, "[MISS][%p]\topfamily:%u, collation: %u, strategy: %d, nulls_first: %s, left_relids:%p, right_relids:%p",
+		 rinfo,
+		 pathkey->pk_opfamily, pathkey->pk_eclass->ec_collation,
+		 pathkey->pk_strategy, pathkey->pk_nulls_first ? "t" : "f",
+		 rinfo->left_relids, rinfo->right_relids);
 	/* Nope, do the computation */
 	mergejoinscansel(root,
 					 (Node *) rinfo->clause,
