pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wei Weng <wweng@kencast.com>
To: Weiping He <laser@zhengmai.com.cn>
Cc: pgsql-sql@postgresql.org
Subject: Re: Is this valid?
Date: 13 Aug 2002 10:27:28 -0400
Message-ID: <1029248854.29893.3.camel@Monet> (raw)
In-Reply-To: <3D5883CA.8030803@zhengmai.com.cn>
References: <1029194489.28129.3.camel@Monet>
	<3D5883CA.8030803@zhengmai.com.cn>

On Mon, 2002-08-12 at 23:58, Weiping He wrote:
> Wei Weng wrote:
> 
> >I am not sure if this is the right mailing list I talk to. Please let me
> >know if I had violated any unwritten rules. :)
> >
> >I have a global variable PGconn* m_pgconn that is the connection handle
> >for connecting to the postgresql database. Can I access/use the handle
> >from multiple threads? Say I have a thread that does some insertion
> >through this handle/database connection(m_pgconn) and also another
> >thread that do some insertion *on the same table* through this
> >handle(m_pgconn), will that break?
> >
> >Thanks
> >
> >
> >  
> >
> I don't think it's a good idea to use global variable
> in multi-thread environment.
> I think use different handle in differents is better.
> 
> libpq is thread safe, but it doesn't necessary mean
> that you could free of your own code.
> 
Is it going to be resource draining if I make lots of connections in a
very short time? 

-- 
Wei Weng
Network Software Engineer
KenCast Inc.





view thread (4+ messages)

Message-ID: <1029248854.29893.3.camel@Monet>
Permalink:  ../1029248854.29893.3.camel@Monet/
Also on:    postgresql.org/message-id/1029248854.29893.3.camel@Monet

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: wweng@kencast.com, laser@zhengmai.com.cn
  Subject: Re: Is this valid?
  In-Reply-To: <1029248854.29893.3.camel@Monet>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox