Re: libpq WSACleanup is not needed - Mailing list pgsql-hackers

From Andrew Chernow
Subject Re: libpq WSACleanup is not needed
Date
Msg-id 4978A4CD.5090509@esilo.com
Whole thread Raw
In response to Re: libpq WSACleanup is not needed  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: libpq WSACleanup is not needed  (Andrew Chernow <ac@esilo.com>)
List pgsql-hackers
Tom Lane wrote:
> Andrew Chernow <ac@esilo.com> writes:
>> I can try.  Where should this be documented?  ISTM that the best place
>> is at the top of "30.1 Database Connection Control Functions", since the
>> issue pertains to any connect/disconnect function.  Does that sound
>> correct?  Should it be a warning or just regular text?
>
> Minor platform-specific performance nits are not that important.  Think
> "footnote", not "warning at the top of the page".
>
>             regards, tom lane
>
>

Its a footnote at the end of the first paragraph in 30.1.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/
Index: doc/src/sgml/libpq.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/libpq.sgml,v
retrieving revision 1.275
diff -C6 -r1.275 libpq.sgml
*** doc/src/sgml/libpq.sgml    10 Jan 2009 20:14:30 -0000    1.275
--- doc/src/sgml/libpq.sgml    22 Jan 2009 16:51:31 -0000
***************
*** 59,72 ****
     is obtained from the function <function>PQconnectdb</> or
     <function>PQsetdbLogin</>.  Note that these functions will always
     return a non-null object pointer, unless perhaps there is too
     little memory even to allocate the <structname>PGconn</> object.
     The <function>PQstatus</> function should be called to check
     whether a connection was successfully made before queries are sent
!    via the connection object.
!
     <variablelist>
      <varlistentry>
       <term><function>PQconnectdb</function><indexterm><primary>PQconnectdb</></></term>
       <listitem>
        <para>
         Makes a new connection to the database server.
--- 59,84 ----
     is obtained from the function <function>PQconnectdb</> or
     <function>PQsetdbLogin</>.  Note that these functions will always
     return a non-null object pointer, unless perhaps there is too
     little memory even to allocate the <structname>PGconn</> object.
     The <function>PQstatus</> function should be called to check
     whether a connection was successfully made before queries are sent
!    via the connection object.  For windows applications, destroying a
!    <structname>PGconn</> can be expensive in a few case.
!     <footnote>
!      <para>
!       On windows, libpq issues a WSAStartup and WSACleanup on a per
!       connection basis.  Each WSAStartup increments an internal reference
!       count which is decremented by WSACleanup.  Calling WSACleanup with
!       a reference count of zero, forces all resources to be freed and
!       DLLs to be unloaded.  This is an expensive operation that can take
!       as much as 300ms.  This overhead can be seen if an application does
!       not call WSAStartup and it closes its last PGconn.  To avoid this,
!       an application should manually call WSAStartup.
!      </para>
!     </footnote>
     <variablelist>
      <varlistentry>
       <term><function>PQconnectdb</function><indexterm><primary>PQconnectdb</></></term>
       <listitem>
        <para>
         Makes a new connection to the database server.

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Pluggable Indexes (was Re: rmgr hooks (v2))
Next
From: Andrew Chernow
Date:
Subject: Re: libpq WSACleanup is not needed