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

Commit70165f2

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 parentad910cc commit70165f2

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

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

277279
if (connname)
278280
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp