X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3BCD053474 for ; Thu, 24 Mar 2005 20:19:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55149-06 for ; Thu, 24 Mar 2005 20:19:02 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id DBB0952D93 for ; Thu, 24 Mar 2005 20:19:01 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j2OKJ2k8005370; Thu, 24 Mar 2005 15:19:02 -0500 (EST) To: matt@followers.net Cc: pgsql-performance@postgresql.org Subject: Re: Preventing query from hogging server In-reply-to: <42431f52.4700af57.2963.ffffe2b8@mx.gmail.com> References: <42431f52.4700af57.2963.ffffe2b8@mx.gmail.com> Comments: In-reply-to "Matthew Nuzum" message dated "Thu, 24 Mar 2005 14:13:01 -0600" Date: Thu, 24 Mar 2005 15:19:02 -0500 Message-ID: <5369.1111695542@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/521 X-Sequence-Number: 11226 "Matthew Nuzum" 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