From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Pavel Golub <pavel(at)gf(dot)microolap(dot)com> |
Cc: | sujayr06 <sujayr06(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Can PQstatus() be used by Application to check connection to postgres periodically? |
Date: | 2012-02-08 13:17:43 |
Message-ID: | CA+TgmoYWYGz+-WxKyf9WJK4A1_YO1QpiOFLQCnXLOk=n+5u_3Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2012/2/8 Pavel Golub <pavel(at)microolap(dot)com>:
> Hello, sujayr06.
>
> You wrote:
>
> s> Hello All,
>
> s> My application has to do a real time data upload to PostgreSQL
> s> server.
>
> s> Every time i have to do a real time upload, i do not wish to open
> s> new connection.
> s> I want to open a connection once [when my application comes up]
> s> and periodically check if the connection is active.
> s> Can PQstatus() be used by application to check the status of the
> s> connection already established?
>
> s> If PQstatus() cannot be used, does PostgreSQL provide alternate
> s> interface to check the status of the connection.
>
> s> Note : I do not wish to open connection on every real time upload
> s> as its an overhead for the application.
>
> s> Appreciate any help!
>
> You may use PQtransactionStatus for this purpose
> (http://www.postgresql.org/docs/9.1/static/libpq-status.html)
Only if you don't care about getting the right answer. Neither
PQstatus() nor PQtransactionStatus() make any attempt to determine
whether the server is still there; they just return the cached status
of the connection, without any system calls whatsoever.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2012-02-08 13:23:33 | Re: Text-any concatenation volatility acting as optimization barrier |
Previous Message | Peter Eisentraut | 2012-02-08 12:47:01 | Re: ecpglib use PQconnectdbParams |