Skip to content

Commit 3d1a1ee

Browse files
committed
Document ways to avoid libpq WSACleanup() overhead on Windows.
Andrew Chernow
1 parent 8c78f8e commit 3d1a1ee

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

doc/src/sgml/libpq.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.275 2009/01/10 20:14:30 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.276 2009/02/06 18:18:54 momjian Exp $ -->
22

33
<chapter id="libpq">
44
<title><application>libpq</application> - C Library</title>
@@ -63,6 +63,21 @@
6363
The <function>PQstatus</> function should be called to check
6464
whether a connection was successfully made before queries are sent
6565
via the connection object.
66+
67+
<note>
68+
<para>
69+
On Windows, there is a way to improve performance if a single
70+
database connection is repeated started and shutdown. Internally,
71+
libpq calls WSAStartup() and WSACleanup() for connection startup
72+
and shutdown, respectively. WSAStartup() increments an internal
73+
Windows library reference count which is decremented by WSACleanup().
74+
When the reference count is just one, calling WSACleanup() frees
75+
all resources and all DLLs are unloaded. This is an expensive
76+
operation. To avoid this, an application can manually call
77+
WSAStartup() so resources will not be freed when the last database
78+
connection is closed.
79+
</para>
80+
</note>
6681

6782
<variablelist>
6883
<varlistentry>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy