Skip site navigation (1) Skip section navigation (2)

Re: Preventing query from hogging server

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: matt(at)followers(dot)net
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Preventing query from hogging server
Date: 2005-03-24 20:19:02
Message-ID: 5369.1111695542@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
"Matthew Nuzum" <matt(dot)followers(at)gmail(dot)com> writes:
> Thanks. Other than avoiding using too much sort mem, is there anything else
> I can do to ensure this query doesn't starve other processes for resources?

Not a lot.

> Doing the explain analyze only increases my server load by 1 and seems to
> readily relinquish CPU time, but previously when I had been running a test
> query my server load rose to unacceptable levels.

Interesting.  EXPLAIN ANALYZE is going to cause a bunch of
gettimeofday() calls to be inserted ... maybe your kernel takes those as
process preemption points?  Seems unlikely, but ...

> FWIW, the explain was run from psql running on the db server, the test query
> the other day was run from one of the webservers. Should I run this on the
> db server to minimize load?

Since it's an insert/select, psql isn't participating in the data flow.
It's not going to matter where the psql process is.

			regards, tom lane

In response to

pgsql-performance by date

Next:From: Matthew T. O'ConnorDate: 2005-03-24 20:25:48
Subject: Re: pg_autovacuum not having enough suction ?
Previous:From: Matthew NuzumDate: 2005-03-24 20:13:01
Subject: Re: Preventing query from hogging server

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group