Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T9sQn-0006g7-U1 for pgsql-performance@postgresql.org; Fri, 07 Sep 2012 06:52:46 +0000 Received: from mx3.wp.pl ([212.77.101.7]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T9sQj-0003j2-1b for pgsql-performance@postgresql.org; Fri, 07 Sep 2012 06:52:45 +0000 Received: (wp-smtpd smtp.wp.pl 16356 invoked from network); 7 Sep 2012 08:52:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1347000757; bh=oDbxaVVPcPGVtwbKnZMvibaOeLR5p5Hy55jspi8X2DI=; h=From:To:CC:Subject; b=XCYvwT5W4mLK+BRb7DXX3QsAWP/aXs0b2qOrdwMFdaCnCdrptghv22thABPl+7dBZ 5H6s3HWpeYLrFocdvqeQasK6Oz3pOgooSegV1Mgw6+ifsVCsxPBilKpUhbhsVHccHy hRNepCHzdi+LxTX5+IHge1Ljh996zVw0gDwZFScw= Received: from aelr148.neoplus.adsl.tpnet.pl (HELO [10.0.0.65]) (ipluta@[79.191.43.148]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with AES256-SHA encrypted SMTP for ; 7 Sep 2012 08:52:37 +0200 Message-ID: <504999A8.1010301@wp.pl> Date: Fri, 07 Sep 2012 08:52:24 +0200 From: Ireneusz Pluta User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0 MIME-Version: 1.0 To: Aryan Ariel Rodriguez Chalas CC: "pgsql-performance@postgresql.org" Subject: Re: libpq or postgresql performance References: <1346961871.28573.YahooMailNeo@web124504.mail.ne1.yahoo.com> In-Reply-To: <1346961871.28573.YahooMailNeo@web124504.mail.ne1.yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 [kXP0] X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201209/25 X-Sequence-Number: 47771 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.