On 27/01/13 02:45, ktm@rice.edu wrote:
> On Sun, Jan 27, 2013 at 03:15:45AM +0300, belal hamed wrote:
>>
>> I connect to my server through ADSL connection 4Mbps
>>
>
> Here is your "problem". You need to understand the performance
> characteristics of your communication channel. ADSL is a VERY
> asymmetric communications channel. Down is usually much faster
> than up.
I'm not convinced that ADSL is your problem.
1. Try just SSH directly to the server, and run psql, and run a query
like this one:
SELECT 'This is a test message' AS status;
This should run in under 1ms; it also means that we don't have to worry
about the details of your database-schema for the purposes of this problem.
2. Try creating a simple SSH tunnel and using your application locally.
For example, if your server runs Postgresql on port 5432, run this SSH
command:
ssh -L 5432:localhost:5432 your_server_hostname
and then connect to your LOCAL (localhost) port 5432; SSH will handle
the port forwarding. [Explanation: "localhost" in the SSH command is in
the context of your_server_hostname]
How does it work now?
3. Try configuration you are currently using, but with the above query.
It should be possible to distinguish between:
- slowness caused by the database query itself
- slowness caused by the network fundamentally.
- slowness caused by the postgresql/libpq.
Hopefully, you'll be able to narrow it down a bit.
HTH,
Richard