summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2009-02-06 18:18:54 +0000
committerBruce Momjian <bruce@momjian.us>2009-02-06 18:18:54 +0000
commit3d1a1eeddb24580b5b3d6fc0e50a68d467696d49 (patch)
tree59b5526d8ad5667cae83e833f058290acaa726d0
parent8c78f8e65c2f68e946f145770cf24a49ac88c891 (diff)
Document ways to avoid libpq WSACleanup() overhead on Windows.
Andrew Chernow
-rw-r--r--doc/src/sgml/libpq.sgml17
1 files changed, 16 insertions, 1 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 0a4379a76b9..75a0e3edd53 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.275 2009/01/10 20:14:30 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.276 2009/02/06 18:18:54 momjian Exp $ -->
<chapter id="libpq">
<title><application>libpq</application> - C Library</title>
@@ -63,6 +63,21 @@
The <function>PQstatus</> function should be called to check
whether a connection was successfully made before queries are sent
via the connection object.
+
+ <note>
+ <para>
+ On Windows, there is a way to improve performance if a single
+ database connection is repeated started and shutdown. Internally,
+ libpq calls WSAStartup() and WSACleanup() for connection startup
+ and shutdown, respectively. WSAStartup() increments an internal
+ Windows library reference count which is decremented by WSACleanup().
+ When the reference count is just one, calling WSACleanup() frees
+ all resources and all DLLs are unloaded. This is an expensive
+ operation. To avoid this, an application can manually call
+ WSAStartup() so resources will not be freed when the last database
+ connection is closed.
+ </para>
+ </note>
<variablelist>
<varlistentry>