pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedQueries very slow and memory consumption too high
13+ messages / 5 participants
[nested] [flat]
* Queries very slow and memory consumption too high
@ 2009-06-22 05:02 Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 06:41 ` Re: Queries very slow and memory consumption too high Craig Ringer <craig@postnewspapers.com.au>
2009-06-22 07:02 ` Re: Queries very slow and memory consumption too high Thomas Kellerer <spam_eater@gmx.net>
2009-06-22 07:32 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
0 siblings, 3 replies; 13+ messages in thread
From: Saurabh Dave @ 2009-06-22 05:02 UTC (permalink / raw)
To: pgsql-jdbc
Hi,
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.
Thanks,
Saurabh
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
@ 2009-06-22 06:41 ` Craig Ringer <craig@postnewspapers.com.au>
2 siblings, 0 replies; 13+ messages in thread
From: Craig Ringer @ 2009-06-22 06:41 UTC (permalink / raw)
To: Saurabh Dave <saurabhdave@gmail.com>; +Cc: pgsql-jdbc
On Mon, 2009-06-22 at 10:32 +0530, Saurabh Dave wrote:
> Hi,
>
> 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 might want to provide some basic information, like:
- What platform / OS / version your PostgreSQL server runs on. Eg
"Ubuntu 9.04" or "Windows 2003 server".
- The hardware specs of your server, including CPU, memory, and most
importantly disks. "2Ghz" isn't good enough; a good description would be
something like "SomeOem 2200GX - two 2.4GHz Xeon E4420s, 16GB RAM, 3Ware
9550/16 SATA disk controller with battery backup, write cache enabled,
attached to 8 250GB 10,000rpm SATA HDDs in RAID 5 and 4 1TB HDDs in RAID
10."
- Where on the server's disks your PostgreSQL data is. For example, you
might say "WAL on 4x1TB RAID 10, main DB on 8x250GB RAID 5, pg_temp and
sort tempfiles on single 8GB SATA RAM drive". If all your postgresql
data is in one place, just mention how it's stored - the file system
type, the RAID level, etc.
- How much memory does your server have free when it slows down? On
UNIX/Linux use "top" and "vmstat" to find this out. On Windows, this
depends on OS version, but the process manager / task manager /
performance monitor should tell you.
- Is your server doing lots of disk I/O when it's slow? (unix/linux:
seem vmstat. Windows Vista, see performance monitor. Others: nfi)
- Is your server paging to disk when it's busy? (unix/linux: see vmstat.
Windows: see task manager/process manager/performance monitor)
--
Craig Ringer
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
@ 2009-06-22 07:02 ` Thomas Kellerer <spam_eater@gmx.net>
2 siblings, 0 replies; 13+ messages in thread
From: Thomas Kellerer @ 2009-06-22 07:02 UTC (permalink / raw)
To: pgsql-jdbc
Saurabh Dave, 22.06.2009 07:02:
> 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.
It's not clear to me *where* the memory is taken. Is that on the machine running your application (i.e. Hibernate and the connection pool) or is that memory taken on the Postgres server?
If it's on the application server, could this be caused by not properly closed result sets? The Postgres JDBC driver by default buffers all ResultSets in memory before returning to the calling class. If you do not close your result sets properly, maybe this memory is not released by the driver.
As an alternative you might try to configure the connection to use "cursor based fetching" to avoid the buffering in the driver code:
http://jdbc.postgresql.org/documentation/83/query.html#query-with-cursor
Regards
Thomas
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
@ 2009-06-22 07:32 ` Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 01:48 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2 siblings, 1 reply; 13+ messages in thread
From: Albe Laurenz @ 2009-06-22 07:32 UTC (permalink / raw)
To: Saurabh Dave *EXTERN* <saurabhdave@gmail.com>; pgsql-jdbc
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
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 07:32 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
@ 2009-06-23 01:48 ` Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 07:38 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 09:56 ` Re: Queries very slow and memory consumption too high Dave Cramer <pg@fastcrypt.com>
0 siblings, 2 replies; 13+ messages in thread
From: Saurabh Dave @ 2009-06-23 01:48 UTC (permalink / raw)
To: Albe Laurenz <laurenz.albe@wien.gv.at>; +Cc: pgsql-jdbc
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?
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
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 07:32 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 01:48 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
@ 2009-06-23 07:38 ` Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 08:05 ` Re: Queries very slow and memory consumption too high Craig Ringer <craig@postnewspapers.com.au>
1 sibling, 1 reply; 13+ messages in thread
From: Albe Laurenz @ 2009-06-23 07:38 UTC (permalink / raw)
To: Saurabh Dave *EXTERN* <saurabhdave@gmail.com>; +Cc: pgsql-jdbc
Saurabh Dave wrote:
> "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?
I don't think that this will have a big impact, and I wouldn't
do it if I were you. You want your database to be encoding-aware,
don't you? So I would change as little as possible in the setup,
in the hope that you can reproduce the slowdown.
Moving to 8.3.7 (what is 8.3.7.1?), on the other hand, is certainly
a good thing.
If your problem is something that develops over time, one thing
you could watch out for are resource leaks, most prominently
memory leaks.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 07:32 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 01:48 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 07:38 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
@ 2009-06-23 08:05 ` Craig Ringer <craig@postnewspapers.com.au>
2009-06-23 08:44 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
0 siblings, 1 reply; 13+ messages in thread
From: Craig Ringer @ 2009-06-23 08:05 UTC (permalink / raw)
To: Albe Laurenz <laurenz.albe@wien.gv.at>; +Cc: Saurabh Dave *EXTERN* <saurabhdave@gmail.com>; pgsql-jdbc
On Tue, 2009-06-23 at 09:38 +0200, Albe Laurenz wrote:
> Moving to 8.3.7 (what is 8.3.7.1?), on the other hand, is certainly
> a good thing.
Probably a Linux distro packaging thing, or a Windows installer
revision. On my Ubuntu 9.04 box for example, `dpkg -l postgresql-8.3'
reports Pg's version as 8.3.7-1 . The -1 is the Debian package revision,
but people may not know that.
--
Craig Ringer
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 07:32 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 01:48 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 07:38 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 08:05 ` Re: Queries very slow and memory consumption too high Craig Ringer <craig@postnewspapers.com.au>
@ 2009-06-23 08:44 ` Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 09:51 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 10:13 ` Re: Queries very slow and memory consumption too high Dave Cramer <pg@fastcrypt.com>
0 siblings, 2 replies; 13+ messages in thread
From: Saurabh Dave @ 2009-06-23 08:44 UTC (permalink / raw)
To: Craig Ringer <craig@postnewspapers.com.au>; +Cc: Albe Laurenz <laurenz.albe@wien.gv.at>; pgsql-jdbc
>>If your problem is something that develops over time, one thing
>>you could watch out for are resource leaks, most prominently
>>memory leaks.
What is the recommended way to do that? It seems postgres uses shared
memory, and we have 15 connections all taking up around 35MB as per task
manager OR top. We are not able to figure out definitatively if there is a
memory leak.
Help/Clues??? Thanks all for your responses so far.
- Saurabh
On Tue, Jun 23, 2009 at 1:35 PM, Craig Ringer
<craig@postnewspapers.com.au>wrote:
> On Tue, 2009-06-23 at 09:38 +0200, Albe Laurenz wrote:
>
> > Moving to 8.3.7 (what is 8.3.7.1?), on the other hand, is certainly
> > a good thing.
>
> Probably a Linux distro packaging thing, or a Windows installer
> revision. On my Ubuntu 9.04 box for example, `dpkg -l postgresql-8.3'
> reports Pg's version as 8.3.7-1 . The -1 is the Debian package revision,
> but people may not know that.
>
> --
> Craig Ringer
>
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 07:32 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 01:48 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 07:38 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 08:05 ` Re: Queries very slow and memory consumption too high Craig Ringer <craig@postnewspapers.com.au>
2009-06-23 08:44 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
@ 2009-06-23 09:51 ` Albe Laurenz <laurenz.albe@wien.gv.at>
1 sibling, 0 replies; 13+ messages in thread
From: Albe Laurenz @ 2009-06-23 09:51 UTC (permalink / raw)
To: Saurabh Dave *EXTERN* <saurabhdave@gmail.com>; Craig Ringer <craig@postnewspapers.com.au>; +Cc: pgsql-jdbc
Saurabh Dave wrote:
>>>If your problem is something that develops over time, one thing
>>>you could watch out for are resource leaks, most prominently
>>>memory leaks.
>
> What is the recommended way to do that? It seems postgres
> uses shared memory, and we have 15 connections all taking up
> around 35MB as per task manager OR top. We are not able to
> figure out definitatively if there is a memory leak.
> Help/Clues??? Thanks all for your responses so far.
I'm just ranting, a memory leak frequently does not impact
performance (before the machine starts thrashing...).
When watching for memory leaks, you can (as a crude measure)
daily list the memory that each process consumes and
track notable increases for long running processes.
PostgreSQL shared memory should be excluded here: it does
not increase and it will show up in each backend, thus
confusing the issue.
Once things get slow, find out if the CPU or the disks
are busy and watch out for unusual "vmstat" output.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 07:32 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 01:48 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 07:38 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 08:05 ` Re: Queries very slow and memory consumption too high Craig Ringer <craig@postnewspapers.com.au>
2009-06-23 08:44 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
@ 2009-06-23 10:13 ` Dave Cramer <pg@fastcrypt.com>
2009-06-23 10:30 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
1 sibling, 1 reply; 13+ messages in thread
From: Dave Cramer @ 2009-06-23 10:13 UTC (permalink / raw)
To: Saurabh Dave <saurabhdave@gmail.com>; +Cc: Craig Ringer <craig@postnewspapers.com.au>; Albe Laurenz <laurenz.albe@wien.gv.at>; pgsql-jdbc
On Tue, Jun 23, 2009 at 4:44 AM, Saurabh Dave <saurabhdave@gmail.com> wrote:
> >>If your problem is something that develops over time, one thing
> >>you could watch out for are resource leaks, most prominently
> >>memory leaks.
>
> What is the recommended way to do that? It seems postgres uses shared
> memory, and we have 15 connections all taking up around 35MB as per task
> manager OR top. We are not able to figure out definitatively if there is a
> memory leak.
> Help/Clues??? Thanks all for your responses so far.
>
This also suggests that you have not tuned pg. 35M shared memory is not very
much. You should look at tuning the installation.
Dave
>
> - Saurabh
>
>
>
> On Tue, Jun 23, 2009 at 1:35 PM, Craig Ringer <craig@postnewspapers.com.au
> > wrote:
>
>> On Tue, 2009-06-23 at 09:38 +0200, Albe Laurenz wrote:
>>
>> > Moving to 8.3.7 (what is 8.3.7.1?), on the other hand, is certainly
>> > a good thing.
>>
>> Probably a Linux distro packaging thing, or a Windows installer
>> revision. On my Ubuntu 9.04 box for example, `dpkg -l postgresql-8.3'
>> reports Pg's version as 8.3.7-1 . The -1 is the Debian package revision,
>> but people may not know that.
>>
>> --
>> Craig Ringer
>>
>>
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 07:32 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 01:48 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 07:38 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 08:05 ` Re: Queries very slow and memory consumption too high Craig Ringer <craig@postnewspapers.com.au>
2009-06-23 08:44 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 10:13 ` Re: Queries very slow and memory consumption too high Dave Cramer <pg@fastcrypt.com>
@ 2009-06-23 10:30 ` Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 12:13 ` Re: Queries very slow and memory consumption too high Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 13+ messages in thread
From: Albe Laurenz @ 2009-06-23 10:30 UTC (permalink / raw)
To: Dave Cramer *EXTERN* <pg@fastcrypt.com>; Saurabh Dave <saurabhdave@gmail.com>; +Cc: Craig Ringer <craig@postnewspapers.com.au>; pgsql-jdbc
Dave Cramer wrote:
> This also suggests that you have not tuned pg. 35M shared
> memory is not very much. You should look at tuning the installation.
Maybe, but first the problem should be identified, else this falls into
the category of "changing things without knowing why".
Maybe the whole database is only 30MB big?
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 07:32 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 01:48 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 07:38 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 08:05 ` Re: Queries very slow and memory consumption too high Craig Ringer <craig@postnewspapers.com.au>
2009-06-23 08:44 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 10:13 ` Re: Queries very slow and memory consumption too high Dave Cramer <pg@fastcrypt.com>
2009-06-23 10:30 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
@ 2009-06-23 12:13 ` Dave Cramer <pg@fastcrypt.com>
0 siblings, 0 replies; 13+ messages in thread
From: Dave Cramer @ 2009-06-23 12:13 UTC (permalink / raw)
To: Albe Laurenz <laurenz.albe@wien.gv.at>; +Cc: Saurabh Dave <saurabhdave@gmail.com>; Craig Ringer <craig@postnewspapers.com.au>; pgsql-jdbc
On Tue, Jun 23, 2009 at 6:30 AM, Albe Laurenz <laurenz.albe@wien.gv.at>wrote:
> Dave Cramer wrote:
> > This also suggests that you have not tuned pg. 35M shared
> > memory is not very much. You should look at tuning the installation.
>
> Maybe, but first the problem should be identified, else this falls into
> the category of "changing things without knowing why".
> Maybe the whole database is only 30MB big?
Certainly a valid point, however the fact that it is untuned suggests that
the OP should read about tuning.
DAve
>
>
> Yours,
> Laurenz Albe
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Queries very slow and memory consumption too high
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 07:32 ` Re: Queries very slow and memory consumption too high Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 01:48 ` Re: Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
@ 2009-06-23 09:56 ` Dave Cramer <pg@fastcrypt.com>
1 sibling, 0 replies; 13+ messages in thread
From: Dave Cramer @ 2009-06-23 09:56 UTC (permalink / raw)
To: Saurabh Dave <saurabhdave@gmail.com>; +Cc: Albe Laurenz <laurenz.albe@wien.gv.at>; pgsql-jdbc
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
>>
>
>
^ permalink raw reply [nested|flat] 13+ messages in thread
end of thread, other threads:[~2009-06-23 12:13 UTC | newest]
Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-06-22 05:02 Queries very slow and memory consumption too high Saurabh Dave <saurabhdave@gmail.com>
2009-06-22 06:41 ` Craig Ringer <craig@postnewspapers.com.au>
2009-06-22 07:02 ` Thomas Kellerer <spam_eater@gmx.net>
2009-06-22 07:32 ` Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 01:48 ` Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 07:38 ` Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 08:05 ` Craig Ringer <craig@postnewspapers.com.au>
2009-06-23 08:44 ` Saurabh Dave <saurabhdave@gmail.com>
2009-06-23 09:51 ` Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 10:13 ` Dave Cramer <pg@fastcrypt.com>
2009-06-23 10:30 ` Albe Laurenz <laurenz.albe@wien.gv.at>
2009-06-23 12:13 ` Dave Cramer <pg@fastcrypt.com>
2009-06-23 09:56 ` Dave Cramer <pg@fastcrypt.com>
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