From: | amul sul <sulamul(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Can avoid list_copy in recomputeNamespacePath() conditionally? |
Date: | 2019-10-31 08:41:03 |
Message-ID: | CAAJ_b94dGU4BYFtVCKkj58hNuPL9hwP4p1a9Eqq+e+v8GP8KoQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all,
I wondered can we have a shortcut somewhat similar to following POC
in recomputeNamespacePath () when the recomputed path is the same as the
previous baseSearchPath/activeSearchPath :
== POC patch ==
diff --git a/src/backend/catalog/namespace.c
b/src/backend/catalog/namespace.c
index e251f5a9fdc..b25ef489e47 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -3813,6 +3813,9 @@ recomputeNamespacePath(void)
!list_member_oid(oidlist, myTempNamespace))
oidlist = lcons_oid(myTempNamespace, oidlist);
+ /* TODO: POC */
+ if (equal(oidlist, baseSearchPath))
+ return;
/*
* Now that we've successfully built the new list of namespace OIDs,
save
* it in permanent storage.
== POC patch end ==
It can have two advantages as:
1. Avoid unnecessary list_copy() in TopMemoryContext context &
2. Global pointers like activeSearchPath/baseSearchPath will not change if
some
implementation end up with cascaded call to recomputeNamespacePath().
Thoughts/Comments?
Regards,
Amul
From | Date | Subject | |
---|---|---|---|
Next Message | Antonin Houska | 2019-10-31 08:43:47 | Re: MarkBufferDirtyHint() and LSN update |
Previous Message | Fujii Masao | 2019-10-31 08:38:32 | Re: Problem with synchronous replication |