Re: libpq or postgresql performance

Поиск
Список
Период
Сортировка
От Ireneusz Pluta
Тема Re: libpq or postgresql performance
Дата
Msg-id 504A2DE5.4010706@wp.pl
обсуждение исходный текст
Ответ на libpq or postgresql performance  (Aryan Ariel Rodriguez Chalas <wimogan@yahoo.com>)
Список pgsql-performance
W dniu 2012-09-07 17:43, Aryan Ariel Rodriguez Chalas pisze:
> Thank you all for answering that quickly...
>
> A simple query could be "SELECT LOCALTIMESTAMP(0)" which could last even 5 seconds for returning data.
>
> The other queries that I would like to be faster, return less than 50 rows until now; and two of those queries (the
onesthe application uses the most), return only a record. 
>
> I agree that a huge result over internet might take a long time, but until now my application is not returning that
amountof rows... 
>
> Just for the record, the server bandwidth is 2.0 mbps and the client is 1.89 mbps and other applications run really
fastfor my expectatives (such as opening a remote desktop and also my application through a remote desktop session runs
veryfast on this connection). But I'm still far of understanding why over a remote desktop session my application runs
veryfast on the same connection but when running it locally and connecting to the server, it's super slow. Could be
becausewhen running over a remote desktop session the application is connecting with "libpq" through "Unix Domain
Socket",but when running locally; "libpq" works over "TCP Sockets"?. 
so change connection mode when running the application _at remote_ site _locally_ to the server to
tcp too. And then try with connection to localhost, as well as to the public IP of that server, the
same which you connect to from your own desktop.
> By the way I'm using Linux on both ends as Operating System, Lazarus 1.1 as IDE and Zeoslib for connecting to
postgresqland I've noticed that when I compile the application for running on Windows as the client, it moves more or
lessacceptable; so it brings to me to another question: Why "libpq" is faster on Windows than Linux?. 
try to benchmark your elementary queries with psql run from your site (remotely to the server) and
from remote site (locally to the server). Use `psql -h hostaddr` at remote site to force tcp connection.

>
> Best regards...
>
> Ariel Rodriguez
>
> ----- Mensaje original -----
> De: Ireneusz Pluta <ipluta@wp.pl>
> Para: Aryan Ariel Rodriguez Chalas <wimogan@yahoo.com>
> CC: "pgsql-performance@postgresql.org" <pgsql-performance@postgresql.org>
> Enviado: Viernes, 7 de septiembre, 2012 2:52 A.M.
> Asunto: Re: [PERFORM] libpq or postgresql performance
>
> 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
usingthe same internet connection, it runs really fast when making requests to postgresql; but if I run the application
locallyby 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
databaseserver 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
anddeal 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_statementTO '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
querymay return a lot of rows. Server backend might execute it quickly, but returning a huge result over the Internet
mighttake a long time. 
>
>
>
>
>
>



В списке pgsql-performance по дате отправления:

Предыдущее
От: John Nash
Дата:
Сообщение: Re: exponential performance decrease in ISD transaction
Следующее
От: Ireneusz Pluta
Дата:
Сообщение: Re: libpq or postgresql performance