pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PQconnectStart/PQconnectPoll
3+ messages / 3 participants
[nested] [flat]

* PQconnectStart/PQconnectPoll
@ 2012-11-15 09:02 Sergio Mayoral <mayoralstuttgart@yahoo.com>
  2012-11-22 10:34 ` Re: PQconnectStart/PQconnectPoll Craig Ringer <craig@2ndQuadrant.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Sergio Mayoral @ 2012-11-15 09:02 UTC (permalink / raw)
  To: pgsql-performance

Hi,

i am running some tests to check performance between postgresql and mysql.

one important issue is PQconnectdb (PQconnectStart/PQconnectPoll) against mysql_init/mysql_real_connect functions. (debian platform/C application).

PQconnectdb("host=localhost dbname=my_db user=my_user password='' sslmode=disable"); 

co = mysql_init(NULL)
mysql_real_connect(co, "127.0.0.1", "my_user", "", "my_db", 0, NULL, 0)

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
but this behaviour is not seen in mysql.

I cannot use persistent connections. I must open/close a connection anytime I want to insert something new.

do i have to configure something different? Am i missing something?

this problem gets even worse under PHP.

Regards,

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: PQconnectStart/PQconnectPoll
  2012-11-15 09:02 PQconnectStart/PQconnectPoll Sergio Mayoral <mayoralstuttgart@yahoo.com>
@ 2012-11-22 10:34 ` Craig Ringer <craig@2ndQuadrant.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Craig Ringer @ 2012-11-22 10:34 UTC (permalink / raw)
  To: Sergio Mayoral <mayoralstuttgart@yahoo.com>; +Cc: 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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: PQconnectStart/PQconnectPoll
@ 2012-11-20 12:57 Kevin Grittner <kgrittn@mail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Kevin Grittner @ 2012-11-20 12:57 UTC (permalink / raw)
  To: Sergio Mayoral <mayoralstuttgart@yahoo.com>; pgsql-performance

Sergio Mayoral wrote:

> I cannot use persistent connections. I must open/close a connection
> anytime I want to insert something new.

That's odd. Why is that?

> do i have to configure something different? Am i missing something?

You could use pgbouncer to hold database connections open for you and
provide a somewhat more lightweight connection process.

-Kevin




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-11-22 10:34 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 09:02 PQconnectStart/PQconnectPoll Sergio Mayoral <mayoralstuttgart@yahoo.com>
2012-11-22 10:34 ` Craig Ringer <craig@2ndQuadrant.com>
2012-11-20 12:57 Re: PQconnectStart/PQconnectPoll Kevin Grittner <kgrittn@mail.com>

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