Re: PQconnectStart/PQconnectPoll

From: Craig Ringer <craig(at)2ndQuadrant(dot)com>
To: Sergio Mayoral <mayoralstuttgart(at)yahoo(dot)com>
Cc: postgresql-perf <pgsql-performance(at)postgresql(dot)org>
Subject: Re: PQconnectStart/PQconnectPoll
Date: 2012-11-22 10:34:56
Message-ID: 50ADFFD0.7070503@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Niklas Paulsson 2012-11-22 12:06:01 SQL performance question
Previous Message Heikki Linnakangas 2012-11-22 09:17:15 Re: fast read of binary data