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

Re: Preventing query from hogging server

From: "Matthew Nuzum" <matt(dot)followers(at)gmail(dot)com>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Preventing query from hogging server
Date: 2005-03-24 20:13:01
Message-ID: 42431f52.4700af57.2963.ffffe2b8@mx.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
> I would strongly suggest doing the min and max calculations together:
> 
> 	select groupid, min(col), max(col) from ...
>
> because if you do them in two separate queries 90% of the effort will be
> duplicated.
>
>			regards, tom lane

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?

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.

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?

-- 
Matthew Nuzum <matt(at)followers(dot)net>
www.followers.net - Makers of "Elite Content Management System"
View samples of Elite CMS in action by visiting
http://www.followers.net/portfolio/


In response to

Responses

pgsql-performance by date

Next:From: Tom LaneDate: 2005-03-24 20:19:02
Subject: Re: Preventing query from hogging server
Previous:From: Tom LaneDate: 2005-03-24 20:02:15
Subject: Re: Preventing query from hogging server

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