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

Commit9057adc

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 parent36352ce commit9057adc

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
@@ -193,7 +193,8 @@ typedef struct remoteConnHashEnt
193193
errdetail("%s", msg))); \
194194
} \
195195
dblink_security_check(conn, rconn); \
196-
PQsetClientEncoding(conn, GetDatabaseEncodingName()); \
196+
if (PQclientEncoding(conn) != GetDatabaseEncoding()) \
197+
PQsetClientEncoding(conn, GetDatabaseEncodingName()); \
197198
freeconn = true; \
198199
} \
199200
} while (0)
@@ -272,8 +273,9 @@ dblink_connect(PG_FUNCTION_ARGS)
272273
/* check password actually used if not superuser */
273274
dblink_security_check(conn,rconn);
274275

275-
/* attempt to set client encoding to match server encoding */
276-
PQsetClientEncoding(conn,GetDatabaseEncodingName());
276+
/* attempt to set client encoding to match server encoding, if needed */
277+
if (PQclientEncoding(conn)!=GetDatabaseEncoding())
278+
PQsetClientEncoding(conn,GetDatabaseEncodingName());
277279

278280
if (connname)
279281
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp