pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedFollowup Re: Performance question
5+ messages / 4 participants
[nested] [flat]
* Followup Re: Performance question
@ 2003-03-05 19:20 Bob Smith <bsmith@h-e.com>
0 siblings, 1 reply; 5+ messages in thread
From: Bob Smith @ 2003-03-05 19:20 UTC (permalink / raw)
To: pgsql-admin
OK, I seem to have fixed my own problem here again, sorry. I restarted
the postmaster, now _all_ queries are about 10x faster, and the first
execution on a new connection is no longer significantly slower than
the second. The server (and the original postmaster) had been up for:
11:18AM up 162 days, 17:48, 3 users, load averages: 0.57, 0.51, 0.51
Maybe I should have a cron script restart postmaster every now and
then, like once a week?
Bob
On Wednesday, Mar 5, 2003, at 10:11 US/Pacific, Bob Smith wrote:
>
> When I execute a query on a new connection, the performance is many
> times slower than if the query is repeated. In other words, if I
> start psql, execute the query, then repeat it immediately, the second
> time it takes only about 20% as long to execute. Now here's the
> confusing part, if I exit psql then start it up again, the same thing
> will occur on the new connection as well, the first execution takes 5x
> as long again. I don't understand this, it would make sense to me
> that the second execution being faster is due to disk caching on the
> server, but then why is it slower again on every new connection? Disk
> caching should benefit all current and new connections until the cache
> is flushed, which on this server shouldn't happen for a long time, the
> load is light and it has lots of RAM. Is Postgres doing some kind of
> caching itself that lasts only for the life of one backend process?
> If so, is there any way to make this caching persistent across
> backends?
>
> Server particulars:
>
> Postgres 7.2.1, Mac OS X Server 10.1.5, dual 1GHz CPUs, 1.5GB memory
>
> Thanks!
>
> Bob Smith
> Hammett & Edison, Inc.
> bsmith@h-e.com
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Followup Re: Performance question
@ 2003-03-05 19:29 Jodi Kanter <jkanter@virginia.edu>
parent: Bob Smith <bsmith@h-e.com>
0 siblings, 2 replies; 5+ messages in thread
From: Jodi Kanter @ 2003-03-05 19:29 UTC (permalink / raw)
To: pgsql-admin
Is restarting postmaster on a regular basis necessary for performance?
----- Original Message -----
From: "Bob Smith" <bsmith@h-e.com>
To: "pgsql-admin" <pgsql-admin@postgresql.org>
Sent: Wednesday, March 05, 2003 2:20 PM
Subject: Followup Re: [ADMIN] Performance question
>
> OK, I seem to have fixed my own problem here again, sorry. I restarted
> the postmaster, now _all_ queries are about 10x faster, and the first
> execution on a new connection is no longer significantly slower than
> the second. The server (and the original postmaster) had been up for:
>
> 11:18AM up 162 days, 17:48, 3 users, load averages: 0.57, 0.51, 0.51
>
> Maybe I should have a cron script restart postmaster every now and
> then, like once a week?
>
> Bob
>
> On Wednesday, Mar 5, 2003, at 10:11 US/Pacific, Bob Smith wrote:
>
> >
> > When I execute a query on a new connection, the performance is many
> > times slower than if the query is repeated. In other words, if I
> > start psql, execute the query, then repeat it immediately, the second
> > time it takes only about 20% as long to execute. Now here's the
> > confusing part, if I exit psql then start it up again, the same thing
> > will occur on the new connection as well, the first execution takes 5x
> > as long again. I don't understand this, it would make sense to me
> > that the second execution being faster is due to disk caching on the
> > server, but then why is it slower again on every new connection? Disk
> > caching should benefit all current and new connections until the cache
> > is flushed, which on this server shouldn't happen for a long time, the
> > load is light and it has lots of RAM. Is Postgres doing some kind of
> > caching itself that lasts only for the life of one backend process?
> > If so, is there any way to make this caching persistent across
> > backends?
> >
> > Server particulars:
> >
> > Postgres 7.2.1, Mac OS X Server 10.1.5, dual 1GHz CPUs, 1.5GB memory
> >
> > Thanks!
> >
> > Bob Smith
> > Hammett & Edison, Inc.
> > bsmith@h-e.com
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo@postgresql.org so that your
> > message can get through to the mailing list cleanly
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Followup Re: Performance question
@ 2003-03-05 20:18 Steve Crawford <scrawford@pinpointresearch.com>
parent: Jodi Kanter <jkanter@virginia.edu>
1 sibling, 0 replies; 5+ messages in thread
From: Steve Crawford @ 2003-03-05 20:18 UTC (permalink / raw)
To: Jodi Kanter <jkanter@virginia.edu>; pgsql-admin
On Wednesday 05 March 2003 11:29 am, Jodi Kanter wrote:
> Is restarting postmaster on a regular basis necessary for performance?
...snip...
Certainly not in my experience running postgres on Linux 2.4.x. I keep
individual postgres connections up for many months at a time (not just the
server - connections to the server) and haven't personally experienced a
problem.
Cheers,
Steve
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Followup Re: Performance question
@ 2003-03-06 17:08 Andrew Sullivan <andrew@libertyrms.info>
parent: Jodi Kanter <jkanter@virginia.edu>
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Sullivan @ 2003-03-06 17:08 UTC (permalink / raw)
To: pgsql-admin
On Wed, Mar 05, 2003 at 02:29:14PM -0500, Jodi Kanter wrote:
> Is restarting postmaster on a regular basis necessary for performance?
If it were, we'd throw it overboard for sure.
The one thing we _never_ restart is the postmaster. We see no
degradation in performance from this.
My suspicion is that, if you find restarting the postmaster helps, it
might be because of a long-running transaction which is hanging
around and keeping VACUUM from doing its job. Killing the postmaster
will certainly get rid of such transactions, but there are probably
less dire ways to do it ;-)
A
--
----
Andrew Sullivan 204-4141 Yonge Street
Liberty RMS Toronto, Ontario Canada
<andrew@libertyrms.info> M2P 2A8
+1 416 646 3304 x110
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Followup Re: Performance question
@ 2003-03-10 20:38 Bob Smith <bsmith@h-e.com>
0 siblings, 0 replies; 5+ messages in thread
From: Bob Smith @ 2003-03-10 20:38 UTC (permalink / raw)
To: Andrew Sullivan <andrew@libertyrms.info>
Since I started this thread I should finish it with the final
resolution of my problem.
Turns out it wasn't really the postmaster having problems on it's own,
it was the server itself. The symptom of queries taking longer on the
first execution on each new connection, plus each day the same query
taking about 3x as long as the day before, persisted for several days
after I first noticed it. Restarting the postmaster would clear things
up for a while, but by the following day the performance was in the
toilet again. Finally I re-booted the whole server and since then the
problem has not come back. So there was something going on in the
server OS, my guess is something to do with shared memory, that was
causing postgres to get increasingly worse performance after the
postmaster process had been running for a few hours. The server is a
Mac running OS X Server 10.1.5 with Postgres 7.2.1, I've been told
repeatedly that a lot of my troubles will go away if I upgrade Postgres
to 7.3 and the server OS to 10.2; as soon as I get out from under the
current project I'll be doing those upgrades.
The bottom line is, the others who responded saying postmaster restarts
are unnecessary are probably correct. On the other hand restarting
your whole server may sometimes be needed, but this is likely an
isolated problem involving OS X Server and not something chronic with
Postgres.
Bob
On Thursday, Mar 6, 2003, at 09:08 US/Pacific, Andrew Sullivan wrote:
> On Wed, Mar 05, 2003 at 02:29:14PM -0500, Jodi Kanter wrote:
>> Is restarting postmaster on a regular basis necessary for performance?
>
> If it were, we'd throw it overboard for sure.
>
> The one thing we _never_ restart is the postmaster. We see no
> degradation in performance from this.
>
> My suspicion is that, if you find restarting the postmaster helps, it
> might be because of a long-running transaction which is hanging
> around and keeping VACUUM from doing its job. Killing the postmaster
> will certainly get rid of such transactions, but there are probably
> less dire ways to do it ;-)
>
> A
>
>
> --
> ----
> Andrew Sullivan 204-4141 Yonge Street
> Liberty RMS Toronto, Ontario Canada
> <andrew@libertyrms.info> M2P 2A8
> +1 416 646 3304 x110
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2003-03-10 20:38 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-03-05 19:20 Followup Re: Performance question Bob Smith <bsmith@h-e.com>
2003-03-05 19:29 ` Jodi Kanter <jkanter@virginia.edu>
2003-03-05 20:18 ` Steve Crawford <scrawford@pinpointresearch.com>
2003-03-06 17:08 ` Andrew Sullivan <andrew@libertyrms.info>
2003-03-10 20:38 Re: Followup Re: Performance question Bob Smith <bsmith@h-e.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