From: Ireneusz Pluta <ipluta@wp.pl>
To: Aryan Ariel Rodriguez Chalas <wimogan@yahoo.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: libpq or postgresql performance
Date: Fri, 07 Sep 2012 08:52:24 +0200
Message-ID: <504999A8.1010301@wp.pl> (raw)
In-Reply-To: <1346961871.28573.YahooMailNeo@web124504.mail.ne1.yahoo.com>
References: <1346961871.28573.YahooMailNeo@web124504.mail.ne1.yahoo.com>
W dniu 2012-09-06 22:04, Aryan Ariel Rodriguez Chalas pisze:
> -Why if I connect to the remote server desktop (using RDP or any Remote Desktop Application) and run the application using the same internet connection, it runs really fast when making requests to postgresql; but if I run the application locally by connecting to the remote postgresql server through "libpq", it's really slow?.
It might look like the client side fetches too much data or sends too many queries over the
connection to the database server and then further processes that data locally. Are you using some
kind of ORM in your application?
If that is the case, you might need to refactor your application to do as much as possible
computation at server side and deal only with computation results over the connection, not the raw data.
Try to see in server log what SQL statements are executed while you are running your application.
You need to SET log_statement TO 'all' for that.
With psql, try to see how much data (how many rows) are returned from that query you call "simple
query". Even simple query may return a lot of rows. Server backend might execute it quickly, but
returning a huge result over the Internet might take a long time.
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: ipluta@wp.pl, wimogan@yahoo.com
Subject: Re: libpq or postgresql performance
In-Reply-To: <504999A8.1010301@wp.pl>
* 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