Document ways to avoid libpq WSACleanup() overhead on Windows.
authorBruce Momjian
Fri, 6 Feb 2009 18:18:54 +0000 (18:18 +0000)
committerBruce Momjian
Fri, 6 Feb 2009 18:18:54 +0000 (18:18 +0000)
Andrew Chernow

doc/src/sgml/libpq.sgml

index 0a4379a76b98be5df06988fbb210be2e835d4ed3..75a0e3edd53ed64668226f258f9375f843a5e409 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
 
  <application>libpq</application> - C Library
    The PQstatus function should be called to check
    whether a connection was successfully made before queries are sent
    via the connection object.
+  
+   
+    
+     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.
+    
+