This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 30d542912808f5d91578546edce47f3b46bd506b
Author: Huansong Fu <[email protected]>
AuthorDate: Mon Jan 30 14:56:42 2023 -0800

    No need pstrdup to initialize the dispatched query string
    
    Minor correction that we don't need to call pstrdup() when initializing
    the query string. exec_mpp_query() would fill in a dummy string if it
    is empty.
    
    Noticed this when testing some specific workloads and seeing overheads
    in memory allocator caused by this. Didn't dig more into the impact but
    let's just fix it anyway.
---
 src/backend/tcop/postgres.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 09671cb2fd..7ffccb7830 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -5616,11 +5616,8 @@ PostgresMain(int argc, char *argv[],
                                        /*
                                         * This is exactly like 'Q' above 
except we peel off and
                                         * set the snapshot information right 
away.
-                                        *
-                                        * Since PortalDefineQuery() does not 
take NULL query string,
-                                        * we initialize it with a constant 
empty string.
                                         */
-                                       const char *query_string = pstrdup("");
+                                       const char *query_string = "";
 
                                        const char *serializedDtxContextInfo = 
NULL;
                                        const char *serializedPlantree = NULL;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to