Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd6ca510

Browse files
committed
Fix performance regression in dblink connection speed.
Previous commite5de601 modified dblinkto ensure client encoding matched the server. However the addedPQsetClientEncoding() call added significant overhead. Restore originalperformance in the common case where client encoding already matchesserver encoding by doing nothing in that case. Applies to all activebranches.Issue reported and work sponsored by Zonar Systems.
1 parent54aa5ef commitd6ca510

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎contrib/dblink/dblink.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ typedef struct remoteConnHashEnt
209209
errdetail_internal("%s", msg))); \
210210
} \
211211
dblink_security_check(conn, rconn); \
212-
PQsetClientEncoding(conn, GetDatabaseEncodingName()); \
212+
if (PQclientEncoding(conn) != GetDatabaseEncoding()) \
213+
PQsetClientEncoding(conn, GetDatabaseEncodingName()); \
213214
freeconn = true; \
214215
} \
215216
} while (0)
@@ -288,8 +289,9 @@ dblink_connect(PG_FUNCTION_ARGS)
288289
/* check password actually used if not superuser */
289290
dblink_security_check(conn,rconn);
290291

291-
/* attempt to set client encoding to match server encoding */
292-
PQsetClientEncoding(conn,GetDatabaseEncodingName());
292+
/* attempt to set client encoding to match server encoding, if needed */
293+
if (PQclientEncoding(conn)!=GetDatabaseEncoding())
294+
PQsetClientEncoding(conn,GetDatabaseEncodingName());
293295

294296
if (connname)
295297
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp