smgr-debug.patch

text/x-patch

Filename: smgr-debug.patch
Type: text/x-patch
Part: 0
Message: Re: performance issue in remove_from_unowned_list()

Patch

Format: unified
File+
src/backend/storage/smgr/smgr.c 6 0
diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c
index 0c0bba4ab3..8eb724b80d 100644
--- a/src/backend/storage/smgr/smgr.c
+++ b/src/backend/storage/smgr/smgr.c
@@ -281,6 +281,7 @@ remove_from_unowned_list(SMgrRelation reln)
 {
 	SMgrRelation *link;
 	SMgrRelation cur;
+	int			idx = 0;
 
 	for (link = &first_unowned_reln, cur = *link;
 		 cur != NULL;
@@ -292,7 +293,12 @@ remove_from_unowned_list(SMgrRelation reln)
 			cur->next_unowned_reln = NULL;
 			break;
 		}
+
+		idx++;
 	}
+
+	if (idx > 0)
+		elog(LOG, "remove_from_unowned_list %d", idx);
 }
 
 /*