You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2025/01/06 08:19:59 UTC

(cloudberry) 09/12: No need pstrdup to initialize the dispatched query string

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 <fu...@gmail.com>
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: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org