pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@2ndQuadrant.com>
To: Sergio Mayoral <mayoralstuttgart@yahoo.com>
Cc: postgresql-perf <pgsql-performance@postgresql.org>
Subject: Re: PQconnectStart/PQconnectPoll
Date: Thu, 22 Nov 2012 18:34:56 +0800
Message-ID: <50ADFFD0.7070503@2ndQuadrant.com> (raw)
In-Reply-To: <1352970177.10135.YahooMailNeo@web39302.mail.mud.yahoo.com>
References: <1352970177.10135.YahooMailNeo@web39302.mail.mud.yahoo.com>

On 11/15/2012 05:02 PM, Sergio Mayoral wrote:
>
> PQconnectdb is taking too long comparing to mysql and i found out the
> time is consumed by PQconnectPoll waiting for the socket to be ready
> for reading/writing
What's "too long"?
>
> I cannot use persistent connections. I must open/close a connection
> anytime I want to insert something new.
If you mean that you intend to open a new connection, do a single
INSERT, and close the connection - your performance will be awful.

If your app can't use persistent or pooled connections, use PgBouncer as
an external connection pool. Have your app connect to PgBouncer, and
PgBouncer connect to PostgreSQL.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

view thread (3+ messages)

Message-ID: <50ADFFD0.7070503@2ndQuadrant.com>
Permalink:  ../50ADFFD0.7070503@2ndQuadrant.com/
Also on:    postgresql.org/message-id/50ADFFD0.7070503@2ndQuadrant.com

 · 

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-performance@postgresql.org
  Cc: craig@2ndQuadrant.com, mayoralstuttgart@yahoo.com
  Subject: Re: PQconnectStart/PQconnectPoll
  In-Reply-To: <50ADFFD0.7070503@2ndQuadrant.com>

* 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