Skip to content

Commit

Permalink
feat: performance optimization
Browse files Browse the repository at this point in the history
1. move code of audit log from main path
2. disable transaction split
  • Loading branch information
mrdrivingduck committed Sep 27, 2024
1 parent 0e4fb70 commit a546373
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions src/backend/tcop/postgres.c
Original file line number Diff line number Diff line change
Expand Up @@ -2175,10 +2175,6 @@ exec_bind_message(StringInfo input_message)
if (whereToSendOutput == DestRemote)
pq_putemptymessage('2');

/* POLAR: get errmsg params string, we must free it in the last */
params_string = polar_get_errmsg_params(params);
/* POLAR end */

/*
* Emit duration logging if appropriate.
*/
Expand All @@ -2195,6 +2191,11 @@ exec_bind_message(StringInfo input_message)
StringInfoData buf;

initStringInfo(&buf);

/* POLAR: get errmsg params string, we must free it in the last */
params_string = polar_get_errmsg_params(params);
/* POLAR end */

if (polar_enable_output_search_path_to_log)
appendStringInfo(&buf, "/*%s*/ ", namespace_search_path);
ereport(LOG,
Expand All @@ -2209,6 +2210,12 @@ exec_bind_message(StringInfo input_message)
polar_mark_slow_log(true), /* POLAR */
errhidestmt(true)));
pfree(buf.data);

/* POLAR: free params_string */
if (params_string)
pfree(params_string);
/* POLAR end */

break;
}
}
Expand All @@ -2218,10 +2225,6 @@ exec_bind_message(StringInfo input_message)

if (numParams == 0)
hit_polar_unique_feature(UnparameterizedStmtExecCount);
/* POLAR: free params_string */
if (params_string)
pfree(params_string);
/* POLAR end */

if (save_log_statement_stats)
ShowUsage("BIND MESSAGE STATISTICS");
Expand Down
2 changes: 1 addition & 1 deletion src/backend/utils/misc/guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ static struct config_bool ConfigureNamesBool[] =
GUC_NO_RESET_ALL | POLAR_GUC_IS_INVISIBLE | POLAR_GUC_IS_UNCHANGABLE
},
&polar_enable_xact_split,
true,
false,
NULL, NULL, NULL
},

Expand Down

0 comments on commit a546373

Please sign in to comment.