473,653 Members | 2,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

removing idle connections

Is there a way to remove idle connections? My postgres server is
getting serveral hundred idle connections. It's due to a postgres .NET
provider not closing the connections properly. I don't want to kill
them all, or restart postgres everytime the connections go crazy.

-Josh

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #1
4 12849
On 19 Oct 2004 at 13:00, Josh Close wrote:
Is there a way to remove idle connections? My postgres server is
getting serveral hundred idle connections. It's due to a postgres .NET
provider not closing the connections properly. I don't want to kill
them all, or restart postgres everytime the connections go crazy.


I would have though it would be better to fix the client application. If the
app is not closing connections then you may be leaking handles and
memory.

What .NET provider is this? Are you sure it is not just normal
connection pooling?

Cheers,
Gary.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05 #2
On Tue, 19 Oct 2004 19:24:23 +0100, Gary Doades <gp*@gpdnet.co. uk> wrote:
I would have though it would be better to fix the client application. If the
app is not closing connections then you may be leaking handles and
memory.

What .NET provider is this? Are you sure it is not just normal
connection pooling?

Cheers,
Gary.


The provider is corelabs. The programmer that wrote the code says he's
closing the connections, but they aren't actually closing.

Any ideas? Or better yet, do you know of a good postgres .net provider?

-Josh

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #3
On 19 Oct 2004 at 13:32, Josh Close wrote:
The provider is corelabs. The programmer that wrote the code says he's
closing the connections, but they aren't actually closing.

Any ideas? Or better yet, do you know of a good postgres .net provider?


Hmm, I've had lots of problems with the Corelabs provider. The open
source provider (Npgsql) available on GBorg is a lot better for most
things.

I reverted to using the ODBC driver for Postgres with the .NET Odbc
provider. Works fine.

With connection pooling enabled you will see several "idle" connections
around waiting to be re-used by a provider connection supplying the
same credentials and options as a "disconnect ed" pooled-but-idle
connection. If you connect with a different username/password
everytime then this may be a problem, otherwise it is a big performance
gain in the disconnected recordset world of .NET.

Cheers,
Gary.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #4
Josh Close wrote:
Is there a way to remove idle connections? My postgres server is
getting serveral hundred idle connections. It's due to a postgres .NET
provider not closing the connections properly. I don't want to kill
them all, or restart postgres everytime the connections go crazy.


I do not think is problem of not close the connections.
I bet the driver is acting like this:
On connection:
. Connect
. start transaction

On Commit:
. commit transaction
. start transaction

On Abort:
. abort transaction
. start transaction

On statemet:
. execute statement
As you can see you are always inside a transaction, idle I mean.
BTW this is the behaviour of python driver PgDB ( I suggest to
use psycopg instead ) and before the 8.0 series the JDBC driver
did the same. The way to solve it is, delay the begin till the first
statement:
On connection:
. Connect

On Commit:
. commit transaction

On Abort:
. abort transaction

On statemet:
. If is the first statement after a connection or a commit or
an abort execute the: start transaction
. execute statement

For rpm mantainer: why do not include the psycopg instead of the actual
python driver ?
Regards
Gaetano Mendola


Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2343
by: Philippe Lang | last post by:
Hello, After using Postgresql for a while, through ODBC / MS Access, I'm not able to connect to the server anymore. The server reports "Too many clients connected already". With a "ps -afx", I can see a lot of idle postgresql connections, which correspond for sure to ODBC connections that haven't been closed properly, and that remain opened. Stopping and restarting the server solves the problem.
1
5973
by: John Gibson | last post by:
Hi, all. We are running PostgreSQL 7.2.2 (7.4.1 in a few weeks). We have a pesky legacy application which periodically leaves open idle connections. (I know... fix the application). In the short term, I would like to find out if the database engine has a time-out configuration option for idle connections where it would force-close the connections. Is there such an option?
0
1448
by: Stefan Felkel | last post by:
hi! i have searched a lot in these pgsql-groups and on the internet, but found no really helpful information for my problem. the famous error >> database "xyz" is being accessed by other users is my problem.
3
5287
by: Praveen_db2 | last post by:
Hi Gurus I came across a small doubt. Suppose I have Max Connections parameter set to 200. There are now 200 connections to the database. Out of these 200 connections 50 are idle. What will happen if a new user tries to connect to the database? Whether he will receive error about MAXCONNECTIONS exceeded or he will be allotted a connection as 50 agents are idle now? Regards
1
8214
by: Praveen_db2 | last post by:
Hi All I came across a small doubt. Suppose I have Max Connections parameter set to 200. There are now 200 connections to the database. Out of these 200 connections 50 are idle. What will happen if a new user tries to connect to the database? Whether he will receive error about MAXCONNECTIONS exceeded or he will be allotted a connection as 50 agents are idle now? Also how to kill those idle sessions or connections to make way for active...
4
6057
by: elyob | last post by:
Not really tried going two ways at once, but I have an include_once connection to a mysql_database, now I need to retrieve info from a second mysql_database .. My mysql_connects are getting confused. So, (I've had a couple of beers), am I opening up too many at once? I'll look again in the morning, but am thinking that it is a bad idea to leave two connections open all the time ...
4
2226
by: Troels Arvin | last post by:
Hello, Some of our SAS users seem to initiate 20+ idle connections to DB2 every time they start SAS. I'm inclined to tell them to cut down on their DB2 connection number, but then again, if the connections are very cheap why bother. Are idle DB2 connections cheap, from the DBMS' point of view? (I fear that there's no easy answer to this question, but maybe someone
2
4819
by: dantz | last post by:
Having a multiple client/server using a C# httplistener/httpwebrequest to transfer message. How should I handle idle connections? Will it be the job of the server or client? Does using a ping mechanism effective? Please suggest others ways.. My idea as of now is this: http://www.koders.com/csharp/fidDA9BB7F0CB74CAC8C021B42DF9EB9DCAFB88845E.aspx?s=httpwebrequest
2
5375
by: Nebu Pulickal | last post by:
I am having a postgresql database server and the idle connections are not closing themselves. They are increasing to large numbers as time passes and the web page is not loading. The code developer says that the code for closing these idleconnections are included in the code itself. But it is also not working. We have tried to close by giving several values to maxactive and maxidle. But none are working. I want to know whether there is a...
0
8370
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8283
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8704
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8590
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5620
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4147
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2707
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.