From: Dave Cramer <pg@fastcrypt.com>
To: Saurabh Dave <saurabhdave@gmail.com>
Cc: Albe Laurenz <laurenz.albe@wien.gv.at>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Queries very slow and memory consumption too high
Date: Tue, 23 Jun 2009 05:56:11 -0400
Message-ID: <491f66a50906230256r15984552u35d17cfaed81a3aa@mail.gmail.com> (raw)
In-Reply-To: <fdd0c0f90906221848x345a0a04pab79592740c144f@mail.gmail.com>
References: <fdd0c0f90906212202s68a9e393u654420245e84df31@mail.gmail.com>
<D960CB61B694CF459DCFB4B0128514C202FF6669@exadv11.host.magwien.gv.at>
<fdd0c0f90906221848x345a0a04pab79592740c144f@mail.gmail.com>
On Mon, Jun 22, 2009 at 9:48 PM, Saurabh Dave <saurabhdave@gmail.com> wrote:
> Thanks Albe,
>
> "You'll have to analyze *what* is slow."
>
> That is an excellent question, which I am struggling to answer.
> As per your recommendation I moved DB Server on a remote machine and made
> following changes:
> 1. Postgres version 8.3.7.1 instead of 8.2
> 2. DB encoding changed from UTF-8 to SQL_ANSCII
>
> Now I see the performance of my application to be quite fast, I need to
> observe it for some more time though.
>
> But over the top, do you think that changing the encoding would make
> difference?
>
Yes, but you needed to analyze what is slow to determine this. Simply
changing things and without knowing why doesn't help us determine the
problem.
But back to encoding. There are situations where the default setup will not
use an index if the encoding is not correct.
So please analyze the slow queries with explain analyze
Also be aware that the driver uses prepared statements so
explain analyze select * from foo where blah=1 is different from
prepare t1 as select * from foo where blah = ?
explain analyze execute foo(1)
Dave
>
> Thanks,
> Saurabh
>
>
> On Mon, Jun 22, 2009 at 1:02 PM, Albe Laurenz <laurenz.albe@wien.gv.at>wrote:
>
>> Saurabh Dave wrote:
>> > I am using Postgres 8.2.10 + Hibernate + c3p0 connection pooling.
>> > For our application we support MySQL + Oracle + MSSQL + Postgres.
>> >
>> > With all the other databases our application is working quite
>> > fine, but with Postgres after a day queries are becoming
>> > extremely slow and it seems to be taking up all the available memory.
>> >
>> > Please let me know what could be the issue. I am new to
>> > Postgres, so any help would be greatly appreciated.
>>
>> You'll have to analyze *what* is slow.
>>
>> Is it the database server or some other component?
>>
>> It helps to have the various components installed on different machines.
>>
>> Once you have found out what is slow, drill down there.
>>
>> If it turns out to be the database and need help, you'll have to provide
>> EXPLAIN ANALYZE output of a sample query that runs fast in the
>> beginning and slow later.
>>
>> Yours,
>> Laurenz Albe
>>
>
>
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pg@fastcrypt.com, saurabhdave@gmail.com, laurenz.albe@wien.gv.at
Subject: Re: Queries very slow and memory consumption too high
In-Reply-To: <491f66a50906230256r15984552u35d17cfaed81a3aa@mail.gmail.com>
References: <fdd0c0f90906212202s68a9e393u654420245e84df31@mail.gmail.com> <D960CB61B694CF459DCFB4B0128514C202FF6669@exadv11.host.magwien.gv.at> <fdd0c0f90906221848x345a0a04pab79592740c144f@mail.gmail.com> <491f66a50906230256r15984552u35d17cfaed81a3aa@mail.gmail.com>
* 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